|
@@ -29,7 +29,7 @@
|
|
|
return this;
|
|
|
}
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
})(jQuery);
|
|
|
|
|
|
(function ($, undefined) {
|
|
@@ -163,7 +163,7 @@
|
|
|
*
|
|
|
* filters out mouse events that occur when mouse is stationary but
|
|
|
* the elements under the pointer are scrolled.
|
|
|
- */
|
|
|
+ */
|
|
|
function installFilteredMouseMove(element) {
|
|
|
element.bind("mousemove", function (e) {
|
|
|
var lastpos = $(document).data("select2-lastpos");
|
|
@@ -201,7 +201,7 @@
|
|
|
event.stopPropagation();
|
|
|
}
|
|
|
|
|
|
- function measureTextWidth(e) {
|
|
|
+ function measureTextWidth(e) {
|
|
|
if (!sizer){
|
|
|
var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
|
|
|
sizer = $("<div></div>").css({
|
|
@@ -216,10 +216,10 @@
|
|
|
letterSpacing: style.letterSpacing,
|
|
|
textTransform: style.textTransform,
|
|
|
whiteSpace: "nowrap"
|
|
|
- });
|
|
|
+ });
|
|
|
$("body").append(sizer);
|
|
|
}
|
|
|
- sizer.text(e.val());
|
|
|
+ sizer.text(e.val());
|
|
|
return sizer.width();
|
|
|
}
|
|
|
|
|
@@ -268,11 +268,11 @@
|
|
|
data = options.data, // ajax data function
|
|
|
transport = options.transport || $.ajax,
|
|
|
type = options.type || 'GET'; // set type of request (GET or POST)
|
|
|
-
|
|
|
+
|
|
|
data = data.call(this, query.term, query.page, query.context);
|
|
|
|
|
|
if( null !== handler) { handler.abort(); }
|
|
|
-
|
|
|
+
|
|
|
handler = transport.call(null, {
|
|
|
url: options.url,
|
|
|
dataType: options.dataType,
|
|
@@ -507,14 +507,14 @@
|
|
|
select2.opts.element
|
|
|
.removeData("select2")
|
|
|
.unbind(".select2")
|
|
|
- .show();
|
|
|
+ .show();
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// abstract
|
|
|
prepareOpts: function (opts) {
|
|
|
var element, select, idKey;
|
|
|
-
|
|
|
+
|
|
|
element = opts.element;
|
|
|
|
|
|
if (element.get(0).tagName.toLowerCase() === "select") {
|
|
@@ -665,8 +665,7 @@
|
|
|
data.push({id: this, text: this});
|
|
|
});
|
|
|
|
|
|
- if ($.isFunction(callback))
|
|
|
- callback(data);
|
|
|
+ callback(data);
|
|
|
};
|
|
|
}
|
|
|
}
|
|
@@ -746,11 +745,11 @@
|
|
|
if (this.opened()) return;
|
|
|
|
|
|
this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
|
|
|
- if(this.dropdown[0] !== this.body.children().last()[0]) {
|
|
|
+ if(this.dropdown[0] !== this.body.children().last()[0]) {
|
|
|
// ensure the dropdown is the last child of body, so the z-index is always respected correctly
|
|
|
this.dropdown.detach().appendTo(this.body);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this.dropdown.addClass("select2-drop-active");
|
|
|
|
|
|
this.positionDropdown();
|
|
@@ -779,11 +778,11 @@
|
|
|
// abstract
|
|
|
ensureHighlightVisible: function () {
|
|
|
var results = this.results, children, index, child, hb, rb, y, more;
|
|
|
-
|
|
|
+
|
|
|
index = this.highlight();
|
|
|
|
|
|
if (index < 0) return;
|
|
|
-
|
|
|
+
|
|
|
children = results.find(".select2-result");
|
|
|
|
|
|
child = $(children[index]);
|
|
@@ -849,7 +848,7 @@
|
|
|
|
|
|
// abstract
|
|
|
highlightUnderEvent: function (event) {
|
|
|
- var el = $(event.target).closest(".select2-result");
|
|
|
+ var el = $(event.target).closest(".select2-result");
|
|
|
if (el.length > 0 && !el.is(".select2-highlighted")) {
|
|
|
var choices = this.results.find('.select2-result');
|
|
|
this.highlight(choices.index(el));
|
|
@@ -1185,7 +1184,7 @@
|
|
|
self.updateSelection(selected);
|
|
|
self.close();
|
|
|
self.setPlaceholder();
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -1481,9 +1480,9 @@
|
|
|
self.close();
|
|
|
// set the placeholder if necessary
|
|
|
self.clearSearch();
|
|
|
- }
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// multi
|