1 line
1.1 KiB
JavaScript
1 line
1.1 KiB
JavaScript
|
jQuery(document).ready(function(a){a(".language-phrase-search").each(function(){var b=a(this);b.autocomplete({source:function(j,h){var k=[];var e=0;var i=0;do{i=phraseIndex.toLowerCase().indexOf(j.term.toLowerCase(),i);if(i<0){break}var l=phraseIndex.lastIndexOf("|",i);var o=phraseIndex.indexOf("|",i);var g=phraseIndex.substring(l+1,o);l=phraseIndex.indexOf("^",i);o=phraseIndex.indexOf("|",l+1);var d=phraseIndex.indexOf(":",l);var c=phraseIndex.substring(l+1,d);var f=phraseIndex.substring(d+1,o-1);var m=f.substring(f.lastIndexOf("/")+1);if(g.length>100){g=g.substring(0,100)+"…"}i=l;if(g.indexOf("^")>-1){continue}g=m+": "+g;k[e++]={label:g,value:c+":"+f};if(e>50){break}}while(1);if(e>50){e="50+"}b.next(".language-phrase-search-cnt").text(e);h(k)},minLength:3,select:function(f,g){if(g.item){var c=g.item.value.split(":");var h=c[0];var e=c[1];var d="../../language-translator/edit/?language_id="+phraseLanguageID+"&textdomain="+h+"&filename="+e;window.location.href=d}}}).blur(function(){b.next(".language-phrase-search-cnt").text("")}).keydown(function(c){if(c.keyCode==13){return false}})})});
|