Jump to content

Wikipedia:WikiProject User scripts/Scripts/Sigdash

From Wikipedia, the free encyclopedia
// <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>