MediaWiki:Common.js

From Polcompball Wiki
Revision as of 07:38, 28 October 2023 by Athena von Krab (talk | contribs) (Undo revision 433914 by Athena von Krab (talk))
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. */

$( '#discord-widget' ).html( '<iframe src="https://discord.com/widget?id=855837257729835038&theme=dark" width="270" height="570" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>' );

function addMsgBox() {
    var dismissed = localStorage.getItem("dismissed-pcb-msgbox-1");

    if (dismissed === "true") {
        return;
    }

    /**@typedef {import("types-mediawiki")}*/
    var mw = mw || window.mw;

    var currentPage = new mw.Title(mw.config.get("wgPageName"));
    var ns = currentPage.namespace;

    if (ns === 0 || ns === 2 || ns === 200) {
        var top = $("#top");

        if (top.children().length) return;

        top.html('<div id="top" style="background: #1d2021;font-weight: bold;color: white;border: 2px solid #08265c;border-radius: 4px;padding: 2%;font-size: 16px;height: 140px;display: inline-block;width: 96%;"><div><img alt="Council-Communism-Chara-Portrait-Server Profile Picture.png" src="//static.miraheze.org/polcompballwiki/thumb/d/d8/Council-Communism-Chara-Portrait-Server_Profile_Picture.png/200px-Council-Communism-Chara-Portrait-Server_Profile_Picture.png" decoding="async" srcset="//static.miraheze.org/polcompballwiki/thumb/d/d8/Council-Communism-Chara-Portrait-Server_Profile_Picture.png/300px-Council-Communism-Chara-Portrait-Server_Profile_Picture.png 1.5x, //static.miraheze.org/polcompballwiki/thumb/d/d8/Council-Communism-Chara-Portrait-Server_Profile_Picture.png/400px-Council-Communism-Chara-Portrait-Server_Profile_Picture.png 2x" data-file-height="400" data-file-width="400" width="100px" height="100%"><div style="width: 90%;margin-left: 100px;margin-top: -100px;"><div style="font-size: 20px;color: #d40000;">On the 28th of October 2023, we will be migrating to <a href="https://polcompball.wikitide.org/wiki/Main_Page">WikiTide</a>. On the day of migration all the main namespace pages will be locked and transferred to the new platform, any changes made to other pages after this point will not be transferred to the new platform. You will be able to continue editing the pages on WikiTide when the migration is completed.</div><div style="margin-top: 10px;color: #d2d2d2;"><a href="https://polcompball.miraheze.org/wiki/Blog:Announcement_(2023;Week_42)">Full mod announcement</a></div></div></div><div style="width: 2%;margin-left: 99.9%;margin-top: -70px;"><button id="close_top" style="border: 0px;padding: 0px;width: 2%;background: #1d2021;color: #d2d2d2; cursor: pointer;">X</button></div><div>');

        $("#close_top").on("click", function () {
            localStorage.setItem("dismissed-pcb-msgbox-1", "true");
            $("#top").html("");
        });
    }
}

window.addEventListener("load", function () {
    addMsgBox();
});


setTimeout(function () {
    var ev = new Event("load");
    window.dispatchEvent(ev);
}, 1000);