User:INoMed/common.js

From SmashWiki, the Super Smash Bros. wiki
< User:INoMed
Revision as of 10:01, December 19, 2015 by INoMed (talk | contribs) (Hang on)
Jump to navigationJump to search

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.
// Text replacement
$( '#siteSub' ).text( 'SmashWiki, skinned by INoMeds CSS' );
$( '#ca-history a' ).text( 'Page history' );
$( '#ca-nstab-user a' ).text( 'Userspace' );
$( '#ca-talk a' ).text( 'Talk page' );
$( '#ca-view a' ).text( 'View' );
$( function () {
    var tab, tablink;

    tab = document.getElementById('ca-addsection');
    if ( !tab ) {
        return;
    }

    tablink = tab.getElementsByTagName('a')[0];
    if ( !tablink ) {
        return;
    }

    tablink.firstChild.nodeValue = 'New topic';
    if ( mw.config.get( 'skin' ) === 'monobook' ) {
      tablink.style.paddingLeft = ".4em";
      tablink.style.paddingRight = ".4em";
    }
});

// Add links into the toolbar

mw.loader.load( '//www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-UTCLiveClock.js&action=raw&ctype=text/javascript' );
var addtoolbarlinks = "p-personal"

addOnloadHook(
  function() {
    addPortletLink(addtoolbarlinks, 'http://www.ssbwiki.com/index.php?title=Special:Mypage/common.css&action=edit', 'Edit css', 'pt-mycss')
  }
);
addOnloadHook(
  function() {
    addPortletLink(addtoolbarlinks, 'http://www.ssbwiki.com/index.php?title=Special:Mypage/common.js&action=edit', 'Edit js', 'pt-myjs')
  }
);
addOnloadHook(
  function() {
    addPortletLink(addtoolbarlinks, 'http://www.ssbwiki.com/index.php?title=Special:Log', 'View logs', 'pt-logs')
  }
);

// Add links into the sidebar

var addtoolboxlinks = "p-tb"

addOnloadHook(
  function() {
    addPortletLink(addtoolboxlinks, 'http://www.ssbwiki.com/index.php?title=SmashWiki:Sandbox&action=edit', 'SmashWiki Sandbox')
  }
);
addOnloadHook(
  function() {
    addPortletLink(addtoolboxlinks, 'http://www.ssbwiki.com/index.php?title=User:INoMed/sandbox&action=edit', 'Personal Sandbox')
  }
);
addOnloadHook(
  function() {
    addPortletLink(addtoolboxlinks, 'http://www.ssbwiki.com/index.php?title=Special:PrefixIndex/User:INoMed/', 'Show my subpages')
  }
);
// Add an [edit] link to pages
addOnloadHook(function () {
 if(
 // document.getElementById("wikiPreview") ||
 document.getElementById("histlegend‎") ||
 document.getElementById("difference‎") ||
 document.getElementById("watchdetails") ||
 document.getElementById("ca-viewsource") ||
 window.location.href.indexOf("/index.php?title=Special:") != -1
 ) {
 if(window.location.href.indexOf("&action=edit&section=0") != -1) {
 document.getElementById("wpSummary").value = "/* Intro */ ";
 }
 return;
 };
 var pageTitle = wgPageName;
 var divContainer = document.createElement("div");
 divContainer.innerHTML = '<div class="editsection" style="font-family: raleway;color:black;margin: 1em 0 0 0;text-align:right;float:right;">[<a href="/w/index.php?title='+pageTitle+'&action=edit&section=0" title="Edit section: '+pageTitle+'">Edit top</a>]</div>';
 if(window.location.href.indexOf("&action=edit") == -1) {
 document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
 }
});