r101738 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101737‎ | r101738 | r101739 >
Date:23:07, 2 November 2011
Author:preilly
Status:deferred (Comments)
Tags:
Comment:
1.18wmf1: MFT r101714, r101737
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/javascripts/application.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/MobileFrontend/views/layout/_search_webkit.html.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/javascripts/application.js
@@ -8,7 +8,7 @@
99 function initClearSearchLink() {
1010 clearSearch.setAttribute( 'title','Clear' );
1111 clearSearch.addEventListener( 'mousedown', clearSearchBox, true );
12 - search.addEventListener( 'keyup', _handleClearSearchLink, false );
 12+ search.addEventListener( 'keyup', handleClearSearchLink, false );
1313 }
1414
1515 function navigateToLanguageSelection() {
@@ -21,7 +21,7 @@
2222 }
2323 }
2424
25 -function _handleClearSearchLink() {
 25+function handleClearSearchLink() {
2626 if ( clearSearch ) {
2727 if ( search.value.length > 0 ) {
2828 clearSearch.style.display = 'block';
@@ -58,16 +58,6 @@
5959 }
6060 };
6161
62 -// Also problematic, not working until the page loads...
63 -for( var h = document.getElementsByTagName( 'h2' ), i = 0; i < h.length; i++ ) {
64 - if ( h[i].className == 'section_heading' ) {
65 - h[i].onclick = function() {
66 - var section_idx = parseInt( this.id.replace( /section_(\d+)/, '$1' ) );
67 - wm_toggle_section( section_idx );
68 - }
69 - }
70 -};
71 -
7262 // And this...
7363 for ( var a = document.getElementsByTagName( 'a' ), i = 0; i < a.length; i++ ) {
7464 a[i].onclick = function() {
@@ -75,7 +65,7 @@
7666 wm_reveal_for_hash( this.hash );
7767 }
7868 }
79 -};
 69+}
8070
8171 if ( document.location.hash.indexOf( '#' ) == 0 ) {
8272 wm_reveal_for_hash( document.location.hash );
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/MobileFrontend.php
@@ -863,17 +863,25 @@
864864 Html::closeElement( 'div' );
865865 // generate the HTML we are going to inject
866866 $buttons = Html::element( 'button',
867 - array( 'class' => 'section_heading show',
868 - 'section_id' => $headings ),
869 - $show ) .
870 - Html::element( 'button',
871 - array( 'class' => 'section_heading hide',
872 - 'section_id' => $headings ),
873 - $hide );
874 - $base .= Html::openElement( 'h2',
875 - array( 'class' => 'section_heading',
876 - 'id' => 'section_' . $headings ) ) .
877 - $buttons .
 867+ array( 'class' => 'section_heading show',
 868+ 'section_id' => $headings ),
 869+ $show ) .
 870+ Html::element( 'button',
 871+ array( 'class' => 'section_heading hide',
 872+ 'section_id' => $headings ),
 873+ $hide );
 874+ if ( self::$device['supports_javascript'] ) {
 875+ $h2OnClick = 'javascript:wm_toggle_section(' . $headings . ');';
 876+ $base .= Html::openElement( 'h2',
 877+ array( 'class' => 'section_heading',
 878+ 'id' => 'section_' . $headings,
 879+ 'onclick' => $h2OnClick ) );
 880+ } else {
 881+ $base .= Html::openElement( 'h2',
 882+ array( 'class' => 'section_heading',
 883+ 'id' => 'section_' . $headings ) );
 884+ }
 885+ $base .= $buttons .
878886 Html::rawElement( 'span',
879887 array( 'id' => $headlineId ),
880888 $matches[2] ) .
Index: branches/wmf/1.18wmf1/extensions/MobileFrontend/views/layout/_search_webkit.html.php
@@ -16,7 +16,7 @@
1717 $languageSelectionText = '<b>' . self::$messages['mobile-frontend-language'] . ':</b><br/>';
1818 $languageSelectionDiv = ( self::$isBetaGroupMember ) ? '<div id="languageselectionsection">' . $languageSelectionText . $languageSelection . '</div>' : '';
1919
20 -$logoOnClick = (self::$device['supports_javascript']) ? 'onclick="javascript:logoClick();"' : '';
 20+$logoOnClick = ( self::$device['supports_javascript'] ) ? 'onclick="javascript:logoClick();"' : '';
2121
2222 $searchWebkitHtml = <<<EOD
2323 <div id='header'>

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r101714fix spacingpreilly21:48, 2 November 2011
r101737move javascript section support to onclick eventpreilly23:06, 2 November 2011

Comments

#Comment by Yair rand (talk | contribs)   01:29, 3 November 2011

Attaching onclick to every header individually? This seems like a bad idea, IMO.

#Comment by Reedy (talk | contribs)   14:06, 10 November 2011

Please make comments of this nature on the actual revision, not the merge to production

Status & tagging log