src/ztfy/myams/resources/js/ext/jquery-select2-sortable.min.js
changeset 206 02a40997d8cb
parent 130 e3cb023c73b6
--- a/src/ztfy/myams/resources/js/ext/jquery-select2-sortable.min.js	Fri May 12 14:03:02 2017 +0200
+++ b/src/ztfy/myams/resources/js/ext/jquery-select2-sortable.min.js	Thu Oct 26 14:45:34 2017 +0200
@@ -1,1 +1,1 @@
-(function(a){a.fn.extend({select2SortableOrder:function(){var b=this.filter("[multiple]");b.each(function(){var f=a(this);if(typeof(f.data("select2"))!=="object"){return false}var e=f.siblings(".select2-container");var d;var c=[];f.find("optgroup").each(function(g,h){c.push(h)});f.find("option").each(function(h,i){var j=a(this).parent("optgroup").prop("label");var g=this;if(j===undefined){if(this.value!==""&&!this.selected){c.push(g)}}});d=a(e.find('.select2-choices li[class!="select2-search-field"]').map(function(){if(!this){return undefined}var g=a(this).data("select2Data").id;return f.find('option[value="'+g+'"]')[0]}));d.push.apply(d,c);f.children().remove();f.append(d)});return b},select2Sortable:function(){var d=Array.prototype.slice.call(arguments,0);$this=this.filter("[multiple]"),validMethods=["destroy"];if(d.length===0||typeof(d[0])==="object"){var b={bindOrder:"formSubmit",sortableOptions:{placeholder:"ui-state-highlight",items:"li:not(.select2-search-field)",tolerance:"pointer"}};var c=a.extend(b,d[0]);if(typeof($this.data("select2"))!=="object"){$this.select2()}$this.each(function(){var e=a(this);var f=e.siblings(".select2-container").find(".select2-choices");f.sortable(c.sortableOptions);switch(c.bindOrder){case"sortableStop":f.on("sortstop.select2sortable",function(g,h){e.select2SortableOrder()});e.on("change",function(g){a(this).select2SortableOrder()});break;default:e.closest("form").unbind("submit.select2sortable").on("submit.select2sortable",function(){e.select2SortableOrder()});break}})}else{if(typeof(d[0]==="string")){if(a.inArray(d[0],validMethods)==-1){throw"Unknown method: "+d[0]}if(d[0]==="destroy"){$this.select2SortableDestroy()}}}return $this},select2SortableDestroy:function(){var b=this.filter("[multiple]");b.each(function(){var c=a(this);var d=c.parent().find(".select2-choices");c.closest("form").unbind("submit.select2sortable");d.unbind("sortstop.select2sortable");d.sortable("destroy")});return b}})}(jQuery));
\ No newline at end of file
+!function(e){e.fn.extend({select2SortableOrder:function(){var t=this.filter("[multiple]");return t.each(function(){var t=e(this);if("object"!=typeof t.data("select2"))return!1;var s,i=t.siblings(".select2-container");if("hidden"===t.attr("type")){var r=i.data("select2"),o=r.opts.separator,l=[];e.each(r.data(),function(){l.push(this.id)}),t.val(l.join(o))}else{var n=[];t.find("optgroup").each(function(e,t){n.push(t)}),t.find("option").each(function(t,s){var i=this;void 0===e(this).parent("optgroup").prop("label")&&(""===this.value||this.selected||n.push(i))}),(s=e(i.find('.select2-choices li[class!="select2-search-field"]').map(function(){if(this){var s=e(this).data("select2Data").id;return t.find('option[value="'+s+'"]')[0]}}))).push.apply(s,n),t.children().remove(),t.append(s)}}),t},select2Sortable:function(){var t=Array.prototype.slice.call(arguments,0);if($this=this.filter("[multiple]"),validMethods=["destroy"],0===t.length||"object"==typeof t[0]){var s=e.extend({bindOrder:"formSubmit",sortableOptions:{placeholder:"ui-state-highlight",items:"li:not(.select2-search-field)",tolerance:"pointer"}},t[0]);"object"!=typeof $this.data("select2")&&$this.select2(),$this.each(function(){var t=e(this),i=t.siblings(".select2-container").find(".select2-choices");switch(i.sortable(s.sortableOptions),s.bindOrder){case"sortableStop":i.on("sortstop.select2sortable",function(e,s){t.select2SortableOrder()}),t.on("change",function(t){e(this).select2SortableOrder()});break;default:t.closest("form").unbind("submit.select2sortable").on("submit.select2sortable",function(){t.select2SortableOrder()})}})}else if(t[0],!0){if(-1==e.inArray(t[0],validMethods))throw"Unknown method: "+t[0];"destroy"===t[0]&&$this.select2SortableDestroy()}return $this},select2SortableDestroy:function(){var t=this.filter("[multiple]");return t.each(function(){var t=e(this),s=t.parent().find(".select2-choices");t.closest("form").unbind("submit.select2sortable"),s.unbind("sortstop.select2sortable"),s.sortable("destroy")}),t}})}(jQuery);