harry's js fix
This commit is contained in:
parent
e67ca84282
commit
67bd68d492
|
@ -4,33 +4,45 @@
|
||||||
|
|
||||||
//extended jquery to search fast.
|
//extended jquery to search fast.
|
||||||
$.extend($.expr[':'], {
|
$.extend($.expr[':'], {
|
||||||
'containsi': function (elem, i, match, array) {
|
'containsi': function (elem, i, match, array) {
|
||||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var interval,sval;
|
var interval,sval;
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$("#user_filter").keyup(function(e){
|
$("#user_filter").keyup(function(e){
|
||||||
if((e.which>96 && e.which<123) || (e.which>64 && e.which<92) || (e.which == 32) || (e.which == 8)){
|
if((e.which>96 && e.which<123) || (e.which>64 && e.which<92) || (e.which == 32) || (e.which == 8)){
|
||||||
sval = $(this).val();
|
sval = $(this).val();
|
||||||
$(".checkbox").popover("hide");
|
$(".checkbox").popover("hide");
|
||||||
$("div.checkblock").hide();
|
$("div.checkblock").hide();
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
interval = setInterval(waitForSearch,1000);
|
interval = setInterval(waitForSearch,1000);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
var waitForSearch = function(){
|
var waitForSearch = function(){
|
||||||
if(sval){
|
if(sval){
|
||||||
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length
|
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
|
||||||
if(totalfoundbyname!=0){
|
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
|
||||||
$("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show();
|
if ((re1.test(sval) && (re2.test(sval)))){
|
||||||
}else if(totalfoundbyname==0){
|
|
||||||
$("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show();
|
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:contains("+sval+")").length
|
||||||
}
|
if(totalfoundbyname!=0){
|
||||||
}else{
|
$("div#users_checkbox_ary label.member-name:contains("+sval+")").parent().parent().show();
|
||||||
$(".checkbox").popover('hide');
|
}else if(totalfoundbyname==0){
|
||||||
$("div.checkblock").show();
|
$("div#users_checkbox_ary div.for_unit:contains("+sval+")").parent().show();
|
||||||
}
|
}
|
||||||
clearInterval(interval);
|
}else{
|
||||||
|
var totalfoundbyname = $("div#users_checkbox_ary label.member-name:containsi("+sval+")").length
|
||||||
|
if(totalfoundbyname!=0){
|
||||||
|
$("div#users_checkbox_ary label.member-name:containsi("+sval+")").parent().parent().show();
|
||||||
|
}else if(totalfoundbyname==0){
|
||||||
|
$("div#users_checkbox_ary div.for_unit:containsi("+sval+")").parent().show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$(".checkbox").popover('hide');
|
||||||
|
$("div.checkblock").show();
|
||||||
|
}
|
||||||
|
clearInterval(interval);
|
||||||
}
|
}
|
Loading…
Reference in New Issue