MediaWiki:Common.js

From Linux/Xtensa
Revision as of 18:05, 11 April 2007 by Chris (talk | contribs) (New page: →‎Any JavaScript here will be loaded for all users on every page load.: /** Main Page layout fixes ********************************************************* * * Description: V...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
/** Main Page layout fixes *********************************************************
 *
 *  Description:        Various layout fixes for the main page, including an
 *                      additional link to the complete list of languages available
 *                      and the renaming of the 'Article' to to 'Main Page'.
 *  Maintainers:        User:AzaToth, User:R. Koot
 */

function mainPageRenameNamespaceTab() {
    try {
        var Node = document.getElementById( 'ca-nstab-main' ).firstChild;
        if ( Node.textContent ) {      // Per DOM Level 3
            Node.textContent = 'Main Page';
        } else if ( Node.innerText ) { // IE doesn't handle .textContent
            Node.innerText = 'Main Page';
        } else {                       // Fallback
            Node.replaceChild( Node.firstChild, document.createTextNode( 'Main Page' ) ); 
        }
    } catch(e) {
        // bailing out!
    }
}

function mainPageAppendCompleteListLink() {
    try {
        var node = document.getElementById( "p-lang" )
                           .getElementsByTagName('div')[0]
                           .getElementsByTagName('ul')[0];

        var aNode = document.createElement( 'a' );
        var liNode = document.createElement( 'li' );

        aNode.appendChild( document.createTextNode( 'Complete list' ) );
        aNode.setAttribute( 'href' , 'http://meta.wikimedia.org/wiki/List_of_Wikipedias' );
        liNode.appendChild( aNode );
        liNode.className = 'interwiki-completelist';
        node.appendChild( liNode );
     } catch(e) {
       // lets just ignore what's happened
       return;
    }
}

if ( wgTitle == 'Main Page' && ( wgNamespaceNumber == 0 || wgNamespaceNumber == 1 ) ) {
       addOnloadHook( mainPageRenameNamespaceTab );
}

if ( wgTitle == 'Main Page' && wgNamespaceNumber == 0 ) {
       addOnloadHook( mainPageAppendCompleteListLink );
}

Retrieved from "http://tux.hq.tensilica.com/index.php/MediaWiki:Common.js"
Views

    * Message
    * Discussion
    * View source
    * History
    * Watch

Personal tools

    * Chris
    * My talk
    * My preferences
    * My watchlist
    * My contributions
    * Log out

Navigation

    * Main Page
    * Community portal
    * Current events
    * Recent changes
    * Random page
    * Help
    * Donations

Search
 
Toolbox

    * What links here
    * Related changes
    * Upload file
    * Special pages
    * Printable version
    * Permanent link

Powered by MediaWiki
GNU Free Documentation License 1.2