Jump to content

User:BoxOfNotes/sugarcube.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BoxOfNotes (talk | contribs) at 08:31, 20 August 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
enabled = {
    "tools":true
}

// Special:Sugarcube page
if(mw.config("wgPageName") == "Special:Sugarcube") {
    $("#firstHeading").innerText = "sugarcube"
    $("#mw-content-text").innerText = "SUGARCUBE"
}

// Special:Sugarcube button in personal menu
$(`<li id="sugarcube-button" class="mw-list-item">
    <a href="/wiki/Special:Sugarcube" onclick="sugarcubeSpecial()" title="Your sugarcube preferences">
        <span>sugarcube</span>
    </a>
</li>`).insertBefore("#pt-betafeatures")

// Tools
if(enabled["tools"] == true) {
    $(`<div id="sugarcube-tools" style="position:absolute;left:180px;top:12px;font-size:14px">
        Tools:
        <a onclick="sugarcubeToolsWiki">Wiki</a>,
        <a onclick="sugarcubeToolsPage">Page</a>
    </div>`).insertBefore("#p-personal");
}