Jump to content

User:Anne drew/WatchingIndicator.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Anne drew (talk | contribs) at 18:50, 28 January 2018 (change color). 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.
document.getElementById('wpSave').onmousedown = function(event) {
    let watching = document.getElementById("ca-unwatch") || document.getElementById("wpWatchthis").checked ? "watching this page'>★" : "not watching this page'>☆";
    let text = document.getElementById('wpTextbox1').value;
    if (text.search(/````/g) > -1) {
        if (confirm("Replace ```` with signature and small timestamp?") && ((text.match(/````/g) || []).length == 1 || confirm("Multiple instances found. Continue?")))
            document.getElementById('wpTextbox1').value = text.replace(/````/g, "{{subst:3~}} <small><span style='border-bottom:1px dotted;color:#0093FF' title='{{subst:currentuser}} is " + watching + "</span> @ {{subst:5~}}</small>");
    }
}