r73886 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73885‎ | r73886 | r73887 >
Date:12:53, 28 September 2010
Author:thomasv
Status:ok (Comments)
Tags:
Comment:
simplification, using jQuery
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage_body.php (modified) (history)
  • /trunk/extensions/ProofreadPage/proofread_article.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php
@@ -85,11 +85,7 @@
8686 'proofreadpage.article',
8787 new ResourceLoaderFileModule(
8888 array(
89 - 'scripts' => 'extensions/ProofreadPage/proofread_article.js',
90 - 'messages'=> array(
91 - 'proofreadpage_source',
92 - 'proofreadpage_source_message'
93 - )
 89+ 'scripts' => 'extensions/ProofreadPage/proofread_article.js'
9490 )
9591 )
9692 );
@@ -357,11 +353,6 @@
358354 return true;
359355 }
360356
361 - function prepareArticle( $out ) {
362 - $out->addModules( 'proofreadpage.article' );
363 - $this->displayProofreadingStatus( $out );
364 - }
365 -
366357 function prepareIndex( $out ) {
367358 $out->addModules( 'proofreadpage.index' );
368359 $out->addInlineScript("
@@ -1420,7 +1411,7 @@
14211412 *
14221413 * @param $out Object: OutputPage object
14231414 */
1424 - function displayProofreadingStatus( $out ) {
 1415+ function prepareArticle( $out ) {
14251416 global $wgTitle, $wgUser;
14261417
14271418 $id = $wgTitle->mArticleID;
@@ -1528,7 +1519,11 @@
15291520 $indexlink = '';
15301521 if( $indextitle ) {
15311522 $sk = $wgUser->getSkin();
1532 - $indexlink = $sk->makeKnownLink( "$index_namespace:$indextitle", '[index]' );
 1523+ $nt = Title::makeTitleSafe( $index_ns_index, $indextitle );
 1524+ $indexlink = $sk->link( $nt, wfMsg( 'proofreadpage_source' ),
 1525+ array( 'title' => wfMsg( 'proofreadpage_source_message' ) ) );
 1526+ $out->addInlineScript( ResourceLoader::makeConfigSetScript( array( 'proofreadpage_source_href' => $indexlink ) ) );
 1527+ $out->addModules( 'proofreadpage.article' );
15331528 }
15341529
15351530 $q0 = $n0 * 100 / $n;
@@ -1546,7 +1541,6 @@
15471542 <td align=center class='quality1' width=\"$q1\"></td>
15481543 <td align=center class='quality0' width=\"$q0\"></td>
15491544 $void_cell
1550 -<td ><span id=pr_index style=\"visibility:hidden;\">$indexlink</span></td>
15511545 </tr></table>";
15521546 $out->setSubtitle( $out->getSubtitle() . $output );
15531547 return true;
Index: trunk/extensions/ProofreadPage/proofread_article.js
@@ -2,24 +2,7 @@
33
44 /* add backlink to index page */
55 function pr_add_source() {
6 - var a = document.getElementById( 'ca-nstab-main' );
7 - if( !a ) {
8 - return;
9 - }
10 - var q = document.getElementById( 'pr_index' );
11 - if( q ) {
12 - href = q.firstChild;
13 - if( !href ) {
14 - return;
15 - }
16 - q.removeChild( href );
17 - href.innerHTML = mediaWiki.msg.get( 'proofreadpage_source' );
18 - href.setAttribute( 'title', mediaWiki.msg.get( 'proofreadpage_source_message' ) );
19 - var new_li = document.createElement( 'li' );
20 - new_li.appendChild( href );
21 - var new_span = document.createElement( 'span' );
22 - new_span.appendChild( new_li );
23 - a.parentNode.insertBefore( new_span, a.nextSibling );
24 - }
 6+ $( '#ca-nstab-main' ).after( '<li><span>' + proofreadpage_source_href + '</span></li>' );
257 }
26 -addOnloadHook( pr_add_source );
\ No newline at end of file
 8+
 9+$(document).ready( pr_add_source );

Comments

#Comment by Brion VIBBER (talk | contribs)   15:51, 28 September 2010

oh mannnnn the jquery code is shorter :D

Status & tagging log