User:CWenger/dashes.js

// Fix hyphens, dashes, and minus signs per MOS:DASH. // // See talk page for instructions. // // The user can disable these conversions by putting "nodashes" somewhere // in the text — either temporarily or permanently. You can similarly add // "scores" if the score-detection heuristic doesn't trigger automatically. // // This tool can be used standalone until it is added to AutoEd and wikEd. // This module should follow unicodify.js if it is used. // Testing page is at User:GregU/dashes.js/tests. // Please report false positives on the talk page. importScript('User:CWenger/dashesFunction.js');

// Hook to allow using this tool "standalone" if (importScript("Wikipedia:AutoEd/core.js"))  // if not otherwise using AutoEd {   function autoEdFunctions { var txt = document.editform.wpTextbox1; var str = txt.value. replace(/&mdash;/g, '—'). replace(/–/g, '–'). // simplify core regexes replace(/&minus;/g, '−'); var newstr = autoEdDashes( str ); if (newstr != str) {        // don't alter encoding style if no fixes txt.value = newstr; autoEdTag = "fixed dashes using a script"; }   }    autoEdLinkName  = "–"; autoEdLinkHover = "Fix dashes, hyphens, and minus signs"; autoEdTag      = ""; }