Merge pull request #247 from vbortone/feature/jquery.tagsmanager

Tags Manager type definitions and tests
This commit is contained in:
Boris Yankov
2013-02-04 09:49:17 -08:00
2 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="jquery.tagsmanager.d.ts" />
var options: TagsManagerOptions = {
prefilled: ["Pisa", "Rome"],
CapitalizeFirstLetter: true,
preventSubmitOnEnter: true,
typeahead: true,
typeaheadAjaxSource: null,
typeaheadSource: ["Pisa", "Rome", "Milan", "Florence", "New York", "Paris", "Berlin", "London", "Madrid"],
delimeters: [44, 188, 13],
backspace: [8],
blinkBGColor_1: '#FFFF9C',
blinkBGColor_2: '#CDE69C',
hiddenTagListName: 'hiddenTagListA'
};
jQuery(".tagManager").tagsManager(options);
jQuery(".tagManager").tagsManager('popTag');
jQuery(".tagManager").tagsManager('pushTag', 'I_am_a_new_tag');
jQuery(".tagManager").tagsManager('empty');

View File

@@ -0,0 +1,31 @@
// Type definitions for jQuery Tags Manager
// Project: http://welldonethings.com/tags/manager
// Definitions by: https://github.com/vbortone
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
interface TagsManagerOptions {
prefilled?: any;
CapitalizeFirstLetter?: bool;
preventSubmitOnEnter?: bool;
typeahead?: bool;
typeaheadAjaxSource?: string;
typeaheadSource?: any;
typeaheadAjaxPolling?: bool;
AjaxPush?: string; //url
delimeters?: number[];
backspace?: number[];
blinkBGColor_1?: string;
blinkBGColor_2?: string;
hiddenTagListName?: string;
maxTags?: number;
deleteTagsOnBackspace?: bool;
tagsContainer?: HTMLElement;
tagCloseIcon?: string;
tagClass?: string;
}
interface JQuery {
tagsManager(options: TagsManagerOptions): JQuery;
tagsManager(command: string, tagToManipulate?: string): JQuery;
}