// SIGDASH FIX: <pre><nowiki>
(function () {
var oldAddButton = window.addButton;
if (typeof(oldAddButton) == 'function') {
window.addButton = function () {
if (arguments.length > 3)
arguments[2] = arguments[2].replace(/^--(~+)$/, '—$1');
oldAddButton.apply(this, arguments);
};
}
// The fix above doesn't work with the new fancier edit form. Use this instead.
// The setTimeout() trickery is needed due to issues with asynchronous script loading:
// it seems to be the only way to ensure that the button has been created before this
// code runs. Otherwise this would be a two-liner. :-(
var fixSigDashSleep = 50;
var fixSigDash = function () {
if ( typeof $j === 'undefined' ) return;
var sigButton = $( 'span[rel=signature]' );
if ( !sigButton.length ) return setTimeout( fixSigDash, fixSigDashSleep *= 2 );
var opts = sigButton.data('action').options;
for (key in opts) opts[key] = opts[key].replace(/^--(~+)$/, '—$1')
};
if ( mw.config.get('wgAction') == "edit" || mw.config.get('wgAction') == "submit" ) $( fixSigDash );
})();
// </nowiki></pre>