r113442 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113441‎ | r113442 | r113443 >
Date:01:21, 9 March 2012
Author:awjrichards
Status:resolved
Tags:
Comment:
Making show/hide buttons translatable
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.body.php (modified) (history)
  • /trunk/extensions/MobileFrontend/javascripts/application.js (modified) (history)
  • /trunk/extensions/MobileFrontend/javascripts/application.min.js (modified) (history)
  • /trunk/extensions/MobileFrontend/javascripts/beta_application.js (modified) (history)
  • /trunk/extensions/MobileFrontend/javascripts/beta_application.min.js (modified) (history)
  • /trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php
@@ -1218,6 +1218,8 @@
12191219 'wgScriptPath' => $wgScriptPath,
12201220 'isFilePage' => self::$isFilePage,
12211221 'zeroRatedBanner' => self::$zeroRatedBanner,
 1222+ 'showText' => wfMessage( 'mobile-frontend-show-button' ),
 1223+ 'hideText' => wfMessage( 'mobile-frontend-hide-button' ),
12221224 );
12231225 $applicationTemplate->setByArray( $options );
12241226 wfProfileOut( __METHOD__ );
Index: trunk/extensions/MobileFrontend/javascripts/application.min.js
@@ -1 +1 @@
2 -MobileFrontend=(function(){var a;function c(){var j,k,f,o,r,h,n=a(".section_heading");a(document.body).addClass("jsEnabled");window.wm_toggle_section=b;var h=a(".section_heading button");for(j=0;j<h.length;j++){a(h[j]).remove()}function m(){var i=this.id?this.id.split("_")[1]:-1;if(i>-1){b(i)}}function p(t){var s,i;s=document.createElement("button");i=document.createTextNode(t?"Show":"Hide");s.className=t?"show":"hide";s.appendChild(i);s.style.display=t?"inline-block":"none";return s}if(!n){n=[]}else{a(document.body).addClass("togglingEnabled")}for(j=0;j<n.length;j++){r=n[j];r.removeAttribute("onclick");r.insertBefore(p(true),r.firstChild);r.insertBefore(p(false),r.firstChild);a(r).bind("click",m)}k=document.getElementById("results");f=document.getElementById("languageselection");function g(){var i;if(f){i=f.options[f.selectedIndex].value;if(i){location.href=i}}}a(f).bind("change",g);function l(){var i=document.getElementById("nav").style;i.display=i.display==="block"?"none":"block"}a(document.getElementById("logo")).bind("click",l);function q(){var i=this.hash||document.location.hash;if(i.indexOf("#")===0){e(i)}}q();for(o=document.getElementsByTagName("a"),j=0;j<o.length;j++){a(o[j]).bind("click",q)}window.scrollTo(0,1)}function e(i){var g=document.getElementById(i.substr(1)),h,f;if(g){h=g;while(h&&h.className!=="content_block"&&h.className!=="section_heading"){h=h.parentNode}if(h&&h.style.display!=="block"){f=parseInt(h.id.split("_")[1],10);b(f)}}}function b(g){var f=document.getElementById("section_"+g),l=f.getElementsByTagName("button"),h,j,k;for(h=0;h<=1;h++){j=l[h].style;j.display=j.display==="none"||(h&&!j.display)?"inline-block":"none"}for(h=0,d=["content_","anchor_"];h<=1;h++){k=document.getElementById(d[h]+g);if(k){k.style.display=k.style.display==="block"?"none":"block"}}}a=typeof jQuery!=="undefined"?jQuery:function(g){if(typeof(g)==="string"){if(document.querySelectorAll){return[].slice.call(document.querySelectorAll(g))}}function h(k){var l=g.className,m=l.split(" ");m.push(k);g.className=m.join(" ")}function i(k){var m=g.className,n=m.split(" "),o=[],l;for(l=0;l<n.length;l++){if(n[l]!==k){o.push(n[l])}}g.className=o.join(" ")}function j(l,k){g.addEventListener(l,k,false)}function f(){g.parentNode.removeChild(g)}return{addClass:h,bind:j,remove:f,removeClass:i}};a.ajax=a.ajax||function(h){var f,g;if(window.XMLHttpRequest){f=new XMLHttpRequest()}else{f=new ActiveXObject("Microsoft.XMLHTTP")}if(f.overrideMimeType){f.overrideMimeType("text/xml")}f.onreadystatechange=function(){if(f.readyState===4&&f.status===200){h.success(f.responseXML)}};f.open("GET",h.url,true);f.send()};c();return{wm_reveal_for_hash:e,wm_toggle_section:b,init:c,utils:a}}());
\ No newline at end of file
 2+MobileFrontend=(function(){var a;function c(){var j,k,f,o,r,h,n=a(".section_heading");a(document.body).addClass("jsEnabled");window.wm_toggle_section=b;var h=a(".section_heading button");for(j=0;j<h.length;j++){a(h[j]).remove()}function m(){var i=this.id?this.id.split("_")[1]:-1;if(i>-1){b(i)}}function p(t){var s,i;s=document.createElement("button");i=document.createTextNode(t?showText:hideText);s.className=t?"show":"hide";s.appendChild(i);s.style.display=t?"inline-block":"none";return s}if(!n){n=[]}else{a(document.body).addClass("togglingEnabled")}for(j=0;j<n.length;j++){r=n[j];r.removeAttribute("onclick");r.insertBefore(p(true),r.firstChild);r.insertBefore(p(false),r.firstChild);a(r).bind("click",m)}k=document.getElementById("results");f=document.getElementById("languageselection");function g(){var i;if(f){i=f.options[f.selectedIndex].value;if(i){location.href=i}}}a(f).bind("change",g);function l(){var i=document.getElementById("nav").style;i.display=i.display==="block"?"none":"block"}a(document.getElementById("logo")).bind("click",l);function q(){var i=this.hash||document.location.hash;if(i.indexOf("#")===0){e(i)}}q();for(o=document.getElementsByTagName("a"),j=0;j<o.length;j++){a(o[j]).bind("click",q)}window.scrollTo(0,1)}function e(i){var g=document.getElementById(i.substr(1)),h,f;if(g){h=g;while(h&&h.className!=="content_block"&&h.className!=="section_heading"){h=h.parentNode}if(h&&h.style.display!=="block"){f=parseInt(h.id.split("_")[1],10);b(f)}}}function b(g){var f=document.getElementById("section_"+g),l=f.getElementsByTagName("button"),h,j,k;for(h=0;h<=1;h++){j=l[h].style;j.display=j.display==="none"||(h&&!j.display)?"inline-block":"none"}for(h=0,d=["content_","anchor_"];h<=1;h++){k=document.getElementById(d[h]+g);if(k){k.style.display=k.style.display==="block"?"none":"block"}}}a=typeof jQuery!=="undefined"?jQuery:function(g){if(typeof(g)==="string"){if(document.querySelectorAll){return[].slice.call(document.querySelectorAll(g))}}function h(k){var l=g.className,m=l.split(" ");m.push(k);g.className=m.join(" ")}function i(k){var m=g.className,n=m.split(" "),o=[],l;for(l=0;l<n.length;l++){if(n[l]!==k){o.push(n[l])}}g.className=o.join(" ")}function j(l,k){g.addEventListener(l,k,false)}function f(){g.parentNode.removeChild(g)}return{addClass:h,bind:j,remove:f,removeClass:i}};a.ajax=a.ajax||function(h){var f,g;if(window.XMLHttpRequest){f=new XMLHttpRequest()}else{f=new ActiveXObject("Microsoft.XMLHTTP")}if(f.overrideMimeType){f.overrideMimeType("text/xml")}f.onreadystatechange=function(){if(f.readyState===4&&f.status===200){h.success(f.responseXML)}};f.open("GET",h.url,true);f.send()};c();return{wm_reveal_for_hash:e,wm_toggle_section:b,init:c,utils:a}}());
