Got a spare minute? The Archives need some love. See the to-do list to find a way to help.
If you upload a new image make sure you name and categorize it properly. If in doubt, ask an admin or see our FAQ page.

MediaWiki:Common.js

From Bulbagarden Archives
Revision as of 04:17, 26 May 2021 by Tech (talk | contribs) (New cdn)
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.
/* Any JavaScript here will be loaded for all users on every page load. */

// Webmaster staff icons
$(document).ready(function () {
    if(
        window.location.href.indexOf("/wiki/User:") == -1
    ) {
        if(
            window.location.href.indexOf("/wiki/User_talk:") == -1
        ) {
            return;
        }
    };

    // create div and set innerHTML to link
    var divContainer = document.createElement("div");
    divContainer.innerHTML = '<div class="stafflink-WM" style="float:right; display:none;"><a href="/wiki/Archives:Webmasters" title="This user is a Webmaster of Bulbagarden."><img src="http://cdn2.bulbagarden.net/media/upload/9/98/IconBAWebmaster.png"></a></div>';

    // insert divContainer into the DOM below the h1
    if(window.location.href.indexOf("&action=edit") == -1) {
        document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
    }

});

// Advisory Council staff icons
$(document).ready(function () {
    if(
        window.location.href.indexOf("/wiki/User:") == -1
    ) {
        if(
            window.location.href.indexOf("/wiki/User_talk:") == -1
        ) {
            return;
        }
    };

    // create div and set innerHTML to link
    var divContainer = document.createElement("div");
    divContainer.innerHTML = '<div class="stafflink-AC" style="float:right; display:none;"><a href="/wiki/Archives:Advisory_Council" title="This user is a member of the Bulbagarden Archives Advisory Council."><img src="http://cdn2.bulbagarden.net/media/upload/e/e2/IconBAAdvisoryCouncil.png"></a></div>';

    // insert divContainer into the DOM below the h1
    if(window.location.href.indexOf("&action=edit") == -1) {
        document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
    }

});

// Bureaucrat staff icons
$(document).ready(function () {
    if(
        window.location.href.indexOf("/wiki/User:") == -1
    ) {
        if(
            window.location.href.indexOf("/wiki/User_talk:") == -1
        ) {
            return;
        }
    };

    // create div and set innerHTML to link
    var divContainer = document.createElement("div");
    divContainer.innerHTML = '<div class="stafflink-BC" style="float:right; display:none;"><a href="/wiki/Archives:Bureaucrats" title="This user is a Bulbagarden Archives Bureaucrat."><img src="http://cdn2.bulbagarden.net/media/upload/7/7b/IconBABureaucrat.png"></a></div>';

    // insert divContainer into the DOM below the h1
    if(window.location.href.indexOf("&action=edit") == -1) {
        document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
    }

});

// Senior Administrator staff icons
$(document).ready(function () {
    if(
        window.location.href.indexOf("/wiki/User:") == -1
    ) {
        if(
            window.location.href.indexOf("/wiki/User_talk:") == -1
        ) {
            return;
        }
    };

    // create div and set innerHTML to link
    var divContainer = document.createElement("div");
    divContainer.innerHTML = '<div class="stafflink-SA" style="float:right; display:none;"><a href="/wiki/Archives:Senior_Administrators" title="This user is a Bulbagarden Archives Senior Administrator."><img src="http://cdn2.bulbagarden.net/media/upload/3/34/IconBASeniorAdministrator.png"></a></div>';

    // insert divContainer into the DOM below the h1
    if(window.location.href.indexOf("&action=edit") == -1) {
        document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
    }

});

// Administrator staff icons
$(document).ready(function () {
    if(
        window.location.href.indexOf("/wiki/User:") == -1
    ) {
        if(
            window.location.href.indexOf("/wiki/User_talk:") == -1
        ) {
            return;
        }
    };

    // create div and set innerHTML to link
    var divContainer = document.createElement("div");
    divContainer.innerHTML = '<div class="stafflink-AD" style="float:right; display:none;"><a href="/wiki/Archives:Administrators" title="This user is a Bulbagarden Archives Administrator."><img src="http://cdn2.bulbagarden.net/media/upload/d/df/IconBAAdministrator.png"></a></div>';

    // insert divContainer into the DOM below the h1
    if(window.location.href.indexOf("&action=edit") == -1) {
        document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
    }

});

// Junior Administrator staff icons
$(document).ready(function () {
    if(
        window.location.href.indexOf("/wiki/User:") == -1
    ) {
        if(
            window.location.href.indexOf("/wiki/User_talk:") == -1
        ) {
            return;
        }
    };

    // create div and set innerHTML to link
    var divContainer = document.createElement("div");
    divContainer.innerHTML = '<div class="stafflink-JA" style="float:right; display:none;"><a href="/wiki/Archives:Junior_Administrators" title="This user is a Bulbagarden Archives Junior Administrator."><img src="http://cdn2.bulbagarden.net/media/upload/8/86/IconBAJuniorAdministrator.png"></a></div>';

    // insert divContainer into the DOM below the h1
    if(window.location.href.indexOf("&action=edit") == -1) {
        document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
    }

});

// Inactive staff icons
$(document).ready(function () {
    if(
        window.location.href.indexOf("/wiki/User:") == -1
    ) {
        if(
            window.location.href.indexOf("/wiki/User_talk:") == -1
        ) {
            return;
        }
    };

    // create div and set innerHTML to link
    var divContainer = document.createElement("div");
    divContainer.innerHTML = '<div class="stafflink-IN" style="float:right; display:none;"><a href="/wiki/Archives:Inactive_Staff" title="This user is an inactive Bulbagarden Archives staff member. Please direct your inquiries to an active staff member."><img src="http://cdn2.bulbagarden.net/media/upload/b/b5/IconBAInactive.png"></a></div>';

    // insert divContainer into the DOM below the h1
    if(window.location.href.indexOf("&action=edit") == -1) {
        document.getElementById("content").insertBefore(divContainer, document.getElementsByTagName("h1")[0]);
    }

});