Index: trunk/extensions/MobileFrontend/javascripts/opensearch.min.js |
— | — | @@ -1 +1 @@ |
2 | | -MobileFrontend.opensearch=(function(){var l="/api.php",c=-1,f=500,g=5,h=document.getElementById("results"),p=document.getElementById("search"),k=document.getElementById("searchbox"),m=MobileFrontend.utils;if(scriptPath){l=scriptPath+l}function b(){var q=document.getElementById("results");q.style.display="none"}function e(r){var q;if(!r){r=window.event}if(r.target){q=r.target}else{if(r.srcElement){q=r.srcElement}}if(q.nodeType===3){q=q.parentNode}r.cancelBubble=true;r.stopPropagation();if(!(q.className==="suggestion-result"||q.className==="search-result-item"||q.className==="suggestions-result"||q.className==="sq-val-update")){b()}}window.onload=function(){m(p).bind("keyup",function(){clearTimeout(c);var q=this.value;if(q.length<1){h.innerHTML=""}else{c=setTimeout(function(){o(q)},f)}})};function o(q){q=encodeURIComponent(q);url=l+"?action=opensearch&limit="+g+"&namespace=0&format=xml&search="+q;m.ajax({url:url,success:function(r){j(i(r))}})}function i(u){var v=[],r,s,t,q=u.getElementsByTagName("Item");for(r=0;r<q.length;r++){s=q[r];t={label:s.getElementsByTagName("Text")[0].textContent,value:s.getElementsByTagName("Url")[0].textContent};v.push(t)}return v}function d(r){var q=document.getElementById("search");if(q){q.value=r+" ";q.focus();o(q.value)}}function j(B){var t=document.getElementById("results"),w,u,s,A,q,y,z,r=document.getElementById("sq"),v=document.getElementById("header");t.style.display="block";var x=r.offsetParent.offsetTop+r.offsetHeight+r.offsetTop-1+v.offsetTop;t.style.top=x+"px";if(!B||B.length<1){t.innerHTML='<div class="suggestions-results"><div class="suggestions-result">No results</div></div>'}else{if(t.firstChild){t.removeChild(t.firstChild)}w=document.createElement("div");w.className="suggestions-results";t.appendChild(w);s=function(){var C=this.parentNode.getAttribute("title");d(C)};for(u=0;u<B.length;u++){A=B[u];q=document.createElement("div");y=document.createElement("a");q.setAttribute("title",A.label);q.className="suggestions-result";z=document.createTextNode("+");y.appendChild(z);y.className="sq-val-update";m(y).bind("click",s);q.appendChild(y);y=document.createElement("a");y.setAttribute("href",A.value.replace(/^(?:\/\/|[^\/]+)*\//,"/"));y.className="search-result-item";z=document.createTextNode(A.label);y.appendChild(z);q.appendChild(y);w.appendChild(q)}}}function a(){var v=document.getElementById("clearsearch"),r=document.getElementById("search"),q=document.getElementById("results");function t(){if(v){if(r.value.length>0){v.style.display="block"}else{v.style.display="none";if(q){q.style.display="none"}}}}function s(w){r.value="";v.style.display="none";if(q){q.style.display="none"}if(w){w.preventDefault()}}function u(){r.select()}m(v).bind("mousedown",s);m(r).bind("keyup",t);m(r).bind("click",u)}function n(){var q=document.getElementById("results");q.onmousedown=e;document.body.onmousedown=e;document.body.ontouchstart=e;q.ontouchstart=e}n();a();return{init:n,initClearSearch:a,writeResults:j,createObjectArray:i}}()); |
\ No newline at end of file |
| 2 | +MobileFrontend.opensearch=(function(){var l="/api.php",c=-1,f=500,g=5,h=document.getElementById("results"),p=document.getElementById("search"),k=document.getElementById("searchbox"),m=MobileFrontend.utils;l=MobileFrontend.setting("scriptPath")+l;function b(){var q=document.getElementById("results");q.style.display="none"}function e(r){var q;if(!r){r=window.event}if(r.target){q=r.target}else{if(r.srcElement){q=r.srcElement}}if(q.nodeType===3){q=q.parentNode}r.cancelBubble=true;r.stopPropagation();if(!(q.className==="suggestion-result"||q.className==="search-result-item"||q.className==="suggestions-result"||q.className==="sq-val-update")){b()}}window.onload=function(){m(p).bind("keyup",function(){clearTimeout(c);var q=this.value;if(q.length<1){h.innerHTML=""}else{c=setTimeout(function(){o(q)},f)}})};function o(q){q=encodeURIComponent(q);url=l+"?action=opensearch&limit="+g+"&namespace=0&format=xml&search="+q;m.ajax({url:url,success:function(r){j(i(r))}})}function i(u){var v=[],r,s,t,q=u.getElementsByTagName("Item");for(r=0;r<q.length;r++){s=q[r];t={label:s.getElementsByTagName("Text")[0].textContent,value:s.getElementsByTagName("Url")[0].textContent};v.push(t)}return v}function d(r){var q=document.getElementById("search");if(q){q.value=r+" ";q.focus();o(q.value)}}function j(B){var t=document.getElementById("results"),w,u,s,A,q,y,z,r=document.getElementById("sq"),v=document.getElementById("header");t.style.display="block";var x=r.offsetParent.offsetTop+r.offsetHeight+r.offsetTop-1+v.offsetTop;t.style.top=x+"px";if(!B||B.length<1){t.innerHTML='<div class="suggestions-results"><div class="suggestions-result">No results</div></div>'}else{if(t.firstChild){t.removeChild(t.firstChild)}w=document.createElement("div");w.className="suggestions-results";t.appendChild(w);s=function(){var C=this.parentNode.getAttribute("title");d(C)};for(u=0;u<B.length;u++){A=B[u];q=document.createElement("div");y=document.createElement("a");q.setAttribute("title",A.label);q.className="suggestions-result";z=document.createTextNode("+");y.appendChild(z);y.className="sq-val-update";m(y).bind("click",s);q.appendChild(y);y=document.createElement("a");y.setAttribute("href",A.value.replace(/^(?:\/\/|[^\/]+)*\//,"/"));y.className="search-result-item";z=document.createTextNode(A.label);y.appendChild(z);q.appendChild(y);w.appendChild(q)}}}function a(){var v=document.getElementById("clearsearch"),r=document.getElementById("search"),q=document.getElementById("results");function t(){if(v){if(r.value.length>0){v.style.display="block"}else{v.style.display="none";if(q){q.style.display="none"}}}}function s(w){r.value="";v.style.display="none";if(q){q.style.display="none"}if(w){w.preventDefault()}}function u(){r.select()}m(v).bind("mousedown",s);m(r).bind("keyup",t);m(r).bind("click",u)}function n(){var q=document.getElementById("results");q.onmousedown=e;document.body.onmousedown=e;document.body.ontouchstart=e;q.ontouchstart=e}n();a();return{init:n,initClearSearch:a,writeResults:j,createObjectArray:i}}()); |
\ No newline at end of file |