Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bootstrap-duallistbox

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootstrap-duallistbox - npm Package Compare versions

Comparing version 3.0.6 to 3.0.9

8

bootstrap-duallistbox.jquery.json

@@ -12,3 +12,3 @@ {

],
"version": "3.0.6",
"version": "3.0.9",
"author": {

@@ -24,5 +24,5 @@ "name": "István Ujj-Mészáros",

],
"homepage": "http://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"demo": "http://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"docs": "http://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"homepage": "https://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"demo": "https://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"docs": "https://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"download": "https://github.com/istvan-ujjmeszaros/bootstrap-duallistbox/archive/master.zip",

@@ -29,0 +29,0 @@ "dependencies": {

{
"name": "bootstrap-duallistbox",
"version": "3.0.6",
"homepage": "http://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"version": "3.0.9",
"homepage": "https://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"authors": [

@@ -6,0 +6,0 @@ {

@@ -6,4 +6,4 @@ {

"description": "A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices.",
"homepage": "http://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"version": "3.0.6",
"homepage": "https://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"version": "3.0.9",
"authors": [

@@ -10,0 +10,0 @@ {

@@ -0,0 +0,0 @@ # Contributing

/*
* Bootstrap Duallistbox - v3.0.6
* Bootstrap Duallistbox - v3.0.9
* A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices.
* http://www.virtuosoft.eu/code/bootstrap-duallistbox/
* https://www.virtuosoft.eu/code/bootstrap-duallistbox/
*

@@ -21,2 +21,3 @@ * Made by István Ujj-Mészáros

moveOnSelect: true, // true/false (forced true on androids, see the comment later)
moveOnDoubleClick: true, // true/false (forced false on androids, cause moveOnSelect is forced to true)
preserveSelectionOnMove: false, // 'all' / 'moved' / false

@@ -209,6 +210,9 @@ selectedListLabel: false, // 'string', false

function sortOptions(select) {
function sortOptions(select, dualListbox) {
select.find('option').sort(function(a, b) {
return ($(a).data('original-index') > $(b).data('original-index')) ? 1 : -1;
}).appendTo(select);
// workaround for chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1072475
refreshSelects(dualListbox);
}

@@ -242,3 +246,3 @@

} else {
sortOptions(dualListbox.elements.select2);
sortOptions(dualListbox.elements.select2, dualListbox);
}

@@ -264,3 +268,3 @@ }

triggerChangeEvent(dualListbox);
sortOptions(dualListbox.elements.select1);
sortOptions(dualListbox.elements.select1, dualListbox);
if(dualListbox.settings.sortByInputOrder){

@@ -455,2 +459,3 @@ sortOptionsByInputOrder(dualListbox.elements.select2);

this.setMoveOnSelect(this.settings.moveOnSelect);
this.setMoveOnDoubleClick(this.settings.moveOnDoubleClick);
this.setPreserveSelectionOnMove(this.settings.preserveSelectionOnMove);

@@ -583,2 +588,26 @@ this.setSelectedListLabel(this.settings.selectedListLabel);

},
setMoveOnDoubleClick: function(value, refresh) {
if (isBuggyAndroid) {
value = false;
}
this.settings.moveOnDoubleClick = value;
if (this.settings.moveOnDoubleClick) {
this.container.addClass('moveondoubleclick');
var self = this;
this.elements.select1.on('dblclick', function() {
move(self);
});
this.elements.select2.on('dblclick', function() {
remove(self);
});
} else {
this.container.removeClass('moveondoubleclick');
this.elements.select1.off('dblclick');
this.elements.select2.off('dblclick');
}
if (refresh) {
refreshSelects(this);
}
return this.element;
},
setPreserveSelectionOnMove: function(value, refresh) {

@@ -685,2 +714,9 @@ // We are forcing to move on select and disabling preserveSelectionOnMove on Android

this.settings.infoText = value;
if (value) {
this.elements.info1.show();
this.elements.info2.show();
} else {
this.elements.info1.hide();
this.elements.info2.hide();
}
if (refresh) {

@@ -687,0 +723,0 @@ refreshSelects(this);

/*
* Bootstrap Duallistbox - v3.0.6
* Bootstrap Duallistbox - v3.0.9
* A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices.
* http://www.virtuosoft.eu/code/bootstrap-duallistbox/
* https://www.virtuosoft.eu/code/bootstrap-duallistbox/
*

@@ -9,2 +9,3 @@ * Made by István Ujj-Mészáros

*/
!function(a,b,c,d){function e(b,c){this.element=a(b),this.settings=a.extend({},w,c),this._defaults=w,this._name=v,this.init()}function f(a){a.element.trigger("change")}function g(b){b.element.find("option").each(function(c,d){var e=a(d);"undefined"==typeof e.data("original-index")&&e.data("original-index",b.elementCount++),"undefined"==typeof e.data("_selected")&&e.data("_selected",!1)})}function h(b,c,d){b.element.find("option").each(function(e,f){var g=a(f);g.data("original-index")===c&&(g.prop("selected",d),d?(g.attr("data-sortindex",b.sortIndex),b.sortIndex++):g.removeAttr("data-sortindex"))})}function i(a,b){return a.replace(/\{(\d+)\}/g,function(a,c){return"undefined"!=typeof b[c]?b[c]:a})}function j(a){if(a.settings.infoText){var b=a.elements.select1.find("option").length,c=a.elements.select2.find("option").length,d=a.element.find("option").length-a.selectedElements,e=a.selectedElements,f="";f=0===d?a.settings.infoTextEmpty:b===d?i(a.settings.infoText,[b,d]):i(a.settings.infoTextFiltered,[b,d]),a.elements.info1.html(f),a.elements.box1.toggleClass("filtered",!(b===d||0===d)),f=0===e?a.settings.infoTextEmpty:c===e?i(a.settings.infoText,[c,e]):i(a.settings.infoTextFiltered,[c,e]),a.elements.info2.html(f),a.elements.box2.toggleClass("filtered",!(c===e||0===e))}}function k(b){b.selectedElements=0,b.elements.select1.empty(),b.elements.select2.empty(),b.element.find("option").each(function(c,d){var e=a(d);e.prop("selected")?(b.selectedElements++,b.elements.select2.append(e.clone(!0).prop("selected",e.data("_selected")))):b.elements.select1.append(e.clone(!0).prop("selected",e.data("_selected")))}),b.settings.showFilterInputs&&(l(b,1),l(b,2)),j(b)}function l(b,c){if(b.settings.showFilterInputs){m(b,c),b.elements["select"+c].empty().scrollTop(0);var d=new RegExp(a.trim(b.elements["filterInput"+c].val()),"gi"),e=b.element.find("option"),f=b.element;f=1===c?e.not(":selected"):f.find("option:selected"),f.each(function(f,g){var h=a(g),i=!0;(g.text.match(d)||b.settings.filterOnValues&&h.attr("value").match(d))&&(i=!1,b.elements["select"+c].append(h.clone(!0).prop("selected",h.data("_selected")))),e.eq(h.data("original-index")).data("filtered"+c,i)}),j(b)}}function m(b,c){var d=b.element.find("option");b.elements["select"+c].find("option").each(function(b,c){var e=a(c);d.eq(e.data("original-index")).data("_selected",e.prop("selected"))})}function n(a){var b=a.children("option");b.sort(function(a,b){var c=parseInt(a.getAttribute("data-sortindex")),d=parseInt(b.getAttribute("data-sortindex"));return c>d?1:d>c?-1:0}),b.detach().appendTo(a)}function o(b){b.find("option").sort(function(b,c){return a(b).data("original-index")>a(c).data("original-index")?1:-1}).appendTo(b)}function p(a){a.elements.select1.find("option").each(function(){a.element.find("option").data("_selected",!1)})}function q(b){"all"!==b.settings.preserveSelectionOnMove||b.settings.moveOnSelect?"moved"!==b.settings.preserveSelectionOnMove||b.settings.moveOnSelect||m(b,1):(m(b,1),m(b,2)),b.elements.select1.find("option:selected").each(function(c,d){var e=a(d);e.data("filtered1")||h(b,e.data("original-index"),!0)}),k(b),f(b),b.settings.sortByInputOrder?n(b.elements.select2):o(b.elements.select2)}function r(b){"all"!==b.settings.preserveSelectionOnMove||b.settings.moveOnSelect?"moved"!==b.settings.preserveSelectionOnMove||b.settings.moveOnSelect||m(b,2):(m(b,1),m(b,2)),b.elements.select2.find("option:selected").each(function(c,d){var e=a(d);e.data("filtered2")||h(b,e.data("original-index"),!1)}),k(b),f(b),o(b.elements.select1),b.settings.sortByInputOrder&&n(b.elements.select2)}function s(b){"all"!==b.settings.preserveSelectionOnMove||b.settings.moveOnSelect?"moved"!==b.settings.preserveSelectionOnMove||b.settings.moveOnSelect||m(b,1):(m(b,1),m(b,2)),b.element.find("option").each(function(c,d){var e=a(d);e.data("filtered1")||(e.prop("selected",!0),e.attr("data-sortindex",b.sortIndex),b.sortIndex++)}),k(b),f(b)}function t(b){"all"!==b.settings.preserveSelectionOnMove||b.settings.moveOnSelect?"moved"!==b.settings.preserveSelectionOnMove||b.settings.moveOnSelect||m(b,2):(m(b,1),m(b,2)),b.element.find("option").each(function(b,c){var d=a(c);d.data("filtered2")||(d.prop("selected",!1),d.removeAttr("data-sortindex"))}),k(b),f(b)}function u(a){a.elements.form.submit(function(b){a.elements.filterInput1.is(":focus")?(b.preventDefault(),a.elements.filterInput1.focusout()):a.elements.filterInput2.is(":focus")&&(b.preventDefault(),a.elements.filterInput2.focusout())}),a.element.on("bootstrapDualListbox.refresh",function(b,c){a.refresh(c)}),a.elements.filterClear1.on("click",function(){a.setNonSelectedFilter("",!0)}),a.elements.filterClear2.on("click",function(){a.setSelectedFilter("",!0)}),a.settings.eventMoveOverride===!1&&a.elements.moveButton.on("click",function(){q(a)}),a.settings.eventMoveAllOverride===!1&&a.elements.moveAllButton.on("click",function(){s(a)}),a.settings.eventRemoveOverride===!1&&a.elements.removeButton.on("click",function(){r(a)}),a.settings.eventRemoveAllOverride===!1&&a.elements.removeAllButton.on("click",function(){t(a)}),a.elements.filterInput1.on("change keyup",function(){l(a,1)}),a.elements.filterInput2.on("change keyup",function(){l(a,2)})}var v="bootstrapDualListbox",w={bootstrap2Compatible:!1,filterTextClear:"show all",filterPlaceHolder:"Filter",moveSelectedLabel:"Move selected",moveAllLabel:"Move all",removeSelectedLabel:"Remove selected",removeAllLabel:"Remove all",moveOnSelect:!0,preserveSelectionOnMove:!1,selectedListLabel:!1,nonSelectedListLabel:!1,helperSelectNamePostfix:"_helper",selectorMinimalHeight:100,showFilterInputs:!0,nonSelectedFilter:"",selectedFilter:"",infoText:"Showing all {0}",infoTextFiltered:'<span class="label label-warning">Filtered</span> {0} from {1}',infoTextEmpty:"Empty list",filterOnValues:!1,sortByInputOrder:!1,eventMoveOverride:!1,eventMoveAllOverride:!1,eventRemoveOverride:!1,eventRemoveAllOverride:!1},x=/android/i.test(navigator.userAgent.toLowerCase());e.prototype={init:function(){this.container=a('<div class="bootstrap-duallistbox-container"> <div class="box1"> <label></label> <span class="info-container"> <span class="info"></span> <button type="button" class="btn clear1 pull-right"></button> </span> <input class="filter" type="text"> <div class="btn-group buttons"> <button type="button" class="btn moveall"> <i></i> <i></i> </button> <button type="button" class="btn move"> <i></i> </button> </div> <select multiple="multiple"></select> </div> <div class="box2"> <label></label> <span class="info-container"> <span class="info"></span> <button type="button" class="btn clear2 pull-right"></button> </span> <input class="filter" type="text"> <div class="btn-group buttons"> <button type="button" class="btn remove"> <i></i> </button> <button type="button" class="btn removeall"> <i></i> <i></i> </button> </div> <select multiple="multiple"></select> </div></div>').insertBefore(this.element),this.elements={originalSelect:this.element,box1:a(".box1",this.container),box2:a(".box2",this.container),filterInput1:a(".box1 .filter",this.container),filterInput2:a(".box2 .filter",this.container),filterClear1:a(".box1 .clear1",this.container),filterClear2:a(".box2 .clear2",this.container),label1:a(".box1 > label",this.container),label2:a(".box2 > label",this.container),info1:a(".box1 .info",this.container),info2:a(".box2 .info",this.container),select1:a(".box1 select",this.container),select2:a(".box2 select",this.container),moveButton:a(".box1 .move",this.container),removeButton:a(".box2 .remove",this.container),moveAllButton:a(".box1 .moveall",this.container),removeAllButton:a(".box2 .removeall",this.container),form:a(a(".box1 .filter",this.container)[0].form)},this.originalSelectName=this.element.attr("name")||"";var b="bootstrap-duallistbox-nonselected-list_"+this.originalSelectName,c="bootstrap-duallistbox-selected-list_"+this.originalSelectName;return this.elements.select1.attr("id",b),this.elements.select2.attr("id",c),this.elements.label1.attr("for",b),this.elements.label2.attr("for",c),this.selectedElements=0,this.sortIndex=0,this.elementCount=0,this.setBootstrap2Compatible(this.settings.bootstrap2Compatible),this.setFilterTextClear(this.settings.filterTextClear),this.setFilterPlaceHolder(this.settings.filterPlaceHolder),this.setMoveSelectedLabel(this.settings.moveSelectedLabel),this.setMoveAllLabel(this.settings.moveAllLabel),this.setRemoveSelectedLabel(this.settings.removeSelectedLabel),this.setRemoveAllLabel(this.settings.removeAllLabel),this.setMoveOnSelect(this.settings.moveOnSelect),this.setPreserveSelectionOnMove(this.settings.preserveSelectionOnMove),this.setSelectedListLabel(this.settings.selectedListLabel),this.setNonSelectedListLabel(this.settings.nonSelectedListLabel),this.setHelperSelectNamePostfix(this.settings.helperSelectNamePostfix),this.setSelectOrMinimalHeight(this.settings.selectorMinimalHeight),g(this),this.setShowFilterInputs(this.settings.showFilterInputs),this.setNonSelectedFilter(this.settings.nonSelectedFilter),this.setSelectedFilter(this.settings.selectedFilter),this.setInfoText(this.settings.infoText),this.setInfoTextFiltered(this.settings.infoTextFiltered),this.setInfoTextEmpty(this.settings.infoTextEmpty),this.setFilterOnValues(this.settings.filterOnValues),this.setSortByInputOrder(this.settings.sortByInputOrder),this.setEventMoveOverride(this.settings.eventMoveOverride),this.setEventMoveAllOverride(this.settings.eventMoveAllOverride),this.setEventRemoveOverride(this.settings.eventRemoveOverride),this.setEventRemoveAllOverride(this.settings.eventRemoveAllOverride),this.element.hide(),u(this),k(this),this.element},setBootstrap2Compatible:function(a,b){return this.settings.bootstrap2Compatible=a,a?(this.container.removeClass("row").addClass("row-fluid bs2compatible"),this.container.find(".box1, .box2").removeClass("col-md-6").addClass("span6"),this.container.find(".clear1, .clear2").removeClass("btn-default btn-xs").addClass("btn-mini"),this.container.find("input, select").removeClass("form-control"),this.container.find(".btn").removeClass("btn-default"),this.container.find(".moveall > i, .move > i").removeClass("glyphicon glyphicon-arrow-right").addClass("icon-arrow-right"),this.container.find(".removeall > i, .remove > i").removeClass("glyphicon glyphicon-arrow-left").addClass("icon-arrow-left")):(this.container.removeClass("row-fluid bs2compatible").addClass("row"),this.container.find(".box1, .box2").removeClass("span6").addClass("col-md-6"),this.container.find(".clear1, .clear2").removeClass("btn-mini").addClass("btn-default btn-xs"),this.container.find("input, select").addClass("form-control"),this.container.find(".btn").addClass("btn-default"),this.container.find(".moveall > i, .move > i").removeClass("icon-arrow-right").addClass("glyphicon glyphicon-arrow-right"),this.container.find(".removeall > i, .remove > i").removeClass("icon-arrow-left").addClass("glyphicon glyphicon-arrow-left")),b&&k(this),this.element},setFilterTextClear:function(a,b){return this.settings.filterTextClear=a,this.elements.filterClear1.html(a),this.elements.filterClear2.html(a),b&&k(this),this.element},setFilterPlaceHolder:function(a,b){return this.settings.filterPlaceHolder=a,this.elements.filterInput1.attr("placeholder",a),this.elements.filterInput2.attr("placeholder",a),b&&k(this),this.element},setMoveSelectedLabel:function(a,b){return this.settings.moveSelectedLabel=a,this.elements.moveButton.attr("title",a),b&&k(this),this.element},setMoveAllLabel:function(a,b){return this.settings.moveAllLabel=a,this.elements.moveAllButton.attr("title",a),b&&k(this),this.element},setRemoveSelectedLabel:function(a,b){return this.settings.removeSelectedLabel=a,this.elements.removeButton.attr("title",a),b&&k(this),this.element},setRemoveAllLabel:function(a,b){return this.settings.removeAllLabel=a,this.elements.removeAllButton.attr("title",a),b&&k(this),this.element},setMoveOnSelect:function(a,b){if(x&&(a=!0),this.settings.moveOnSelect=a,this.settings.moveOnSelect){this.container.addClass("moveonselect");var c=this;this.elements.select1.on("change",function(){q(c)}),this.elements.select2.on("change",function(){r(c)})}else this.container.removeClass("moveonselect"),this.elements.select1.off("change"),this.elements.select2.off("change");return b&&k(this),this.element},setPreserveSelectionOnMove:function(a,b){return x&&(a=!1),this.settings.preserveSelectionOnMove=a,b&&k(this),this.element},setSelectedListLabel:function(a,b){return this.settings.selectedListLabel=a,a?this.elements.label2.show().html(a):this.elements.label2.hide().html(a),b&&k(this),this.element},setNonSelectedListLabel:function(a,b){return this.settings.nonSelectedListLabel=a,a?this.elements.label1.show().html(a):this.elements.label1.hide().html(a),b&&k(this),this.element},setHelperSelectNamePostfix:function(a,b){return this.settings.helperSelectNamePostfix=a,a?(this.elements.select1.attr("name",this.originalSelectName+a+"1"),this.elements.select2.attr("name",this.originalSelectName+a+"2")):(this.elements.select1.removeAttr("name"),this.elements.select2.removeAttr("name")),b&&k(this),this.element},setSelectOrMinimalHeight:function(a,b){this.settings.selectorMinimalHeight=a;var c=this.element.height();return this.element.height()<a&&(c=a),this.elements.select1.height(c),this.elements.select2.height(c),b&&k(this),this.element},setShowFilterInputs:function(a,b){return a?(this.elements.filterInput1.show(),this.elements.filterInput2.show()):(this.setNonSelectedFilter(""),this.setSelectedFilter(""),k(this),this.elements.filterInput1.hide(),this.elements.filterInput2.hide()),this.settings.showFilterInputs=a,b&&k(this),this.element},setNonSelectedFilter:function(a,b){return this.settings.showFilterInputs?(this.settings.nonSelectedFilter=a,this.elements.filterInput1.val(a),b&&k(this),this.element):void 0},setSelectedFilter:function(a,b){return this.settings.showFilterInputs?(this.settings.selectedFilter=a,this.elements.filterInput2.val(a),b&&k(this),this.element):void 0},setInfoText:function(a,b){return this.settings.infoText=a,b&&k(this),this.element},setInfoTextFiltered:function(a,b){return this.settings.infoTextFiltered=a,b&&k(this),this.element},setInfoTextEmpty:function(a,b){return this.settings.infoTextEmpty=a,b&&k(this),this.element},setFilterOnValues:function(a,b){return this.settings.filterOnValues=a,b&&k(this),this.element},setSortByInputOrder:function(a,b){return this.settings.sortByInputOrder=a,b&&k(this),this.element},setEventMoveOverride:function(a,b){return this.settings.eventMoveOverride=a,b&&k(this),this.element},setEventMoveAllOverride:function(a,b){return this.settings.eventMoveAllOverride=a,b&&k(this),this.element},setEventRemoveOverride:function(a,b){return this.settings.eventRemoveOverride=a,b&&k(this),this.element},setEventRemoveAllOverride:function(a,b){return this.settings.eventRemoveAllOverride=a,b&&k(this),this.element},getContainer:function(){return this.container},refresh:function(a){g(this),a?p(this):(m(this,1),m(this,2)),k(this)},destroy:function(){return this.container.remove(),this.element.show(),a.data(this,"plugin_"+v,null),this.element}},a.fn[v]=function(b){var c=arguments;if(b===d||"object"==typeof b)return this.each(function(){a(this).is("select")?a.data(this,"plugin_"+v)||a.data(this,"plugin_"+v,new e(this,b)):a(this).find("select").each(function(c,d){a(d).bootstrapDualListbox(b)})});if("string"==typeof b&&"_"!==b[0]&&"init"!==b){var f;return this.each(function(){var d=a.data(this,"plugin_"+v);d instanceof e&&"function"==typeof d[b]&&(f=d[b].apply(d,Array.prototype.slice.call(c,1)))}),f!==d?f:this}}}(jQuery,window,document);
!function(a,e){var s="bootstrapDualListbox",n={bootstrap2Compatible:!1,filterTextClear:"show all",filterPlaceHolder:"Filter",moveSelectedLabel:"Move selected",moveAllLabel:"Move all",removeSelectedLabel:"Remove selected",removeAllLabel:"Remove all",moveOnSelect:!0,moveOnDoubleClick:!0,preserveSelectionOnMove:!1,selectedListLabel:!1,nonSelectedListLabel:!1,helperSelectNamePostfix:"_helper",selectorMinimalHeight:100,showFilterInputs:!0,nonSelectedFilter:"",selectedFilter:"",infoText:"Showing all {0}",infoTextFiltered:'<span class="label label-warning">Filtered</span> {0} from {1}',infoTextEmpty:"Empty list",filterOnValues:!1,sortByInputOrder:!1,eventMoveOverride:!1,eventMoveAllOverride:!1,eventRemoveOverride:!1,eventRemoveAllOverride:!1},i=/android/i.test(navigator.userAgent.toLowerCase());function l(e,t){this.element=a(e),this.settings=a.extend({},n,t),this._defaults=n,this._name=s,this.init()}function t(e){e.element.trigger("change")}function o(i){i.element.find("option").each(function(e,t){var n=a(t);void 0===n.data("original-index")&&n.data("original-index",i.elementCount++),void 0===n.data("_selected")&&n.data("_selected",!1)})}function r(i,s,l){i.element.find("option").each(function(e,t){var n=a(t);n.data("original-index")===s&&(n.prop("selected",l),l?(n.attr("data-sortindex",i.sortIndex),i.sortIndex++):n.removeAttr("data-sortindex"))})}function c(e,n){return e.replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[t]?n[t]:e})}function h(e){if(e.settings.infoText){var t=e.elements.select1.find("option").length,n=e.elements.select2.find("option").length,i=e.element.find("option").length-e.selectedElements,s=e.selectedElements,l="";l=0==i?e.settings.infoTextEmpty:c(t===i?e.settings.infoText:e.settings.infoTextFiltered,[t,i]),e.elements.info1.html(l),e.elements.box1.toggleClass("filtered",!(t===i||0==i)),l=0===s?e.settings.infoTextEmpty:c(n===s?e.settings.infoText:e.settings.infoTextFiltered,[n,s]),e.elements.info2.html(l),e.elements.box2.toggleClass("filtered",!(n===s||0===s))}}function m(i){i.selectedElements=0,i.elements.select1.empty(),i.elements.select2.empty(),i.element.find("option").each(function(e,t){var n=a(t);n.prop("selected")?(i.selectedElements++,i.elements.select2.append(n.clone(!0).prop("selected",n.data("_selected")))):i.elements.select1.append(n.clone(!0).prop("selected",n.data("_selected")))}),i.settings.showFilterInputs&&(d(i,1),d(i,2)),h(i)}function d(s,l){if(s.settings.showFilterInputs){v(s,l),s.elements["select"+l].empty().scrollTop(0);var o=new RegExp(a.trim(s.elements["filterInput"+l].val()),"gi"),r=s.element.find("option"),e=s.element;(e=1===l?r.not(":selected"):e.find("option:selected")).each(function(e,t){var n=a(t),i=!0;(t.text.match(o)||s.settings.filterOnValues&&n.attr("value").match(o))&&(i=!1,s.elements["select"+l].append(n.clone(!0).prop("selected",n.data("_selected")))),r.eq(n.data("original-index")).data("filtered"+l,i)}),h(s)}}function v(e,t){var i=e.element.find("option");e.elements["select"+t].find("option").each(function(e,t){var n=a(t);i.eq(n.data("original-index")).data("_selected",n.prop("selected"))})}function f(e){var t=e.children("option");t.sort(function(e,t){var n=parseInt(e.getAttribute("data-sortindex")),i=parseInt(t.getAttribute("data-sortindex"));return i<n?1:n<i?-1:0}),t.detach().appendTo(e)}function u(e,t){e.find("option").sort(function(e,t){return a(e).data("original-index")>a(t).data("original-index")?1:-1}).appendTo(e),m(t)}function p(i){"all"!==i.settings.preserveSelectionOnMove||i.settings.moveOnSelect?"moved"!==i.settings.preserveSelectionOnMove||i.settings.moveOnSelect||v(i,1):(v(i,1),v(i,2)),i.elements.select1.find("option:selected").each(function(e,t){var n=a(t);n.data("filtered1")||r(i,n.data("original-index"),!0)}),m(i),t(i),i.settings.sortByInputOrder?f(i.elements.select2):u(i.elements.select2,i)}function g(i){"all"!==i.settings.preserveSelectionOnMove||i.settings.moveOnSelect?"moved"!==i.settings.preserveSelectionOnMove||i.settings.moveOnSelect||v(i,2):(v(i,1),v(i,2)),i.elements.select2.find("option:selected").each(function(e,t){var n=a(t);n.data("filtered2")||r(i,n.data("original-index"),!1)}),m(i),t(i),u(i.elements.select1,i),i.settings.sortByInputOrder&&f(i.elements.select2)}function b(n){n.elements.form.submit(function(e){n.elements.filterInput1.is(":focus")?(e.preventDefault(),n.elements.filterInput1.focusout()):n.elements.filterInput2.is(":focus")&&(e.preventDefault(),n.elements.filterInput2.focusout())}),n.element.on("bootstrapDualListbox.refresh",function(e,t){n.refresh(t)}),n.elements.filterClear1.on("click",function(){n.setNonSelectedFilter("",!0)}),n.elements.filterClear2.on("click",function(){n.setSelectedFilter("",!0)}),!1===n.settings.eventMoveOverride&&n.elements.moveButton.on("click",function(){p(n)}),!1===n.settings.eventMoveAllOverride&&n.elements.moveAllButton.on("click",function(){var i;"all"!==(i=n).settings.preserveSelectionOnMove||i.settings.moveOnSelect?"moved"!==i.settings.preserveSelectionOnMove||i.settings.moveOnSelect||v(i,1):(v(i,1),v(i,2)),i.element.find("option").each(function(e,t){var n=a(t);n.data("filtered1")||(n.prop("selected",!0),n.attr("data-sortindex",i.sortIndex),i.sortIndex++)}),m(i),t(i)}),!1===n.settings.eventRemoveOverride&&n.elements.removeButton.on("click",function(){g(n)}),!1===n.settings.eventRemoveAllOverride&&n.elements.removeAllButton.on("click",function(){var e;"all"!==(e=n).settings.preserveSelectionOnMove||e.settings.moveOnSelect?"moved"!==e.settings.preserveSelectionOnMove||e.settings.moveOnSelect||v(e,2):(v(e,1),v(e,2)),e.element.find("option").each(function(e,t){var n=a(t);n.data("filtered2")||(n.prop("selected",!1),n.removeAttr("data-sortindex"))}),m(e),t(e)}),n.elements.filterInput1.on("change keyup",function(){d(n,1)}),n.elements.filterInput2.on("change keyup",function(){d(n,2)})}l.prototype={init:function(){this.container=a('<div class="bootstrap-duallistbox-container"> <div class="box1"> <label></label> <span class="info-container"> <span class="info"></span> <button type="button" class="btn clear1 pull-right"></button> </span> <input class="filter" type="text"> <div class="btn-group buttons"> <button type="button" class="btn moveall"> <i></i> <i></i> </button> <button type="button" class="btn move"> <i></i> </button> </div> <select multiple="multiple"></select> </div> <div class="box2"> <label></label> <span class="info-container"> <span class="info"></span> <button type="button" class="btn clear2 pull-right"></button> </span> <input class="filter" type="text"> <div class="btn-group buttons"> <button type="button" class="btn remove"> <i></i> </button> <button type="button" class="btn removeall"> <i></i> <i></i> </button> </div> <select multiple="multiple"></select> </div></div>').insertBefore(this.element),this.elements={originalSelect:this.element,box1:a(".box1",this.container),box2:a(".box2",this.container),filterInput1:a(".box1 .filter",this.container),filterInput2:a(".box2 .filter",this.container),filterClear1:a(".box1 .clear1",this.container),filterClear2:a(".box2 .clear2",this.container),label1:a(".box1 > label",this.container),label2:a(".box2 > label",this.container),info1:a(".box1 .info",this.container),info2:a(".box2 .info",this.container),select1:a(".box1 select",this.container),select2:a(".box2 select",this.container),moveButton:a(".box1 .move",this.container),removeButton:a(".box2 .remove",this.container),moveAllButton:a(".box1 .moveall",this.container),removeAllButton:a(".box2 .removeall",this.container),form:a(a(".box1 .filter",this.container)[0].form)},this.originalSelectName=this.element.attr("name")||"";var e="bootstrap-duallistbox-nonselected-list_"+this.originalSelectName,t="bootstrap-duallistbox-selected-list_"+this.originalSelectName;return this.elements.select1.attr("id",e),this.elements.select2.attr("id",t),this.elements.label1.attr("for",e),this.elements.label2.attr("for",t),this.selectedElements=0,this.sortIndex=0,this.elementCount=0,this.setBootstrap2Compatible(this.settings.bootstrap2Compatible),this.setFilterTextClear(this.settings.filterTextClear),this.setFilterPlaceHolder(this.settings.filterPlaceHolder),this.setMoveSelectedLabel(this.settings.moveSelectedLabel),this.setMoveAllLabel(this.settings.moveAllLabel),this.setRemoveSelectedLabel(this.settings.removeSelectedLabel),this.setRemoveAllLabel(this.settings.removeAllLabel),this.setMoveOnSelect(this.settings.moveOnSelect),this.setMoveOnDoubleClick(this.settings.moveOnDoubleClick),this.setPreserveSelectionOnMove(this.settings.preserveSelectionOnMove),this.setSelectedListLabel(this.settings.selectedListLabel),this.setNonSelectedListLabel(this.settings.nonSelectedListLabel),this.setHelperSelectNamePostfix(this.settings.helperSelectNamePostfix),this.setSelectOrMinimalHeight(this.settings.selectorMinimalHeight),o(this),this.setShowFilterInputs(this.settings.showFilterInputs),this.setNonSelectedFilter(this.settings.nonSelectedFilter),this.setSelectedFilter(this.settings.selectedFilter),this.setInfoText(this.settings.infoText),this.setInfoTextFiltered(this.settings.infoTextFiltered),this.setInfoTextEmpty(this.settings.infoTextEmpty),this.setFilterOnValues(this.settings.filterOnValues),this.setSortByInputOrder(this.settings.sortByInputOrder),this.setEventMoveOverride(this.settings.eventMoveOverride),this.setEventMoveAllOverride(this.settings.eventMoveAllOverride),this.setEventRemoveOverride(this.settings.eventRemoveOverride),this.setEventRemoveAllOverride(this.settings.eventRemoveAllOverride),this.element.hide(),b(this),m(this),this.element},setBootstrap2Compatible:function(e,t){return(this.settings.bootstrap2Compatible=e)?(this.container.removeClass("row").addClass("row-fluid bs2compatible"),this.container.find(".box1, .box2").removeClass("col-md-6").addClass("span6"),this.container.find(".clear1, .clear2").removeClass("btn-default btn-xs").addClass("btn-mini"),this.container.find("input, select").removeClass("form-control"),this.container.find(".btn").removeClass("btn-default"),this.container.find(".moveall > i, .move > i").removeClass("glyphicon glyphicon-arrow-right").addClass("icon-arrow-right"),this.container.find(".removeall > i, .remove > i").removeClass("glyphicon glyphicon-arrow-left").addClass("icon-arrow-left")):(this.container.removeClass("row-fluid bs2compatible").addClass("row"),this.container.find(".box1, .box2").removeClass("span6").addClass("col-md-6"),this.container.find(".clear1, .clear2").removeClass("btn-mini").addClass("btn-default btn-xs"),this.container.find("input, select").addClass("form-control"),this.container.find(".btn").addClass("btn-default"),this.container.find(".moveall > i, .move > i").removeClass("icon-arrow-right").addClass("glyphicon glyphicon-arrow-right"),this.container.find(".removeall > i, .remove > i").removeClass("icon-arrow-left").addClass("glyphicon glyphicon-arrow-left")),t&&m(this),this.element},setFilterTextClear:function(e,t){return this.settings.filterTextClear=e,this.elements.filterClear1.html(e),this.elements.filterClear2.html(e),t&&m(this),this.element},setFilterPlaceHolder:function(e,t){return this.settings.filterPlaceHolder=e,this.elements.filterInput1.attr("placeholder",e),this.elements.filterInput2.attr("placeholder",e),t&&m(this),this.element},setMoveSelectedLabel:function(e,t){return this.settings.moveSelectedLabel=e,this.elements.moveButton.attr("title",e),t&&m(this),this.element},setMoveAllLabel:function(e,t){return this.settings.moveAllLabel=e,this.elements.moveAllButton.attr("title",e),t&&m(this),this.element},setRemoveSelectedLabel:function(e,t){return this.settings.removeSelectedLabel=e,this.elements.removeButton.attr("title",e),t&&m(this),this.element},setRemoveAllLabel:function(e,t){return this.settings.removeAllLabel=e,this.elements.removeAllButton.attr("title",e),t&&m(this),this.element},setMoveOnSelect:function(e,t){if(i&&(e=!0),this.settings.moveOnSelect=e,this.settings.moveOnSelect){this.container.addClass("moveonselect");var n=this;this.elements.select1.on("change",function(){p(n)}),this.elements.select2.on("change",function(){g(n)})}else this.container.removeClass("moveonselect"),this.elements.select1.off("change"),this.elements.select2.off("change");return t&&m(this),this.element},setMoveOnDoubleClick:function(e,t){if(i&&(e=!1),this.settings.moveOnDoubleClick=e,this.settings.moveOnDoubleClick){this.container.addClass("moveondoubleclick");var n=this;this.elements.select1.on("dblclick",function(){p(n)}),this.elements.select2.on("dblclick",function(){g(n)})}else this.container.removeClass("moveondoubleclick"),this.elements.select1.off("dblclick"),this.elements.select2.off("dblclick");return t&&m(this),this.element},setPreserveSelectionOnMove:function(e,t){return i&&(e=!1),this.settings.preserveSelectionOnMove=e,t&&m(this),this.element},setSelectedListLabel:function(e,t){return(this.settings.selectedListLabel=e)?this.elements.label2.show().html(e):this.elements.label2.hide().html(e),t&&m(this),this.element},setNonSelectedListLabel:function(e,t){return(this.settings.nonSelectedListLabel=e)?this.elements.label1.show().html(e):this.elements.label1.hide().html(e),t&&m(this),this.element},setHelperSelectNamePostfix:function(e,t){return(this.settings.helperSelectNamePostfix=e)?(this.elements.select1.attr("name",this.originalSelectName+e+"1"),this.elements.select2.attr("name",this.originalSelectName+e+"2")):(this.elements.select1.removeAttr("name"),this.elements.select2.removeAttr("name")),t&&m(this),this.element},setSelectOrMinimalHeight:function(e,t){this.settings.selectorMinimalHeight=e;var n=this.element.height();return this.element.height()<e&&(n=e),this.elements.select1.height(n),this.elements.select2.height(n),t&&m(this),this.element},setShowFilterInputs:function(e,t){return e?(this.elements.filterInput1.show(),this.elements.filterInput2.show()):(this.setNonSelectedFilter(""),this.setSelectedFilter(""),m(this),this.elements.filterInput1.hide(),this.elements.filterInput2.hide()),this.settings.showFilterInputs=e,t&&m(this),this.element},setNonSelectedFilter:function(e,t){if(this.settings.showFilterInputs)return this.settings.nonSelectedFilter=e,this.elements.filterInput1.val(e),t&&m(this),this.element},setSelectedFilter:function(e,t){if(this.settings.showFilterInputs)return this.settings.selectedFilter=e,this.elements.filterInput2.val(e),t&&m(this),this.element},setInfoText:function(e,t){return(this.settings.infoText=e)?(this.elements.info1.show(),this.elements.info2.show()):(this.elements.info1.hide(),this.elements.info2.hide()),t&&m(this),this.element},setInfoTextFiltered:function(e,t){return this.settings.infoTextFiltered=e,t&&m(this),this.element},setInfoTextEmpty:function(e,t){return this.settings.infoTextEmpty=e,t&&m(this),this.element},setFilterOnValues:function(e,t){return this.settings.filterOnValues=e,t&&m(this),this.element},setSortByInputOrder:function(e,t){return this.settings.sortByInputOrder=e,t&&m(this),this.element},setEventMoveOverride:function(e,t){return this.settings.eventMoveOverride=e,t&&m(this),this.element},setEventMoveAllOverride:function(e,t){return this.settings.eventMoveAllOverride=e,t&&m(this),this.element},setEventRemoveOverride:function(e,t){return this.settings.eventRemoveOverride=e,t&&m(this),this.element},setEventRemoveAllOverride:function(e,t){return this.settings.eventRemoveAllOverride=e,t&&m(this),this.element},getContainer:function(){return this.container},refresh:function(e){var t;o(this),e?(t=this).elements.select1.find("option").each(function(){t.element.find("option").data("_selected",!1)}):(v(this,1),v(this,2)),m(this)},destroy:function(){return this.container.remove(),this.element.show(),a.data(this,"plugin_"+s,null),this.element}},a.fn[s]=function(n){var t,i=arguments;return n===e||"object"==typeof n?this.each(function(){a(this).is("select")?a.data(this,"plugin_"+s)||a.data(this,"plugin_"+s,new l(this,n)):a(this).find("select").each(function(e,t){a(t).bootstrapDualListbox(n)})}):"string"==typeof n&&"_"!==n[0]&&"init"!==n?(this.each(function(){var e=a.data(this,"plugin_"+s);e instanceof l&&"function"==typeof e[n]&&(t=e[n].apply(e,Array.prototype.slice.call(i,1)))}),t!==e?t:this):void 0}}(jQuery,(window,void document));

@@ -0,0 +0,0 @@ module.exports = function (grunt) {

@@ -0,0 +0,0 @@ Bootstrap Dual Listbox

@@ -9,41 +9,16 @@ {

},
"contributors": [
{
"name": "Francesco Pontillo",
"url": "https://github.com/frapontillo"
},
{
"name": "Ninir",
"url": "https://github.com/Ninir"
},
{
"name": "Christophe Coevoet",
"url": "https://github.com/stof"
},
{
"name": "Ed Ng",
"url": "https://github.com/gnedster"
},
{
"name": "ssafejava",
"url": "https://github.com/ssafejava"
},
{
"name": "justthefish",
"url": "https://github.com/justthefish"
}
],
"contributors": [],
"repository": {
"type": "git",
"url": "http://github.com/istvan-ujjmeszaros/bootstrap-duallistbox.git"
"url": "https://github.com/istvan-ujjmeszaros/bootstrap-duallistbox.git"
},
"homepage": "http://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"version": "3.0.6",
"homepage": "https://www.virtuosoft.eu/code/bootstrap-duallistbox/",
"version": "3.0.9",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-cli": "~0.1.13",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.3.2",
"grunt-contrib-cssmin": "~0.9.0"
"grunt": "^1.1.0",
"grunt-cli": "^1.3.2",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-cssmin": "^3.0.0"
},

@@ -50,0 +25,0 @@ "scripts": {

@@ -1,2 +0,2 @@

# Bootstrap Dual Listbox [![Build Status](https://secure.travis-ci.org/istvan-ujjmeszaros/bootstrap-duallistbox.png?branch=master)](https://travis-ci.org/istvan-ujjmeszaros/bootstrap-duallistbox)
# Bootstrap Dual Listbox [![Build Status](https://travis-ci.org/istvan-ujjmeszaros/bootstrap-duallistbox.svg?branch=master)](https://travis-ci.org/istvan-ujjmeszaros/bootstrap-duallistbox)
Bootstrap Dual Listbox is a responsive dual listbox widget optimized for Twitter Bootstrap. Works on all modern browsers and on touch devices.

@@ -51,2 +51,3 @@

- `moveOnSelect`, defaults to `true`, determines whether to move `option`s upon selection. This option is forced to `true` on the Android browser.
- `moveOnDoubleClick`, defaults to `true`, determines whether to move `option`s upon double click. This option is not used on the Android browser.
- `preserveSelectionOnMove`, can be`'all'` (for selecting both moved elements and the already selected ones in the target list) or `'moved'` (for selecting moved elements only); defaults to `false`.

@@ -87,2 +88,3 @@ - `selectedListLabel`, defaults to `false`, can be a `string` specifying the name of the selected list.

- `setMoveOnSelect(value, refresh)` to change the `moveOnSelect` parameter.
- `setMoveOnDoubleClick(value, refresh)` to change the `moveOnDoubleClick` parameter.
- `setPreserveSelectionOnMove(value, refresh)` to change the `preserveSelectionOnMove` parameter.

@@ -239,2 +241,2 @@ - `setSelectedListLabel(value, refresh)` to change the `selectedListLabel` parameter.

limitations under the License.
```
```

@@ -13,2 +13,3 @@ ;(function ($, window, document, undefined) {

moveOnSelect: true, // true/false (forced true on androids, see the comment later)
moveOnDoubleClick: true, // true/false (forced false on androids, cause moveOnSelect is forced to true)
preserveSelectionOnMove: false, // 'all' / 'moved' / false

@@ -201,6 +202,9 @@ selectedListLabel: false, // 'string', false

function sortOptions(select) {
function sortOptions(select, dualListbox) {
select.find('option').sort(function(a, b) {
return ($(a).data('original-index') > $(b).data('original-index')) ? 1 : -1;
}).appendTo(select);
// workaround for chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1072475
refreshSelects(dualListbox);
}

@@ -234,3 +238,3 @@

} else {
sortOptions(dualListbox.elements.select2);
sortOptions(dualListbox.elements.select2, dualListbox);
}

@@ -256,3 +260,3 @@ }

triggerChangeEvent(dualListbox);
sortOptions(dualListbox.elements.select1);
sortOptions(dualListbox.elements.select1, dualListbox);
if(dualListbox.settings.sortByInputOrder){

@@ -447,2 +451,3 @@ sortOptionsByInputOrder(dualListbox.elements.select2);

this.setMoveOnSelect(this.settings.moveOnSelect);
this.setMoveOnDoubleClick(this.settings.moveOnDoubleClick);
this.setPreserveSelectionOnMove(this.settings.preserveSelectionOnMove);

@@ -575,2 +580,26 @@ this.setSelectedListLabel(this.settings.selectedListLabel);

},
setMoveOnDoubleClick: function(value, refresh) {
if (isBuggyAndroid) {
value = false;
}
this.settings.moveOnDoubleClick = value;
if (this.settings.moveOnDoubleClick) {
this.container.addClass('moveondoubleclick');
var self = this;
this.elements.select1.on('dblclick', function() {
move(self);
});
this.elements.select2.on('dblclick', function() {
remove(self);
});
} else {
this.container.removeClass('moveondoubleclick');
this.elements.select1.off('dblclick');
this.elements.select2.off('dblclick');
}
if (refresh) {
refreshSelects(this);
}
return this.element;
},
setPreserveSelectionOnMove: function(value, refresh) {

@@ -677,2 +706,9 @@ // We are forcing to move on select and disabling preserveSelectionOnMove on Android

this.settings.infoText = value;
if (value) {
this.elements.info1.show();
this.elements.info2.show();
} else {
this.elements.info1.hide();
this.elements.info2.hide();
}
if (refresh) {

@@ -679,0 +715,0 @@ refreshSelects(this);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc