* @param zTreeId the ztree id used to get the ztree object
* @param searchField selector of your input for fuzzy search
* @param isHighLight whether highlight the match words, default true
* @param isExpand whether to expand the node, default false
* @returns
*/
functionfuzzySearch(l,h,e,f){functionm(b,c,k){c||(c="");k=b.getNodesByFilter(function(a){a&&a.oldname&&0<a.oldname.length&&(a[d]=a.oldname);b.updateNode(a);if(0==c.length)returnb.showNode(a),b.expandNode(a,f),!0;if(a[d]&&-1!=a[d].toLowerCase().indexOf(c.toLowerCase())){if(e){varp=c.replace(n,function(a){return"\\"+a});a.oldname=a[d];a[d]=a.oldname.replace(newRegExp(p,"gi"),function(a){return'\x3cspan style\x3d"color: whitesmoke;background-color: darkred;"\x3e'+a+"\x3c/span\x3e"});b.updateNode(a)}b.showNode(a);return!0}b.hideNode(a);return!1});q(k,c)}functionq(b,d){if(b&&0<b.length)if(0<d.length)$.each(b,function(a,b){vard=b.getPath();if(d&&0<d.length)for(vare=0;e<d.length-1;e++)c.showNode(d[e]),c.expandNode(d[e],!0)});else{vare=c.getNodesByParam("level","0");$.each(e,function(a,b){c.expandNode(b,!0)})}}functionr(b){g&&clearTimeout(g);g=setTimeout(function(){m(c,b);$(h).focus()},500)}varc=$.fn.zTree.getZTreeObj(l);c||alter("fail to get ztree object");vard=c.setting.data.key.name;e=!1===e?!1:!0;f=f?!0:!1;c.setting.view.nameIsHTML=e;varn=RegExp("[\\[\\]\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]","gi");$(h).bind("input propertychange",function(){varb=$(this).val();r(b)});varg=null};