Jump to content

Wikipedia:WikiProject User scripts/Scripts/Sigdash

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by WOSlinker (talk | contribs) at 14:57, 7 February 2021 (WOSlinker changed the content model of the page Wikipedia:WikiProject User scripts/Scripts/Sigdash from "wikitext" to "JavaScript"). The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
// <syntaxhighlight lang=javascript>
// This script changes the "Your signature with timestamp" edit button to use a real em dash instead of two hyphens.

(function () {
    var oldAddButton = window.addButton;
    if (typeof(oldAddButton) != 'function') return;
    window.addButton = function () {
        if (arguments.length > 2)
            arguments[2] = arguments[2].replace(/^--(~+)$/, '—$1');
        oldAddButton.apply(this, arguments);
    };
})();

// </syntaxhighlight>