PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / trunk
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls vtrunk
6.4.9 6.4.8 6.4.7 6.4.6 6.4.5 6.4.4 6.4.3 6.4.2 6.4.1 6.4.0 6.3.9 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 5.6.0 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 5.6.6 5.6.7 All 152 releases
poll-maker / select2 / src / js / jquery.select2.js

jquery.select2.js in Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls trunk, at select2/src/js/jquery.select2.js

59 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 define([
2 'jquery',
3 'jquery-mousewheel',
4
5 './select2/core',
6 './select2/defaults',
7 './select2/utils'
8 ], function ($, _, Select2, Defaults, Utils) {
9 if ($.fn.select2 == null) {
10 // All methods that should return the element
11 var thisMethods = ['open', 'close', 'destroy'];
12
13 $.fn.select2 = function (options) {
14 options = options || {};
15
16 if (typeof options === 'object') {
17 this.each(function () {
18 var instanceOptions = $.extend(true, {}, options);
19
20 var instance = new Select2($(this), instanceOptions);
21 });
22
23 return this;
24 } else if (typeof options === 'string') {
25 var ret;
26 var args = Array.prototype.slice.call(arguments, 1);
27
28 this.each(function () {
29 var instance = Utils.GetData(this, 'select2');
30
31 if (instance == null && window.console && console.error) {
32 console.error(
33 'The select2(\'' + options + '\') method was called on an ' +
34 'element that is not using Select2.'
35 );
36 }
37
38 ret = instance[options].apply(instance, args);
39 });
40
41 // Check if we should be returning `this`
42 if ($.inArray(options, thisMethods) > -1) {
43 return this;
44 }
45
46 return ret;
47 } else {
48 throw new Error('Invalid arguments for Select2: ' + options);
49 }
50 };
51 }
52
53 if ($.fn.select2.defaults == null) {
54 $.fn.select2.defaults = Defaults;
55 }
56
57 return Select2;
58 });
59