User:Ebrahames/AdvisorCustom.js

if ((typeof console) != "undefined") { console.info("loading AdvisorCustom.js"); }

// A ``rule'' is a javascript function that accepts a string as a // parameter (the wikitext of the page being edited) and returns an array // of ``suggestion'' objects. A suggestion object must have the following // properties: //    * start---the 0-based inclusive index of the first character to be replaced //    * end---analogous to start, but exclusive //    * replacement---the proposed wikitext //    * name---this is what appears at the top of the page //    * description---used as a tooltip for the name of the suggestion

ct.rules.push(function (s) {

var matches = ct.getAllMatches(/int he/g, s); // getAllMatches is a utility function of mine, you are not required to use it

var suggestions = []; for (var i = 0; i < matches.length; i++) { var match = matches[i]; suggestions.push({               start: match.start,                end: match.end,                replacement: "in the",                name: "spelling-example",                description: "You probably meant ``in the instead of ``int he."        }); }

return suggestions;

});

if ((typeof console) != "undefined") { console.info("AdvisorCustom.js loaded"); }