r113445 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113444‎ | r113445 | r113446 >
Date:01:35, 9 March 2012
Author:awjrichards
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/MobileFrontend.body.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/application.js (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/application.min.js (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/beta_application.js (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/beta_application.min.js (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/ApplicationTemplate.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/MobileFrontend.body.php
@@ -1216,6 +1216,8 @@
12171217 'wgScriptPath' => $wgScriptPath,
12181218 'isFilePage' => self::$isFilePage,
12191219 'zeroRatedBanner' => self::$zeroRatedBanner,
 1220+ 'showText' => self::$messages[ 'mobile-frontend-show-button' ],
 1221+ 'hideText' => self::$messages[ 'mobile-frontend-hide-button' ],
12201222 );
12211223 $applicationTemplate->setByArray( $options );
12221224 wfProfileOut( __METHOD__ );
Index: branches/wmf/1.19wmf1/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: branches/wmf/1.19wmf1/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: branches/wmf/1.19wmf1/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: branches/wmf/1.19wmf1/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: branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/ApplicationTemplate.php
@@ -40,7 +40,10 @@
4141 $startLinkTag = "<link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/";
4242 $endLinkTag = "' media='all' rel='Stylesheet' type='text/css' />";
4343 $filePageStyle = ( $this->data['isFilePage'] ) ? $startLinkTag . 'filepage.css' . $endLinkTag : '';
 44+ $buttonHideText = htmlentities( $this->data['hideText'], ENT_QUOTES );
 45+ $buttonShowText = htmlentities( $this->data['showText'], ENT_QUOTES );
4446
 47+
4548 $applicationHtml = <<<HTML
4649 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4750 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -48,8 +51,8 @@
4952 <head>
5053 <title>{$this->data['htmlTitle']}</title>
5154 <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' />
 55+ <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$betaPrefix}common.css?version=1331255385' media='all' rel='Stylesheet' type='text/css' />
 56+ <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$cssFileName}.css?version=1331255385' media='all' rel='Stylesheet' type='text/css' />
5457 {$filePageStyle}
5558 <meta name="viewport" content="width=device-width, initial-scale=1.0">
5659 {$appleTouchIconTag}
@@ -59,6 +62,8 @@
6063 var title = "{$this->data['htmlTitle']}";
6164 var scriptPath = "{$this->data['wgScriptPath']}";
6265 var placeholder = "{$this->data['placeholder']}";
 66+ var showText = "{$buttonShowText}";
 67+ var hideText = "{$buttonHideText}";
6368 //]]>
6469 </script>
6570 </head>
@@ -71,8 +76,8 @@
7277 </div>
7378 {$this->data['footerHtml']}
7479 <!--[if gt IE 9]><!-->
75 - {$startScriptTag}{$javaScriptPath}{$betaPrefix}application.{$resourceSuffix}js?version=1331250586{$endScriptTag}
76 - {$startScriptTag}{$javaScriptPath}banner.{$resourceSuffix}js?version=1331250586{$endScriptTag}
 80+ {$startScriptTag}{$javaScriptPath}{$betaPrefix}application.{$resourceSuffix}js?version=1331255385{$endScriptTag}
 81+ {$startScriptTag}{$javaScriptPath}banner.{$resourceSuffix}js?version=1331255385{$endScriptTag}
7782 {$startScriptTag}{$javaScriptPath}{$betaPrefix}opensearch.{$resourceSuffix}js?version=1331250599{$endScriptTag}
7883 {$filePageScript}
7984 <!--[endif]-->
Property changes on: branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/ApplicationTemplate.php
___________________________________________________________________
Modified: svn:mergeinfo
8085 Merged /trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php:r113442,113444
Property changes on: branches/wmf/1.19wmf1/extensions/MobileFrontend
___________________________________________________________________
Modified: svn:mergeinfo
8186 Merged /trunk/extensions/MobileFrontend:r113442,113444

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113442Making show/hide buttons translatableawjrichards01:21, 9 March 2012
r113444Followup r113442, using internal message array and escaping button messagesawjrichards01:32, 9 March 2012

Status & tagging log