Difference between revisions of "MediaWiki:Freephile.js"

From Freephile Wiki
Jump to navigation Jump to search
(adds link to sidebard; using custom theme element id)
Line 4: Line 4:
 
+ '&action=raw&ctype=text/javascript"></' + 'script>');
 
+ '&action=raw&ctype=text/javascript"></' + 'script>');
  
function AppendCategoryTreeToSidebar() {
+
function AppendLinkToSidebar() {
 +
    myLink = 'http://freephile.com/wiki/index.php/Special:Categories';
 
     try {
 
     try {
 
         var node = document.getElementById( "gumax-footer" )
 
         var node = document.getElementById( "gumax-footer" )
Line 13: Line 14:
 
         var liNode = document.createElement( 'li' );
 
         var liNode = document.createElement( 'li' );
 
   
 
   
         aNode.appendChild( document.createTextNode( 'CategoryTree' ) );
+
         aNode.appendChild( document.createTextNode( 'Categories' ) );
         aNode.setAttribute( 'href' , 'http://freephile.com/wiki/index.php/Special:CategoryTree' );
+
         aNode.setAttribute( 'href' , myLink );
 
         liNode.appendChild( aNode );
 
         liNode.appendChild( aNode );
 
         liNode.className = 'plainlinks';
 
         liNode.className = 'plainlinks';

Revision as of 00:58, 13 December 2008

// install [[User:Cacycle/wikEd]] in-browser text editor
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
+ '&action=raw&ctype=text/javascript"></' + 'script>');

function AppendLinkToSidebar() {
    myLink = 'http://freephile.com/wiki/index.php/Special:Categories';
    try {
        var node = document.getElementById( "gumax-footer" )
                           .getElementsByTagName('div')[0]
                           .getElementsByTagName('ul')[0];
 
        var aNode = document.createElement( 'a' );
        var liNode = document.createElement( 'li' );
 
        aNode.appendChild( document.createTextNode( 'Categories' ) );
        aNode.setAttribute( 'href' , myLink );
        liNode.appendChild( aNode );
        liNode.className = 'plainlinks';
        node.appendChild( liNode );
    } catch(e) {
        // lets just ignore what's happened
        return;
    }
}
 
addOnloadHook( AppendCategoryTreeToSidebar );