http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73886

Revision: 73886
Author:   thomasv
Date:     2010-09-28 12:53:04 +0000 (Tue, 28 Sep 2010)

Log Message:
-----------
simplification, using jQuery

Modified Paths:
--------------
    trunk/extensions/ProofreadPage/ProofreadPage_body.php
    trunk/extensions/ProofreadPage/proofread_article.js

Modified: trunk/extensions/ProofreadPage/ProofreadPage_body.php
===================================================================
--- trunk/extensions/ProofreadPage/ProofreadPage_body.php       2010-09-28 
12:37:52 UTC (rev 73885)
+++ trunk/extensions/ProofreadPage/ProofreadPage_body.php       2010-09-28 
12:53:04 UTC (rev 73886)
@@ -85,11 +85,7 @@
                        'proofreadpage.article',
                        new ResourceLoaderFileModule(
                                array(
-                                       'scripts' => 
'extensions/ProofreadPage/proofread_article.js',
-                                       'messages'=> array(
-                                               'proofreadpage_source',
-                                               'proofreadpage_source_message'
-                                       )
+                                       'scripts' => 
'extensions/ProofreadPage/proofread_article.js'
                                )
                        )
                );
@@ -357,11 +353,6 @@
                return true;
        }
 
-       function prepareArticle( $out ) {
-               $out->addModules( 'proofreadpage.article' );
-               $this->displayProofreadingStatus( $out );
-       }
-
        function prepareIndex( $out ) {
                $out->addModules( 'proofreadpage.index' );
                $out->addInlineScript("
@@ -1420,7 +1411,7 @@
         *
         * @param $out Object: OutputPage object
         */
-       function displayProofreadingStatus( $out ) {
+       function prepareArticle( $out ) {
                global $wgTitle, $wgUser;
 
                $id = $wgTitle->mArticleID;
@@ -1528,7 +1519,11 @@
                $indexlink = '';
                if( $indextitle ) {
                        $sk = $wgUser->getSkin();
-                       $indexlink = $sk->makeKnownLink( 
"$index_namespace:$indextitle", '[index]' );
+                       $nt = Title::makeTitleSafe( $index_ns_index, 
$indextitle );
+                       $indexlink = $sk->link( $nt, wfMsg( 
'proofreadpage_source' ), 
+                                               array( 'title' => wfMsg( 
'proofreadpage_source_message' ) ) );
+                       $out->addInlineScript( 
ResourceLoader::makeConfigSetScript( array( 'proofreadpage_source_href' => 
$indexlink ) ) );
+                       $out->addModules( 'proofreadpage.article' );
                }
 
                $q0 = $n0 * 100 / $n;
@@ -1546,7 +1541,6 @@
 <td align=center class='quality1' width=\"$q1\"></td>
 <td align=center class='quality0' width=\"$q0\"></td>
 $void_cell
-<td ><span id=pr_index style=\"visibility:hidden;\">$indexlink</span></td>
 </tr></table>";
                $out->setSubtitle( $out->getSubtitle() . $output );
                return true;

Modified: trunk/extensions/ProofreadPage/proofread_article.js
===================================================================
--- trunk/extensions/ProofreadPage/proofread_article.js 2010-09-28 12:37:52 UTC 
(rev 73885)
+++ trunk/extensions/ProofreadPage/proofread_article.js 2010-09-28 12:53:04 UTC 
(rev 73886)
@@ -2,24 +2,7 @@
 
 /* add backlink to index page */
 function pr_add_source() {
-       var a = document.getElementById( 'ca-nstab-main' );
-       if( !a ) {
-               return;
-       }
-       var q = document.getElementById( 'pr_index' );
-       if( q ) {
-               href = q.firstChild;
-               if( !href ) {
-                       return;
-               }
-               q.removeChild( href );
-               href.innerHTML = mediaWiki.msg.get( 'proofreadpage_source' );
-               href.setAttribute( 'title', mediaWiki.msg.get( 
'proofreadpage_source_message' ) );
-               var new_li = document.createElement( 'li' );
-               new_li.appendChild( href );
-               var new_span = document.createElement( 'span' );
-               new_span.appendChild( new_li );
-               a.parentNode.insertBefore( new_span, a.nextSibling );
-       }
+       $( '#ca-nstab-main' ).after( '<li><span>' + proofreadpage_source_href + 
'</span></li>' );
 }
-addOnloadHook( pr_add_source );
\ No newline at end of file
+
+$(document).ready( pr_add_source );



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to