Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/references.min.js |
— | — | @@ -1 +1 @@ |
2 | | -if(typeof jQuery!=="undefined"){MobileFrontend.references=(function(d){var b,f,a={};f=window.location.hash.substr(1).match(/refspeed:([0-9]*)/);a.animationSpeed=f?parseInt(f[1],10):500;f=window.location.hash.substr(1).match(/refanimation:([a-z]*)/);a.animation=f?f[1]:null;function c(){var g={};d("ol.references li").each(function(h,j){g[d(j).attr("id")]={html:d(j).html(),label:h+1}});return g}b=function(){var g=d("#mf-references").outerHeight();d("#mf-references").css({top:(window.innerHeight+window.pageYOffset)-g,bottom:"auto",position:"absolute"})};d(document).scroll(b);function e(){d('<div id="mf-references"><div></div></div>').hide().appendTo(document.body);var l=function(){var m;j=null;if(a.animation==="none"){d("#mf-references").hide()}else{if(a.animation==="slide"){m=window.innerHeight+window.pageYOffset;d("#mf-references").show().animate({top:m},a.animationSpeed)}else{d("#mf-references").fadeOut(a.animationSpeed)}}},j;d("<button>close</button>").click(l).appendTo("#mf-references");d(".mw-cite-backlink a").click(l);var k,i,g,h=c();d("sup a").unbind("click").click(function(m){var o,n;g=d(this).attr("href");k=g&&g.charAt(0)==="#"?h[g.substr(1,g.length)]:null;if(!d("#mf-references").is(":visible")||j!==g){j=g;if(k){i="<h3>["+k.label+"]</h3>"+k.html}else{i=d("<a />").text(d(this).text()).attr("href",g).appendTo("<div />").parent().html()}d("#mf-references div").html(i);b();if(a.animation==="none"){d("#mf-references").show()}else{if(a.animation==="slide"){o=window.innerHeight+window.pageYOffset;n=d("#mf-references").outerHeight();d("#mf-references").show().css({top:o}).animate({top:o-n},a.animationSpeed)}else{d("#mf-references").fadeIn(a.animationSpeed)}}}else{l()}m.preventDefault()})}e()})(jQuery)}; |
\ No newline at end of file |
| 2 | +if(typeof jQuery!=="undefined"){MobileFrontend.references=(function(f){var d=function(){},h,b={},c;h=window.location.hash.substr(1).match(/refspeed:([0-9]*)/);b.animationSpeed=h?parseInt(h[1],10):500;h=window.location.hash.substr(1).match(/refanimation:([a-z]*)/);b.animation=h?h[1]:null;function e(){var i={};f("ol.references li").each(function(j,k){i[f(k).attr("id")]={html:f(k).html()}});return i}function a(){var i=navigator.userAgent;return i.match(/AppleWebKit\/(53[4-9]|5[4-9]\d?|[6-9])\d?\d?/)?true:false}if(!a()){d=function(){var i=f("#mf-references").outerHeight();f("#mf-references").css({top:(window.innerHeight+window.pageYOffset)-i,bottom:"auto",position:"absolute"})};f(document).scroll(d);document.body.ontouchstart=function(){c=f("#mf-references").is(":visible");f("#mf-references").hide()};document.body.ontouchend=function(){if(c){f("#mf-references").show()}}}function g(){var j=f('<div id="mf-references"><div></div></div>').hide().appendTo(document.body)[0];function l(r){r.stopPropagation()}j.ontouchstart=l;var q=function(){var r;n=null;if(b.animation==="none"){f("#mf-references").hide()}else{if(b.animation==="slide"){r=window.innerHeight+window.pageYOffset;f("#mf-references").show().animate({top:r},b.animationSpeed)}else{f("#mf-references").fadeOut(b.animationSpeed)}}},n,k,m,i,p=e();f("<button>close</button>").click(q).appendTo("#mf-references");f(".mw-cite-backlink a").click(q);function o(r){var t,s;i=f(this).attr("href");k=i&&i.charAt(0)==="#"?p[i.substr(1,i.length)]:null;if(!f("#mf-references").is(":visible")||n!==i){n=i;if(k){m="<h3>"+f(this).text()+"</h3>"+k.html}else{m=f("<a />").text(f(this).text()).attr("href",i).appendTo("<div />").parent().html()}f("#mf-references div").html(m);f("#mf-references div sup a").click(o);d();if(b.animation==="none"){f("#mf-references").show()}else{if(b.animation==="slide"){t=window.innerHeight+window.pageYOffset;s=f("#mf-references").outerHeight();f("#mf-references").show().css({top:t}).animate({top:t-s},b.animationSpeed)}else{f("#mf-references").fadeIn(b.animationSpeed)}}}else{q()}r.preventDefault()}f("sup a").unbind("click").click(o).each(function(r,s){s.ontouchstart=l})}g()}(jQuery))}; |
\ No newline at end of file |
Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/beta_opensearch.min.js |
— | — | @@ -1 +1 @@ |
2 | | -MobileFrontend.opensearch=(function(){var c="/api.php",m=-1,d=500,A=15,q,k=document.getElementById("search"),a=document.getElementById("searchbox"),r=document.getElementById("content"),o=document.getElementById("footer"),y=document.getElementById("clearsearch"),j=false,x,w,n=MobileFrontend.utils;c=MobileFrontend.setting("scriptPath")+c;function s(){results.style.display="none"}x=n('meta[name="viewport"]');if(x){x=x[0];w=x.getAttribute("content")}function h(){if(x){x.setAttribute("content","minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0");n(document.body).bind("gesturestart",function(){x.setAttribute("content",w)})}}h();k.onfocus=function(){var u,B;a=document.getElementById("searchbox");header=document.getElementById("header");r=document.getElementById("content");o=document.getElementById("footer");h();if(!j){MobileFrontend.utils(document.body).addClass("full-screen-search");u=document.getElementById("remove-results");if(!u){u=document.createElement("a");u.setAttribute("href","#");u.setAttribute("id","remove-results");n(u).bind("click",z);B=document.createElement("div");B.setAttribute("id","left-arrow");u.appendChild(B);header.insertBefore(u,header.firstChild)}j=true}};function z(){MobileFrontend.utils(document.body).removeClass("full-screen-search");if(j){j=false}}function b(B){var u;if(!B){B=window.event}if(B.target){u=B.target}else{if(B.srcElement){u=B.srcElement}}if(u.nodeType===3){u=u.parentNode}B.cancelBubble=true;B.stopPropagation();if(u.className==="suggestion-result"||u.className==="search-result-item"||u.className==="suggestions-result"||u.className==="sq-val-update"||u.id==="results"||u.id==="search"||u.id==="searchbox"||u.id==="sq"||u.id==="placeholder"||u.id==="clearsearch"||u.tagName==="BODY"){if(u.id==="clearsearch"&&results){results.innerHTML=""}}else{s()}}var l=function(u){u.preventDefault();clearTimeout(m);q=k.value;if(q.length<1){results.innerHTML=""}else{q=encodeURIComponent(q);m=setTimeout(function(){i(q)},d)}};n(k).bind("keyup",l);n(document.getElementById("searchForm")).bind("submit",l);n(k).bind("blur",l);function i(u){n(k).addClass("searching");url=c+"?action=opensearch&limit="+A+"&namespace=0&format=xml&search="+u;n.ajax({url:url,success:function(B){if(n(document.body).hasClass("full-screen-search")){p(g(B));n(k).removeClass("searching")}}})}function g(E){var F=[],B,C,D,u=E.getElementsByTagName("Item");for(B=0;B<u.length;B++){C=u[B];D={label:C.getElementsByTagName("Text")[0].textContent,value:C.getElementsByTagName("Url")[0].textContent};F.push(D)}return F}function e(C){var B=document.createTextNode(C),u=document.createElement("div");u.appendChild(B);return u.innerHTML}function v(u){return u.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function p(J){var D=document.getElementById("results"),F,E,C=e(document.getElementById("search").value),I,B,u,G,H;D.style.display="block";if(k){k.focus()}if(!J||J.length<1){D.innerHTML='<ul class="suggestions-results" title="No Results"><li class="suggestions-result">No Results</li></div>'}else{if(D.firstChild){D.removeChild(D.firstChild)}F=document.createElement("ul");F.className="suggestions-results";D.appendChild(F);for(E=0;E<J.length;E++){I=J[E];u=document.createElement("li");u.setAttribute("title",I.label);u.className="suggestions-result";G=document.createElement("a");G.setAttribute("href",I.value.replace(/^(?:\/\/|[^\/]+)*\//,"/"));G.className="search-result-item";H=document.createTextNode(I.label);G.appendChild(H);u.appendChild(G);F.appendChild(u);B=v(C);G.innerHTML=G.innerHTML.replace(new RegExp("("+B+")","ig"),"<strong>$1</strong>")}}}function f(){var D=document.getElementById("clearsearch"),u=document.getElementById("search");function B(E){u.value="";E.preventDefault()}function C(){u.select()}n(D).bind("mousedown",B);n(u).bind("click",C)}function t(){var u=document.getElementById("results");u.onmousedown=b;document.body.onmousedown=b;document.body.ontouchstart=b;u.ontouchstart=b}t();f();return{init:t,initClearSearch:f,writeResults:p,createObjectArray:g,removeResults:z}}()); |
\ No newline at end of file |
| 2 | +MobileFrontend.opensearch=(function(){var b="/api.php",k=-1,c=500,y=15,p,i=document.getElementById("search"),a=document.getElementById("searchbox"),q=document.getElementById("content"),n=document.getElementById("footer"),w=document.getElementById("clearsearch"),h=false,v,t,l=MobileFrontend.utils;b=MobileFrontend.setting("scriptPath")+b;i.onfocus=function(){var u,A;a=document.getElementById("searchbox");header=document.getElementById("header");q=document.getElementById("content");n=document.getElementById("footer");if(!h){MobileFrontend.utils(document.body).addClass("full-screen-search");u=document.getElementById("remove-results");if(!u){u=document.createElement("a");u.setAttribute("href","#");u.setAttribute("id","remove-results");l(u).bind("click",x);A=document.createElement("div");A.setAttribute("id","left-arrow");u.appendChild(A);header.insertBefore(u,header.firstChild)}h=true}};function x(){MobileFrontend.utils(document.body).removeClass("full-screen-search");if(h){h=false}}var j=function(u){if(u){u.preventDefault()}clearTimeout(k);p=i.value;if(p.length>1){p=encodeURIComponent(p);k=setTimeout(function(){g(p)},c)}};var m;window.setInterval(function(){var u=i.value;if(u.length>1&&u!==m){m=u;j()}},c);l(document.getElementById("searchForm")).bind("submit",j);function z(u){if(i.value.length===0){x()}else{j(u)}}l(i).bind("blur",z);function g(u){l(i).addClass("searching");url=b+"?action=opensearch&limit="+y+"&namespace=0&format=xml&search="+u;l.ajax({url:url,success:function(A){if(l(document.body).hasClass("full-screen-search")){o(f(A));l(i).removeClass("searching")}}})}function f(D){var E=[],A,B,C,u=D.getElementsByTagName("Item");for(A=0;A<u.length;A++){B=u[A];C={label:B.getElementsByTagName("Text")[0].textContent,value:B.getElementsByTagName("Url")[0].textContent};E.push(C)}return E}function d(B){var A=document.createTextNode(B),u=document.createElement("div");u.appendChild(A);return u.innerHTML}function s(u){return u.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function o(I){var C=document.getElementById("results"),E,D,B=d(document.getElementById("search").value),H,A,u,F,G;if(i){i.focus()}if(!I||I.length<1){C.innerHTML='<ul class="suggestions-results" title="No Results"><li class="suggestions-result">No Results</li></div>'}else{if(C.firstChild){C.removeChild(C.firstChild)}E=document.createElement("ul");E.className="suggestions-results";C.appendChild(E);for(D=0;D<I.length;D++){H=I[D];u=document.createElement("li");u.setAttribute("title",H.label);u.className="suggestions-result";F=document.createElement("a");F.setAttribute("href",H.value.replace(/^(?:\/\/|[^\/]+)*\//,"/"));F.className="search-result-item";G=document.createTextNode(H.label);F.appendChild(G);u.appendChild(F);E.appendChild(u);A=s(B);F.innerHTML=F.innerHTML.replace(new RegExp("("+A+")","ig"),"<strong>$1</strong>")}}}function e(){var C=document.getElementById("clearsearch"),u=document.getElementById("search");function A(D){u.value="";results.innerHTML="";D.preventDefault()}function B(){u.select()}l(C).bind("mousedown",A);l(u).bind("click",B)}function r(){}r();e();return{init:r,initClearSearch:e,writeResults:o,createObjectArray:f,removeResults:x}}()); |
\ No newline at end of file |