User:Br'er Rabbit/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin is at User:Br'er Rabbit/common.css. |
importScript('User:Lupin/popups.js');
popupFixRedirs=true;
popupRedlinkRemoval=true;
popupFixDabs=true;
importScript('User:Cameltrader/Advisor.js');
//importScript('User:GregU/dashes.js');
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/core.js&action=raw&ctype=text/javascript'); //Imports the "framework" script needed to make this function
//Import individual modules for use
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/unicodify.js&action=raw&ctype=text/javascript'); // autoEdUnicodify() converts HTML entities to WikiText
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/isbn.js&action=raw&ctype=text/javascript'); // autoEdISBN() fixes ISBN syntax so that WikiMagic can work
//importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/whitespace.js&action=raw&ctype=text/javascript'); // autoEdWhitespace() cleans up whitespace
// autoEdWhitespace() cleans up whitespace
//(local copy)
function autoEdWhitespace(str) { //MAIN FUNCTION describes list of fixes
str = str.replace(/\t/g, " ");
// str = str.replace(/^ ? ? \n/gm, "\n");
// str = str.replace(/(\n\n)\n+/g, "$1");
// str = str.replace(/== ? ?\n\n==/g, "==\n==");
// str = str.replace(/\n\n(\* ?\[?http)/g, "\n$1");
// str = str.replace(/^ ? ? \n/gm, "\n");
// str = str.replace(/\n\n\*/g, "\n*");
// str = str.replace(/[ \t][ \t]+/g, " ");
// str = str.replace(/([=\n]\n)\n+/g, "$1");
// str = str.replace(/ \n/g, "\n");
//* bullet points
str = str.replace(/^([\*#]+:*) /gm, "$1");
str = str.replace(/^([\*#]+:*)/gm, "$1 ");
//==Headings==
// str = str.replace(/^(={1,4} )[ ]*([^= ][^=]*[^= ])[ ]*( ={1,4})$/gm, "$1$2$3");
// str = str.replace(/^(={1,4})([^= ][^=]*[^= ])[ ]+(={1,4})$/gm, "$1$2$3");
// str = str.replace(/^(={1,4})[ ]+([^= ][^=]*[^= ])(={1,4})$/gm, "$1$2$3");
return str;
}
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/wikilinks.js&action=raw&ctype=text/javascript'); // autoEdWikilinks() simplifies and shortens wikilinks where appropriate
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/htmltowikitext.js&action=raw&ctype=text/javascript'); // autoEdHTMLtoWikitext() converts HTML to wikitext
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/headlines.js&action=raw&ctype=text/javascript'); // autoEdHeadlines() fixes common headline errors and renames some headers
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/unicodecontrolchars.js&action=raw&ctype=text/javascript'); // autoEdUnicodeControlChars() converts HTML to wikitext
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/unicodehex.js&action=raw&ctype=text/javascript'); // autoEdUnicodeHex() converts hex encoded characters to unicode
//importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/templates.js&action=raw&ctype=text/javascript'); // autoEdTemplates() cleans up templates
function autoEdTemplates(str) { //MAIN FUNCTION describes list of fixes
//Remove unneeded Template: text from transclusions
str = str.replace(/{{[_ ]*Template:[_ ]*/gi, '{{');
//Replace redirects/Reflist with refs
str = str.replace(/{{[_ ]*(?:Reference[_ ]+List|References-Small|Reflink)[_ ]*(\||}})/gi, '{{refs$1');
str = str.replace(/{{[_ ]*(?:Reflist|Reference|Ref-list|Listaref|FootnotesSmall)[_ ]*(\||}})/gi, '{{refs$1');
//Replace a long version of Reflist with Reflist
str = str.replace(/<div[^<>]*[ ]+class=['"]*references-small['"]*[^<>]*>[\r\n]*<references[ ]*\/>[\r\n]*<\/div>/gim, '{{Reflist}}');
//Replace redirects to about with about
str = str.replace(/{{[_ ]*(?:Otheruses4|Four[_ ]+other[_ ]+uses|Otherusesabout|This2)[_ ]*(\||}})/gi, '{{about$1');
return str;
}
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/tablestowikitext.js&action=raw&ctype=text/javascript'); // autoEdTablestoWikitext() replaces HTML tables with wikitables
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/extrabreaks.js&action=raw&ctype=text/javascript'); // autoEdExtraBreaks() removes extra BR tags
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:AutoEd/links.js&action=raw&ctype=text/javascript'); // autoEdLinks() cleans up common link errors
function autoEdFunctions() { //Activates individual modules when "auto ed" tab is clicked
var txt = document.editform.wpTextbox1;
txt.value = autoEdUnicodify(txt.value);
txt.value = autoEdISBN(txt.value);
txt.value = autoEdWhitespace(txt.value);
txt.value = autoEdUnicodeHex(txt.value);
txt.value = autoEdWikilinks(txt.value);
txt.value = autoEdHTMLtoWikitext(txt.value);
txt.value = autoEdHeadlines(txt.value);
txt.value = autoEdUnicodeControlChars(txt.value);
txt.value = autoEdTemplates(txt.value);
txt.value = autoEdTablestoWikitext(txt.value);
txt.value = autoEdExtraBreaks(txt.value);
txt.value = autoEdLinks(txt.value);
}
var SegregateRefsJsAllowConversion = true;
importScript('User:PleaseStand/segregate-refs.js');
importScript('User:Ucucha/HarvErrors.js');
importScript('User:Ucucha/duplinks.js');
importScript('User:Ohconfucius/script/Common Terms.js');
importScript('User:Ohconfucius/script/EngvarB.js');
importScript('User:Ohconfucius/script/MOSNUM dates.js');
addOnloadHook(function ()
{
if (document.forms.editform)
{
addPortletLink('p-tb', 'javascript:Ohc_cite_dates_to_ISO()', 'CITE dates to ISO', 't-ISO', 'ISO day month', '', '');
addPortletLink('p-tb', 'javascript:Ohc_code_delink_dates()', 'delink dates', 't-dmy', 'day month + CT', '', '');
addPortletLink('p-tb', 'javascript:Ohc_protect_dates()', 'protect dates', 't-dmy', 'day month + CT', '', '');
addPortletLink('p-tb', 'javascript:Ohc_remove_leading_zeros_from_nonlinked_dates ()', 'rem leading zeros', 't-dmy', 'day month + CT', '', '');
}
});
importScript('User:Ohconfucius/script/formatgeneral.js');
importScript('User:WOSlinker/hlist.js');
importScript('user:js/urldecoder.js')
var urlDecoderIntLinks = true; //also try to simplify existing [[internal links]] in selected text
importScript('User:Scottywong/diffconverter.js');
// Add [[WP:Reflinks]] launcher in the toolbox on left
addOnloadHook(function () {
addPortletLink(
"p-tb", // toolbox portlet
"http://toolserver.org/~dispenser/cgi-bin/webreflinks.py/" + wgPageName
+ "?client=script&citeweb=on&overwrite=&limit=20&lang=" + wgContentLanguage,
"Reflinks" // link label
)});
importScript('User:Smith609/reftool2.js');