summaryrefslogtreecommitdiff
path: root/chimere/static/bsmSelect/js/jquery.bsmselect.sortable.js
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/static/bsmSelect/js/jquery.bsmselect.sortable.js')
-rw-r--r--chimere/static/bsmSelect/js/jquery.bsmselect.sortable.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/chimere/static/bsmSelect/js/jquery.bsmselect.sortable.js b/chimere/static/bsmSelect/js/jquery.bsmselect.sortable.js
index 3e4b9f8..cd79028 100644
--- a/chimere/static/bsmSelect/js/jquery.bsmselect.sortable.js
+++ b/chimere/static/bsmSelect/js/jquery.bsmselect.sortable.js
@@ -1,17 +1,17 @@
/*
* Better Select Multiple Sortable Plugin
*
- * Copyright (c) 2010 by Victor Berchet - http://www.github.com/vicb
+ * Copyright (c) 2010-2012 by Victor Berchet - http://www.github.com/vicb
*
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
*
- * version: v1.1.1 - 2010-11-17
+ * version: v1.4.4 - 2012-01-19
*/
(function($) {
$.bsmSelect.plugins.sortable = function(sortConfig, options)
{
- if (!(this instanceof arguments.callee)) {
- return new arguments.callee(sortConfig, options);
+ if (!(this instanceof $.bsmSelect.plugins.sortable)) {
+ return new $.bsmSelect.plugins.sortable(sortConfig, options);
}
this.sortConfig = sortConfig;
this.options = $.extend({}, this.defaultOpt, options || {});
@@ -27,13 +27,18 @@
config = $.extend({}, this.sortConfig, { items: '.' + o.listItemClass }),
self = this;
bsm.$list.addClass(o.listSortableClass).sortable(config);
+ // Fix a bug when the 'html' element has an overflow set to either 'scroll' or 'auto' on FF.
+ // See issue #21 (https://github.com/vicb/bsmSelect/issues/21)
+ if ($.inArray($('html').css('overflow-x'), ['auto', 'scroll']) > -1 || $.inArray($('html').css('overflow-y'), ['auto', 'scroll']) > -1) {
+ $('.' + o.listSortableClass).addClass('bsmScrollWorkaround');
+ }
bsm.$original.bind('change', function(e, info) { self.onChange.call(self, bsm, e, info); } );
bsm.$list.bind('sortupdate', function(e, ui) { self.onSort.call(self, bsm, e, ui); } );
},
onChange: function(bsm, e, info) {
- if (info && info.type == 'add' && !bsm.buildingSelect) {
- info.option.detach()[bsm.options.addItemTarget == 'top' ? 'prependTo' : 'appendTo'](bsm.$original);
+ if (info && info.type === 'add' && !bsm.buildingSelect) {
+ info.option.detach()[bsm.options.addItemTarget === 'top' ? 'prependTo' : 'appendTo'](bsm.$original);
bsm.$list.sortable('refresh');
}
},
@@ -46,4 +51,3 @@
}
});
})(jQuery);
-