Jump to content

User:AlanM1/autoEdLoader.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Forked from [[Wikipedia:AutoEd/complete.js]]

var sEnWiki = ((location.protocol === 'https:') ? 'https:' : 'http:') + 
				'//en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=';
var sAutoEd = sEnWiki + 'Wikipedia:AutoEd/';

//Import individual modules for use
//mw.loader.load(sAutoEd + 'unicodify.js');			// 0 autoEdUnicodify() converts HTML entities to WikiText
mw.loader.load(sAutoEd + 'isbn.js');				// 1 autoEdISBN() fixes ISBN syntax so that WikiMagic can work
mw.loader.load(sAutoEd + 'whitespace.js');			// 2 autoEdWhitespace() cleans up whitespace
//mw.loader.load(sAutoEd + 'unicodehex.js');		// 3 autoEdUnicodeHex() converts hex encoded characters to unicode
mw.loader.load(sAutoEd + 'wikilinks.js');			// 4 autoEdWikilinks() simplifies and shortens wikilinks where appropriate
mw.loader.load(sAutoEd + 'htmltowikitext.js');		// 5 autoEdHTMLtoWikitext() converts HTML to wikitext
mw.loader.load(sAutoEd + 'headlines.js');			// 6 autoEdHeadlines() fixes common headline errors and renames some headers
mw.loader.load(sAutoEd + 'unicodecontrolchars.js'); // 7 autoEdUnicodeControlChars() converts HTML to wikitext
mw.loader.load(sAutoEd + 'templates.js');			// 8 autoEdTemplates() cleans up templates
//mw.loader.load(sAutoEd + 'tablestowikitext.js');	// 9 autoEdTablestoWikitext() replaces HTML tables with wikitables
mw.loader.load(sAutoEd + 'extrabreaks.js');			// A autoEdExtraBreaks() removes extra BR tags
mw.loader.load(sAutoEd + 'links.js');				// B autoEdLinks() cleans up common link errors
mw.loader.load(sEnWiki + 'User:AlanM1/dashes.js');	// C fixDashesMain() fixes dashes

function autoEdFunctions() { //Activates individual modules when "auto ed" tab is clicked
    var txt = document.editform.wpTextbox1;
//    txt.value = autoEdUnicodify(txt.value);			// 0
    txt.value = autoEdISBN(txt.value);					// 1
    txt.value = autoEdWhitespace(txt.value);			// 2
//    txt.value = autoEdUnicodeHex(txt.value);			// 3
    txt.value = autoEdWikilinks(txt.value);				// 4
    txt.value = autoEdHTMLtoWikitext(txt.value);		// 5
    txt.value = autoEdHeadlines(txt.value);				// 6
    txt.value = autoEdUnicodeControlChars(txt.value);	// 7
    txt.value = autoEdTemplates(txt.value);				// 8
//    txt.value = autoEdTablestoWikitext(txt.value);	// 9
    txt.value = autoEdExtraBreaks(txt.value);			// A
    txt.value = autoEdLinks(txt.value);					// B
    txt.value = fixDashesMain(txt.value);				// C
}

mw.loader.load(sAutoEd + 'core.js'); //Imports the "framework" script needed to make this function