\ No newline at end of file
Index: trunk/extensions/MobileFrontend/javascripts/beta_application.js
@@ -28,7 +28,7 @@
2929 function createButton( visible ) {
3030 var btn, label;
3131 btn = document.createElement( 'button' );
32 - label = document.createTextNode( visible ? 'Show' : 'Hide' );
 32+ label = document.createTextNode( visible ? showText : hideText );
3333 btn.className = visible ? 'show' : 'hide';
3434 btn.appendChild( label );
3535 btn.style.display = visible ? 'inline-block' : 'none';
Index: trunk/extensions/MobileFrontend/javascripts/beta_application.min.js
@@ -1 +1 @@
2 -MobileFrontend=(function(){var a;function c(){var j,t,q,k,f,o,s,h,n=a(".section_heading");a(document.body).addClass("jsEnabled");window.wm_toggle_section=b;var h=a(".section_heading button");for(j=0;j<h.length;j++){a(h[j]).remove()}function m(){var i=this.id?this.id.split("_")[1]:-1;if(i>-1){b(i)}}function p(v){var u,i;u=document.createElement("button");i=document.createTextNode(v?"Show":"Hide");u.className=v?"show":"hide";u.appendChild(i);u.style.display=v?"inline-block":"none";return u}if(!n){n=[]}else{a(document.body).addClass("togglingEnabled")}for(j=0;j<n.length;j++){s=n[j];s.removeAttribute("onclick");s.insertBefore(p(true),s.firstChild);s.insertBefore(p(false),s.firstChild);a(s).bind("click",m)}k=document.getElementById("results");f=document.getElementById("languageselection");function g(){var i;if(f){i=f.options[f.selectedIndex].value;if(i){location.href=i}}}a(f).bind("change",g);function l(){var i=document.getElementById("nav").style;i.display=i.display==="block"?"none":"block"}a(document.getElementById("logo")).bind("click",l);function r(){var i=this.hash||document.location.hash;if(i.indexOf("#")===0){e(i)}}r();for(o=document.getElementsByTagName("a"),j=0;j<o.length;j++){a(o[j]).bind("click",r)}window.scrollTo(0,1)}function e(i){var g=document.getElementById(i.substr(1)),h,f;if(g){h=g;while(h&&h.className!=="content_block"&&h.className!=="section_heading"){h=h.parentNode}if(h&&h.style.display!=="block"){f=parseInt(h.id.split("_")[1],10);b(f)}}}function b(g){var f=document.getElementById("section_"+g),l=f.getElementsByTagName("button"),h,j,k;for(h=0;h<=1;h++){j=l[h].style;j.display=j.display==="none"||(h&&!j.display)?"inline-block":"none"}for(h=0,d=["content_","anchor_"];h<=1;h++){k=document.getElementById(d[h]+g);if(k){k.style.display=k.style.display==="block"?"none":"block"}}}a=typeof jQuery!=="undefined"?jQuery:function(g){if(typeof(g)==="string"){if(document.querySelectorAll){return[].slice.call(document.querySelectorAll(g))}}function h(k){var l=g.className,m=l.split(" ");m.push(k);g.className=m.join(" ")}function i(k){var m=g.className,n=m.split(" "),o=[],l;for(l=0;l<n.length;l++){if(n[l]!==k){o.push(n[l])}}g.className=o.join(" ")}function j(l,k){g.addEventListener(l,k,false)}function f(){g.parentNode.removeChild(g)}return{addClass:h,bind:j,remove:f,removeClass:i}};a.ajax=a.ajax||function(h){var f,g;if(window.XMLHttpRequest){f=new XMLHttpRequest()}else{f=new ActiveXObject("Microsoft.XMLHTTP")}if(f.overrideMimeType){f.overrideMimeType("text/xml")}f.onreadystatechange=function(){if(f.readyState===4&&f.status===200){h.success(f.responseXML)}};f.open("GET",h.url,true);f.send()};c();return{wm_reveal_for_hash:e,wm_toggle_section:b,init:c,utils:a}}());
\ No newline at end of file
 2+MobileFrontend=(function(){var a;function c(){var j,t,q,k,f,o,s,h,n=a(".section_heading");a(document.body).addClass("jsEnabled");window.wm_toggle_section=b;var h=a(".section_heading button");for(j=0;j<h.length;j++){a(h[j]).remove()}function m(){var i=this.id?this.id.split("_")[1]:-1;if(i>-1){b(i)}}function p(v){var u,i;u=document.createElement("button");i=document.createTextNode(v?showText:hideText);u.className=v?"show":"hide";u.appendChild(i);u.style.display=v?"inline-block":"none";return u}if(!n){n=[]}else{a(document.body).addClass("togglingEnabled")}for(j=0;j<n.length;j++){s=n[j];s.removeAttribute("onclick");s.insertBefore(p(true),s.firstChild);s.insertBefore(p(false),s.firstChild);a(s).bind("click",m)}k=document.getElementById("results");f=document.getElementById("languageselection");function g(){var i;if(f){i=f.options[f.selectedIndex].value;if(i){location.href=i}}}a(f).bind("change",g);function l(){var i=document.getElementById("nav").style;i.display=i.display==="block"?"none":"block"}a(document.getElementById("logo")).bind("click",l);function r(){var i=this.hash||document.location.hash;if(i.indexOf("#")===0){e(i)}}r();for(o=document.getElementsByTagName("a"),j=0;j<o.length;j++){a(o[j]).bind("click",r)}window.scrollTo(0,1)}function e(i){var g=document.getElementById(i.substr(1)),h,f;if(g){h=g;while(h&&h.className!=="content_block"&&h.className!=="section_heading"){h=h.parentNode}if(h&&h.style.display!=="block"){f=parseInt(h.id.split("_")[1],10);b(f)}}}function b(g){var f=document.getElementById("section_"+g),l=f.getElementsByTagName("button"),h,j,k;for(h=0;h<=1;h++){j=l[h].style;j.display=j.display==="none"||(h&&!j.display)?"inline-block":"none"}for(h=0,d=["content_","anchor_"];h<=1;h++){k=document.getElementById(d[h]+g);if(k){k.style.display=k.style.display==="block"?"none":"block"}}}a=typeof jQuery!=="undefined"?jQuery:function(g){if(typeof(g)==="string"){if(document.querySelectorAll){return[].slice.call(document.querySelectorAll(g))}}function h(k){var l=g.className,m=l.split(" ");m.push(k);g.className=m.join(" ")}function i(k){var m=g.className,n=m.split(" "),o=[],l;for(l=0;l<n.length;l++){if(n[l]!==k){o.push(n[l])}}g.className=o.join(" ")}function j(l,k){g.addEventListener(l,k,false)}function f(){g.parentNode.removeChild(g)}return{addClass:h,bind:j,remove:f,removeClass:i}};a.ajax=a.ajax||function(h){var f,g;if(window.XMLHttpRequest){f=new XMLHttpRequest()}else{f=new ActiveXObject("Microsoft.XMLHTTP")}if(f.overrideMimeType){f.overrideMimeType("text/xml")}f.onreadystatechange=function(){if(f.readyState===4&&f.status===200){h.success(f.responseXML)}};f.open("GET",h.url,true);f.send()};c();return{wm_reveal_for_hash:e,wm_toggle_section:b,init:c,utils:a}}());
\ No newline at end of file
Index: trunk/extensions/MobileFrontend/javascripts/application.js
@@ -24,7 +24,7 @@
2525 function createButton( visible ) {
2626 var btn, label;
2727 btn = document.createElement( 'button' );
28 - label = document.createTextNode( visible ? 'Show' : 'Hide' );
 28+ label = document.createTextNode( visible ? showText : hideText );
2929 btn.className = visible ? 'show' : 'hide';
3030 btn.appendChild( label );
3131 btn.style.display = visible ? 'inline-block' : 'none';
Index: trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php
@@ -48,8 +48,8 @@
4949 <head>
5050 <title>{$this->data['htmlTitle']}</title>
5151 <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
52 - <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$betaPrefix}common.css?version=1331250586' media='all' rel='Stylesheet' type='text/css' />
53 - <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$cssFileName}.css?version=1331250586' media='all' rel='Stylesheet' type='text/css' />
 52+ <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$betaPrefix}common.css?version=1331255385' media='all' rel='Stylesheet' type='text/css' />
 53+ <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$cssFileName}.css?version=1331255385' media='all' rel='Stylesheet' type='text/css' />
