r73889 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73888‎ | r73889 | r73890 >
Date:14:11, 28 September 2010
Author:thomasv
Status:ok
Tags:
Comment:
prepend 'ext.' to extension modules names; replace addOnloadHook() with .ready() ; hookEvent('load') is still needed for headers, to avoid interactions with custom toolbar scripts
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage_body.php (modified) (history)
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)
  • /trunk/extensions/ProofreadPage/proofread_index.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php
@@ -57,7 +57,7 @@
5858
5959 public static function resourceLoaderRegisterModules() {
6060 ResourceLoader::register(
61 - 'proofreadpage.page',
 61+ 'ext.proofreadpage.page',
6262 new ResourceLoaderFileModule(
6363 array(
6464 'scripts' => 'extensions/ProofreadPage/proofread.js',
@@ -82,7 +82,7 @@
8383 );
8484
8585 ResourceLoader::register(
86 - 'proofreadpage.article',
 86+ 'ext.proofreadpage.article',
8787 new ResourceLoaderFileModule(
8888 array(
8989 'scripts' => 'extensions/ProofreadPage/proofread_article.js'
@@ -91,7 +91,7 @@
9292 );
9393
9494 ResourceLoader::register(
95 - 'proofreadpage.index',
 95+ 'ext.proofreadpage.index',
9696 new ResourceLoaderFileModule( array( 'scripts' => 'extensions/ProofreadPage/proofread_index.js' ) )
9797 );
9898
@@ -354,7 +354,7 @@
355355 }
356356
357357 function prepareIndex( $out ) {
358 - $out->addModules( 'proofreadpage.index' );
 358+ $out->addModules( 'ext.proofreadpage.index' );
359359 $out->addInlineScript("
360360 var prp_index_attributes = \"" . Xml::escapeJsString( wfMsgForContent( 'proofreadpage_index_attributes' ) ) . "\";
361361 var prp_default_header = \"" . Xml::escapeJsString( wfMsgGetKey( 'proofreadpage_default_header', true, true, false ) ) . "\";
@@ -409,7 +409,7 @@
410410 );
411411 $out->addInlineScript( ResourceLoader::makeConfigSetScript( $jsVars ) );
412412
413 - $out->addModules( 'proofreadpage.page' );
 413+ $out->addModules( 'ext.proofreadpage.page' );
414414
415415 return true;
416416 }
@@ -1523,7 +1523,7 @@
15241524 $indexlink = $sk->link( $nt, wfMsg( 'proofreadpage_source' ),
15251525 array( 'title' => wfMsg( 'proofreadpage_source_message' ) ) );
15261526 $out->addInlineScript( ResourceLoader::makeConfigSetScript( array( 'proofreadpage_source_href' => $indexlink ) ) );
1527 - $out->addModules( 'proofreadpage.article' );
 1527+ $out->addModules( 'ext.proofreadpage.article' );
15281528 }
15291529
15301530 $q0 = $n0 * 100 / $n;
Index: trunk/extensions/ProofreadPage/proofread_index.js
@@ -131,5 +131,4 @@
132132 form.elements['wpTextbox1'].value = result;
133133 }
134134
135 -// use hookevent instead of addOnLoadHook, so that the code is evaluated after wikibits.js
136 -hookEvent( 'load', proofreadpage_index_init );
\ No newline at end of file
 135+$(document).ready( proofreadpage_index_init );
Index: trunk/extensions/ProofreadPage/proofread.js
@@ -166,14 +166,8 @@
167167 pageHeader = pageHeader.split( '&' ).join( '&' );
168168 pageFooter = pageFooter.split( '&' ).join( '&' );
169169
170 - if ( !self.proofreadpage_show_headers ) {
171 - headers_style = 'display:none';
172 - } else {
173 - headers_style = '';
174 - }
175 -
176170 container.innerHTML = '' +
177 - '<div id="prp_header" style="' + headers_style + '">' +
 171+ '<div id="prp_header" style="">' +
178172 '<span style="color:gray;font-size:80%;line-height:100%;">' +
179173 escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_header' ) ) + '</span>' +
180174 '<textarea name="wpHeaderTextbox" rows="2" cols="80" tabindex=1>' + pageHeader + '</textarea><br />' +
@@ -181,7 +175,7 @@
182176 escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_body' ) ) + '</span></div>' +
183177 '<textarea name="wpTextbox1" id="wpTextbox1" tabindex=1 style="height:' + ( self.DisplayHeight - 6 ) + 'px;">' +
184178 pageBody + '</textarea>' +
185 - '<div id="prp_footer" style="' + headers_style + '">' +
 179+ '<div id="prp_footer" style="">' +
186180 '<span style="color:gray;font-size:80%;line-height:100%;">' +
187181 escapeQuotesHTML( mediaWiki.msg.get( 'proofreadpage_footer' ) ) + '</span><br />' +
188182 '<textarea name="wpFooterTextbox" rows="2" cols="80" tabindex=1>' +
@@ -723,7 +717,7 @@
724718 }
725719
726720 function pr_setup() {
727 - self.pr_horiz = ( self.proofreadpage_default_layout ==' horizontal' );
 721+ self.pr_horiz = ( self.proofreadpage_default_layout == 'horizontal' );
728722 if( !proofreadPageIsEdit ) {
729723 pr_horiz = false;
730724 }
@@ -804,6 +798,11 @@
805799 pr_make_edit_area( self.text_container, new_text.value );
806800 var copywarn = document.getElementById( 'editpage-copywarn' );
807801 f.insertBefore( table, copywarn );
 802+ if ( !self.proofreadpage_show_headers ) {
 803+ hookEvent( 'load', pr_toggle_visibility );
 804+ } else {
 805+ hookEvent( 'load', pr_reset_size );
 806+ }
808807 } else {
809808 self.text_container.appendChild( new_text );
810809 f.appendChild( self.table );
@@ -951,10 +950,10 @@
952951 }
953952 }
954953
955 -addOnloadHook( pr_init );
956 -addOnloadHook( pr_init_tabs );
 954+$(document).ready( pr_init );
 955+$(document).ready( pr_init_tabs );
 956+$(document).ready( pr_initzoom );
957957
958 -hookEvent( 'load', pr_initzoom );
959958
960959 /* Quality buttons */
961960 self.pr_add_quality = function( form, value ) {
@@ -1032,4 +1031,4 @@
10331032 }
10341033 }
10351034
1036 -addOnloadHook( pr_add_quality_buttons );
\ No newline at end of file
 1035+$(document).ready( pr_add_quality_buttons );

Status & tagging log