18
jquery.selectlist-0.4.2/scripts/jquery.min.js
vendored
Executable file
18
jquery.selectlist-0.4.2/scripts/jquery.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
301
jquery.selectlist-0.4.2/scripts/jquery.selectlist.js
Normal file
301
jquery.selectlist-0.4.2/scripts/jquery.selectlist.js
Normal file
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
* selectList jQuery plugin
|
||||
* version 0.4.2
|
||||
*
|
||||
* Copyright (c) 2009-2011 Michal Wojciechowski (odyniec.net)
|
||||
*
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
* http://odyniec.net/projects/selectlist/
|
||||
*
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
$.selectList = function (select, options) {
|
||||
var
|
||||
|
||||
$selectSingle,
|
||||
|
||||
$list,
|
||||
|
||||
$item, $newItem,
|
||||
|
||||
$option,
|
||||
|
||||
keyEvent,
|
||||
|
||||
ready,
|
||||
|
||||
first = 0,
|
||||
|
||||
change, click, keypress, enter;
|
||||
|
||||
function show($item, callback) {
|
||||
if (options.addAnimate && ready)
|
||||
if (typeof options.addAnimate == 'function')
|
||||
options.addAnimate($item.hide()[0], callback);
|
||||
else
|
||||
$item.hide().fadeIn(300, callback);
|
||||
else {
|
||||
$item.show();
|
||||
if (callback)
|
||||
callback.call($item[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function hide($item, callback) {
|
||||
if (options.removeAnimate && ready)
|
||||
if (typeof options.removeAnimate == 'function')
|
||||
options.removeAnimate($item[0], callback);
|
||||
else
|
||||
$item.fadeOut(300, callback);
|
||||
else {
|
||||
$item.hide();
|
||||
if (callback)
|
||||
callback.call($item[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function cmp(item1, item2) {
|
||||
return typeof options.sort == 'function' ?
|
||||
options.sort(item1, item2)
|
||||
: ($(item1).data('text') > $(item2).data('text'))
|
||||
== (options.sort != 'desc');
|
||||
}
|
||||
|
||||
function add(value, text, callHandler) {
|
||||
if ($(value).is('option')) {
|
||||
$option = $(value);
|
||||
|
||||
if ($option[0].index < first)
|
||||
return;
|
||||
|
||||
value = $option.val();
|
||||
text = $option.text();
|
||||
}
|
||||
else {
|
||||
$option = $selectSingle.find("option[value=\"" +
|
||||
|
||||
value.replace("'", "\\\"") + "\"]");
|
||||
|
||||
if ($option.length)
|
||||
$option = $option.filter(function () {
|
||||
return !text || $(this).text() == text;
|
||||
})
|
||||
.add($option).eq(0);
|
||||
else
|
||||
$option = null;
|
||||
}
|
||||
|
||||
if (text === undefined)
|
||||
text = $option ? $option.text() : value;
|
||||
|
||||
if ($option && !options.duplicates)
|
||||
$option.attr('disabled', 'disabled')
|
||||
.data('disabled', 1);
|
||||
|
||||
$newItem = $(options.template.replace(/%text%/g,
|
||||
$('<b/>').text(text).html()).replace(/%value%/g, value)).hide();
|
||||
|
||||
$newItem.data('value', value).data('text', text).data('option', $option)
|
||||
.addClass(options.classPrefix + '-item');
|
||||
|
||||
$newItem.click(function () {
|
||||
if (options.clickRemove)
|
||||
remove($(this));
|
||||
});
|
||||
|
||||
if (first && !keypress)
|
||||
$selectSingle[0].selectedIndex = 0;
|
||||
|
||||
var callback = function () {
|
||||
if (callHandler !== false)
|
||||
options.onAdd(select, value, text);
|
||||
|
||||
};
|
||||
|
||||
if (options.sort && ($item = $list.children().eq(0)).length) {
|
||||
while ($item.length && cmp($newItem[0], $item[0]))
|
||||
$item = $item.next();
|
||||
|
||||
show($item.length ? $newItem.insertBefore($item)
|
||||
: $newItem.appendTo($list), callback);
|
||||
}
|
||||
else
|
||||
show($newItem.appendTo($list), callback);
|
||||
|
||||
$(select).empty();
|
||||
|
||||
$list.children().each(function () {
|
||||
$(select).append($("<option/>").attr({ value: $(this).data('value'),
|
||||
selected: "selected" }));
|
||||
});
|
||||
|
||||
checkValidation();
|
||||
}
|
||||
|
||||
function remove($item, callHandler) {
|
||||
hide($item, function () {
|
||||
var value = $(this).data('value'),
|
||||
text = $(this).data('text');
|
||||
|
||||
if ($(this).data('option'))
|
||||
$(this).data('option').removeAttr('disabled')
|
||||
.removeData('disabled');
|
||||
|
||||
$(this).remove();
|
||||
|
||||
$(select).find("option[value=\"" + value + "\"]").remove();
|
||||
|
||||
checkValidation();
|
||||
|
||||
if (callHandler !== false)
|
||||
options.onRemove(select, value, text);
|
||||
});
|
||||
}
|
||||
|
||||
function checkValidation() {
|
||||
if (select.form && typeof ($(select.form).validate) == "function" &&
|
||||
$(select).add($selectSingle).hasClass($(select.form)
|
||||
.validate().settings.errorClass))
|
||||
$(select.form).validate().element(select);
|
||||
}
|
||||
|
||||
this.val = function () {
|
||||
return $(select).val();
|
||||
};
|
||||
|
||||
this.add = function (value, text) {
|
||||
add(value, text);
|
||||
};
|
||||
|
||||
this.remove = function (value) {
|
||||
$list.children().each(function () {
|
||||
if ($(this).data('value') == value || typeof value == 'undefined')
|
||||
remove($(this));
|
||||
});
|
||||
};
|
||||
|
||||
this.setOptions = function (newOptions) {
|
||||
var sort = newOptions.sort && newOptions.sort != options.sort;
|
||||
|
||||
options = $.extend(options, newOptions);
|
||||
|
||||
if (sort) {
|
||||
var items = [];
|
||||
$list.children().each(function () {
|
||||
items[items.length] = $(this).data('value')
|
||||
items[items.length] = $(this).data('text');
|
||||
});
|
||||
$list.empty();
|
||||
for (var i = 0; i < items.length; i += 2)
|
||||
add(items[i], items[i+1], false);
|
||||
}
|
||||
};
|
||||
|
||||
this.setOptions(options = $.extend({
|
||||
addAnimate: true,
|
||||
classPrefix: 'selectlist',
|
||||
clickRemove: true,
|
||||
removeAnimate: true,
|
||||
template: '<li>%text%</li>',
|
||||
onAdd: function () {},
|
||||
onRemove: function () {}
|
||||
}, options));
|
||||
|
||||
$selectSingle = $(select).clone();
|
||||
$selectSingle.removeAttr('id').removeAttr('name')
|
||||
.addClass(options.classPrefix + '-select').insertAfter($(select));
|
||||
$(select).empty().hide();
|
||||
|
||||
($list = $(options.list || $("<ul/>").insertAfter($selectSingle)))
|
||||
.addClass(options.classPrefix + '-list');
|
||||
|
||||
$selectSingle.find(':selected').each(function () {
|
||||
add($(this), null, false);
|
||||
});
|
||||
|
||||
$selectSingle.removeAttr('multiple');
|
||||
$selectSingle.get(0).removeAttribute('size');
|
||||
|
||||
if ($selectSingle.attr("title")) {
|
||||
$selectSingle.prepend($("<option/>")
|
||||
.text($selectSingle.attr("title")));
|
||||
first = 1;
|
||||
$selectSingle[0].selectedIndex = 0;
|
||||
}
|
||||
|
||||
keyEvent = $.browser.msie || $.browser.safari ? 'keydown' : 'keypress';
|
||||
|
||||
$selectSingle.bind(keyEvent, function (event) {
|
||||
keypress = true;
|
||||
|
||||
if ((event.keyCode || event.which) == 13) {
|
||||
enter = true;
|
||||
$selectSingle.change();
|
||||
keypress = true;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.change(function() {
|
||||
if (!keypress && !click) return;
|
||||
change = true;
|
||||
$option = $selectSingle.find("option:selected");
|
||||
if (!$option.data("disabled") && (!keypress || enter))
|
||||
add($option);
|
||||
|
||||
if (keypress)
|
||||
keypress = change = click = false;
|
||||
|
||||
enter = false;
|
||||
})
|
||||
.mousedown(function () {
|
||||
click = true;
|
||||
});
|
||||
|
||||
$selectSingle.find('option').click(function (event) {
|
||||
if ($.browser.mozilla && event.pageX >= $selectSingle.offset().left &&
|
||||
event.pageX <= $selectSingle.offset().left +
|
||||
|
||||
$selectSingle.outerWidth() &&
|
||||
event.pageY >= $selectSingle.offset().top &&
|
||||
event.pageY <= $selectSingle.offset().top +
|
||||
|
||||
$selectSingle.outerHeight())
|
||||
return false;
|
||||
|
||||
click = true;
|
||||
|
||||
if (!($(this).attr('disabled') || $(this).data('disabled') || keypress
|
||||
|| change))
|
||||
|
||||
add($(this));
|
||||
|
||||
if (!keypress)
|
||||
change = click = false;
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
ready = true;
|
||||
};
|
||||
|
||||
$.fn.selectList = function (options) {
|
||||
options = options || {};
|
||||
|
||||
this.filter('select').each(function () {
|
||||
if ($(this).data('selectList'))
|
||||
$(this).data('selectList').setOptions(options);
|
||||
else
|
||||
$(this).data('selectList', new $.selectList(this, options));
|
||||
});
|
||||
|
||||
if (options.instance)
|
||||
return this.filter('select').data('selectList');
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
1
jquery.selectlist-0.4.2/scripts/jquery.selectlist.min.js
vendored
Normal file
1
jquery.selectlist-0.4.2/scripts/jquery.selectlist.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3($){$.u=3(a,6){z 7,l,t,s,9,12,L,P=0,B,y,h,N;3 1e(J,K){4(6.T&&L){4(G 6.T=="3"){6.T(J.F()[0],K)}p{J.F().2u(1M,K)}}p{J.2t();4(K){K.1L(J[0])}}};3 1G(H,I){4(6.S&&L){4(G 6.S=="3"){6.S(H[0],I)}p{H.2s(1M,I)}}p{H.F();4(I){I.1L(H[0])}}};3 1I(1h,1g){d G 6.w=="3"?6.w(1h,1g):($(1h).8("c")>$(1g).8("c"))==(6.w!="2r")};3 k(o,n,1K){4($(o).2q("j")){9=$(o);4(9[0].2p<P){d}o=9.19();n=9.c()}p{9=7.E("j[m=\\""+o.1f("\'","\\\\\\"")+"\\"]");4(9.v){9=9.Y(3(){d!n||$(5).c()==n}).k(9).1J(0)}p{9=1q}}4(n===1A){n=9?9.c():o}4(9&&!6.2o){9.C("q","q").8("q",1)}s=$(6.1w.1f(/%c%/g,$("<b/>").c(n).2n()).1f(/%m%/g,o)).F();s.8("m",o).8("c",n).8("j",9).14(6.R+"-2m");s.1m(3(){4(6.1x){16($(5))}});4(P&&!h){7[0].1o=0}z 1d=3(){4(1K!==f){6.1u(a,o,n)}};4(6.w&&(t=l.U().1J(0)).v){2l(t.v&&1I(s[0],t[0])){t=t.2k()}1e(t.v?s.2j(t):s.1H(l),1d)}p{1e(s.1H(l),1d)}$(a).15();l.U().A(3(){$(a).2i($("<j/>").C({m:$(5).8("m"),O:"O"}))});1b()};3 16(1F,1E){1G(1F,3(){z 1c=$(5).8("m"),1D=$(5).8("c");4($(5).8("j")){$(5).8("j").Q("q").2h("q")}$(5).18();$(a).E("j[m=\\""+1c+"\\"]").18();1b();4(1E!==f){6.1t(a,1c,1D)}})};3 1b(){4(a.W&&G($(a.W).1a)=="3"&&$(a).k(7).2g($(a.W).1a().2f.2e)){$(a.W).1a().2d(a)}};5.19=3(){d $(a).19()};5.k=3(1C,1B){k(1C,1B)};5.18=3(17){l.U().A(3(){4($(5).8("m")==17||G 17=="1A"){16($(5))}})};5.Z=3(V){z 1z=V.w&&V.w!=6.w;6=$.1y(6,V);4(1z){z r=[];l.U().A(3(){r[r.v]=$(5).8("m");r[r.v]=$(5).8("c")});l.15();2c(z i=0;i<r.v;i+=2){k(r[i],r[i+1],f)}}};5.Z(6=$.1y({T:e,R:"2b",1x:e,S:e,1w:"<1v>%c%</1v>",1u:3(){},1t:3(){}},6));7=$(a).2a();7.Q("29").Q("28").14(6.R+"-X").1s($(a));$(a).15().F();(l=$(6.1r||$("<27/>").1s(7))).14(6.R+"-1r");7.E(":O").A(3(){k($(5),1q,f)});7.Q("26");7.25(0).24("23");4(7.C("1p")){7.22($("<j/>").c(7.C("1p")));P=1;7[0].1o=0}12=$.10.21||$.10.20?"1Z":"1Y";7.1X(12,3(11){h=e;4((11.1W||11.1V)==13){N=e;7.1n();h=e;d f}}).1n(3(){4(!h&&!y){d}B=e;9=7.E("j:O");4(!9.8("q")&&(!h||N)){k(9)}4(h){h=B=y=f}N=f}).1U(3(){y=e});7.E("j").1m(3(D){4($.10.1T&&D.1l>=7.M().1k&&D.1l<=7.M().1k+7.1S()&&D.1j>=7.M().1i&&D.1j<=7.M().1i+7.1R()){d f}y=e;4(!($(5).C("q")||$(5).8("q")||h||B)){k($(5))}4(!h){B=y=f}d f});L=e};$.1Q.u=3(x){x=x||{};5.Y("X").A(3(){4($(5).8("u")){$(5).8("u").Z(x)}p{$(5).8("u",1P $.u(5,x))}});4(x.1O){d 5.Y("X").8("u")}d 5}})(1N);',62,155,'|||function|if|this|_2|_3|data|_7|_1||text|return|true|false||_d||option|add|_4|value|_18|_17|else|disabled|_26|_6|_5|selectList|length|sort|_29|_c|var|each|_b|attr|_28|find|hide|typeof|_13|_14|_10|_11|_9|offset|_e|selected|_a|removeAttr|classPrefix|removeAnimate|addAnimate|children|_24|form|select|filter|setOptions|browser|_27|_8||addClass|empty|_1c|_23|remove|val|validate|_1b|_1f|_1a|_f|replace|_16|_15|top|pageY|left|pageX|click|change|selectedIndex|title|null|list|insertAfter|onRemove|onAdd|li|template|clickRemove|extend|_25|undefined|_22|_21|_20|_1e|_1d|_12|appendTo|cmp|eq|_19|call|300|jQuery|instance|new|fn|outerHeight|outerWidth|mozilla|mousedown|which|keyCode|bind|keypress|keydown|safari|msie|prepend|size|removeAttribute|get|multiple|ul|name|id|clone|selectlist|for|element|errorClass|settings|hasClass|removeData|append|insertBefore|next|while|item|html|duplicates|index|is|desc|fadeOut|show|fadeIn'.split('|')))
|
||||
Reference in New Issue
Block a user