5454 {$filePageStyle}
5555 <meta name="viewport" content="width=device-width, initial-scale=1.0">
5656 {$appleTouchIconTag}
@@ -59,6 +59,8 @@
6060 var title = "{$this->data['htmlTitle']}";
6161 var scriptPath = "{$this->data['wgScriptPath']}";
6262 var placeholder = "{$this->data['placeholder']}";
 63+ var showText = "{$this->data['showText']}";
 64+ var hideText = "{$this->data['hideText']}";
6365 //]]>
6466 </script>
6567 </head>
@@ -71,8 +73,8 @@
7274 </div>
7375 {$this->data['footerHtml']}
7476 <!--[if gt IE 9]><!-->
75 - {$startScriptTag}{$javaScriptPath}{$betaPrefix}application.{$resourceSuffix}js?version=1331250586{$endScriptTag}
76 - {$startScriptTag}{$javaScriptPath}banner.{$resourceSuffix}js?version=1331250586{$endScriptTag}
 77+ {$startScriptTag}{$javaScriptPath}{$betaPrefix}application.{$resourceSuffix}js?version=1331255385{$endScriptTag}
 78+ {$startScriptTag}{$javaScriptPath}banner.{$resourceSuffix}js?version=1331255385{$endScriptTag}
7779 {$startScriptTag}{$javaScriptPath}{$betaPrefix}opensearch.{$resourceSuffix}js?version=1331250599{$endScriptTag}
7880 {$filePageScript}
7981 <!--[endif]-->

Follow-up revisions

RevisionCommit summaryAuthorDate
r113444Followup r113442, using internal message array and escaping button messagesawjrichards01:32, 9 March 2012
r113445MFT r113442, r113444awjrichards01:35, 9 March 2012
r113488Bug 35086 - Expand brokens show bad labels on non-western alphabetsmaxsem17:30, 9 March 2012

Status & tagging log