MediaWiki:Vector.js

From Guild Wars 2 Wiki
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.
/* MEDIAWIKI:COMMON.JS */
console.log('[[MediaWiki:Vector.js]] has loaded (revision 2024-04-13 07:53).');

if (document.readyState === 'loading') {
    // Loading hasn't finished yet (loading status)
    document.addEventListener('DOMContentLoaded', vectorJS);
} else {
    // 'DOMContentLoaded' has already fired (either at interactive or complete status)
    vectorJS();
}

function vectorJS() {

    /** Insert ArenaNet links into the top of the page **/
    function addMasthead() {
        a = document.createElement('div');
        a.id = 'upperBar';
        a.innerHTML = '<ul><li><a href="https://www.guildwars2.com/en" target="_blank">GuildWars2.com</a></li>'
                        + '<li><a href="https://en-forum.guildwars2.com/" target="_blank">Forums</a></li>'
                        + '<li><a href="https://help.guildwars2.com/hc/en-us" target="_blank">Support</a></li>'
                    + '</ul>';

        var bodynode = document.getElementsByTagName('body');
        if (typeof(bodynode ) != 'undefined' && bodynode != null && bodynode.length > 0) {
            bodynode[0].insertBefore(a, bodynode[0].firstChild);
        }
    }
    addMasthead();

}