Benutzer:Rich Farmbrough/monobook.js
Erscheinungsbild
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
// [[:En:User:Lupin/popups.js]]
mw.loader.load(
'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s');
/* <pre> <nowiki> */
addOnloadHook(function (){
if (location.href.indexOf('Special:Watchlist') == -1) return; //Are we on a watchlist?
//days = document.getElementById('bodyContent').getElementsByTagName('ul');
days = document.evaluate( //Hell knows how it works - found in "Dive into Greasemonkey"
"//ul[@class='special']",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (d = 0; d < days.snapshotLength; d++) { //For each day
day = days.snapshotItem(d);
newday = document.createElement('ul'); //This will replace the old listing
while ((diffs = day.getElementsByTagName('li')).length > 0) { //Are there any diffs left?
//Try to extract the namespace
As = diffs[0].getElementsByTagName('a');
if (As[0].innerHTML == 'diff')
pagename = As[2].innerHTML;
else
pagename = As[1].innerHTML;
if (pagename.indexOf(':') == -1)
namespace = 'Main';
else
namespace = pagename.split(':')[0]; //This will fail for articles which contain ":" in name
hdrs = newday.getElementsByTagName('h5'); //Get the list of namespace headers
hdr = null;
for (j=0; j<hdrs.length; j++) //Find the header
if (hdrs[j].innerHTML==namespace) {
hdr = hdrs[j]; break;
}
if (hdr==null) { //Not found? Make a new one!
hdr = document.createElement('h5');
hdr.innerHTML = namespace;
newday.appendChild(hdr);
namespacesub = document.createElement('ul');
newday.appendChild(namespacesub);
}
hdr.nextSibling.appendChild(diffs[0]); //Move the diff
}
newday.appendChild(document.createElement('hr')); //For readablility
day.parentNode.replaceChild(newday,day);
}
});
function closeafd(bold, notbold){
var txt = document.editform.wpTextbox1;
txt.value = "{{subst:vt}} '''" + bold + "'''" + notbold + ". – ~~~~\n" + txt.value + "\n{{subst:vb}}\n";
txt = document.editform.wpSummary;
txt.value = "close discussion: " + bold + notbold;
document.editform.wpWatchthis.checked = false;
}
function replace(){
var s = prompt("Search reg exp?");
if(s){
var r = prompt("Replace reg exp?");
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(new RegExp(s, "g"), r);
}
}
msg="Ced ";
insist=0;
diff=1;
preview=0;
submit=0;
function always(){
var txt = document.editform.wpTextbox1;
temp=txt.value;
txt.value = txt.value.replace(/ (==+)$/gm, "$1");
txt.value = txt.value.replace(/^(==+) /gm, "$1");
/* txt.value = txt.value.replace(/^(==+)\s*external\s*link\s*(==+)$/gim, "$1External links$1"); */
if (temp==txt.value) {return;}
document.forms.editform.wpSummary.value=msg;
if (diff==1) {document.editform.wpDiff.click();}
/* else if (preview==1) {document.editform.wpPreview.click();} */
else if (submit==1) {document.forms.editform.submit();}
}
function spelling(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/\[\[\$\]\]/gm, "$");
txt.value = txt.value.replace(/(\W[Mm]ast)e(rbate\W)/gm, "$1u$2");
txt.value = txt.value.replace(/(\n)=/gm, "$1==");
txt.value = txt.value.replace(/=(\n)/gm, "==$1");
document.forms.editform.wpSummary.value=document.forms.editform.wpSummary.value + "Header levels";
document.editform.wpDiff.click();
}
function decomma(){
var txt = document.editform.wpTextbox1;
/* txt.value = txt.value.replace(/\[\[(.*)? (.*)?\]\]/g,"[[$1 $2]]");
txt.value = txt.value.replace(/\[\[ /g,"[[");
txt.value = txt.value.replace(/ \]\]/g,"]]");
*/
txt.value = txt.value.replace(/ ==$/gm, "==");
txt.value = txt.value.replace(/^== /gm, "==");
/* Pull text inside piped link */
txt.value = txt.value.replace(/\[\[([^\]\|]+)\|([^\]\|]+)\]\]([A-Za-z\'])([\w\d]*)([\.\,\;\:\"\!\?\s]+)/gm, "[[$1|$2$3$4]]$5");
/*De-pipe if possible */
txt.value = txt.value.replace(/\[\[([^\]\|]+)\|\1([^\]\|\-\'\s]*)\]\]/gm, "[[$1]]$2");
document.forms.editform.wpSummary.value="Simplified wikilink.";
document.editform.wpDiff.click();
/* document.forms.editform.submit(); */
}
function normcase(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/ (==+)$/gm, "$1");
txt.value = txt.value.replace(/^(==+) /gm, "$1");
txt.value = txt.value.replace( /(==\s*\"*[\w])(.*==)/ig ,
function($0,$1,$2) {
return($1.toUpperCase()+$2.toLowerCase());
}
)
document.forms.editform.wpSummary.value="Correct caps in section header.";
document.editform.wpDiff.click();
/* document.forms.editform.submit(); */
}
function census(){
var txt = document.editform.wpTextbox1;
// Convert ° into ° symbol
txt.value = txt.value.replace(/°/g, '°');
txt.value = txt.value.replace(/º/g, '°');
// Convert &sup into superscript ² symbol
txt.value = txt.value.replace(/²/g, '²');
txt.value = txt.value.replace(/³/g, '³');
// Convert the word ohm(s) or the html entity into the actual Ω symbol (Omega, not the actual ohm symbol Ω) and make sure it's spaced
txt.value = txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?\s?(Ω|ohm|Ohm)s?([\s,.\/\)])/g, '$1 $2Ω$4');
// Convert various micro symbols into the actual micro symbol, make sure it's spaced
txt.value = txt.value.replace(/(\d)\s?(μ|μ|µ)(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|Ω|F|Wb|T|H|S|Bq|Gy|Sv|kat|°C|M)([\s,.\/\)])/g, '$1 µ$3$4');
// Convert capital K to lowercase k in units
txt.value = txt.value.replace(/(\d)\s?K(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|Ω|F|Wb|T|H|S|Bq|Gy|Sv|kat|°C|M)([\s,.\/\)])/g, '$1 k$2$3');
// Fix common spelling error
txt.value = txt.value.replace(/celcius/gi, 'Celsius');
// Capitalize units correctly
txt.value = txt.value.replace(/(\d)\s?(khz)([\s,.\/\)])/gi, '$1 kHz$3');
txt.value = txt.value.replace(/(\d)\s?(mhz)([\s,.\/\)])/gi, '$1 MHz$3');
txt.value = txt.value.replace(/(\d)\s?(ghz)([\s,.\/\)])/gi, '$1 GHz$3');
txt.value = txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?(hz|HZ)([\s,.\/\)])/g, '$1 $2Hz$4');
txt.value = txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?(pa|PA)([\s,.\/\)])/g, '$1 $2Pa$4');
// Fix kilometres
txt.value = txt.value.replace(/(\d)\s?(kms)([\s,.\/\)])/gi, '$1 km$3');
txt.value = txt.value.replace(/(\d)\s?(km)([\s,.\/\)])/gi, '$1 km$3');
// Standardise kilometres per hour and add space
txt.value = txt.value.replace(/(\d)\s?(km\/hr)([\s,.\/\)])/gi, '$1 km/h$3');
txt.value = txt.value.replace(/(\d)\s?(kph)([\s,.\/\)])/gi, '$1 km/h$3');
txt.value = txt.value.replace(/(\d)\s?(kmph)([\s,.\/\)])/gi, '$1 km/h$3');
// txt.value = txt.value.replace(/(\d)\s?(kmh)([\s,.\/\)])/gi, '$1 km/h$3');
// txt.value = txt.value.replace(/(\d)\s?(km\/h)([\s,.\/\)])/gi, '$1 km/h$3');
// Space before horsepower symbol
txt.value = txt.value.replace(/(\d)\s?(hp)([\s,.@])/gi, '$1 hp$3');
txt.value = txt.value.replace(/(\d)\s?(bhp)([\s,.@])/gi, '$1 bhp$3');
txt.value = txt.value.replace(/(\d)\s?(shp)([\s,.@])/gi, '$1 shp$3');
// Space before other units
txt.value = txt.value.replace(/(\d)\s?(cc)([\s,.\/\)])/gi, '$1 cc$3');
txt.value = txt.value.replace(/(\d)\s?(ml)([\s,.\/\)])/gi, '$1 ml$3');
txt.value = txt.value.replace(/(\d)\s?(mm)([\s,.\/\)])/gi, '$1 mm$3');
txt.value = txt.value.replace(/(\d)\s?(km)([\s,.\/\)])/gi, '$1 km$3');
// Standardise miles per hour and rpm
txt.value = txt.value.replace(/(\d)\s?(m.p.h.)([\s,.\/\)])/gi, '$1 mph$3');
txt.value = txt.value.replace(/(\d)\s?(mph)([\s,.\/\)])/gi, '$1 mph$3');
txt.value = txt.value.replace(/(\d) (mph)([\s,.\/\)])/gi, '$1 mph$3');
txt.value = txt.value.replace(/(\d)\s?(rpm)([\s,.\/\)])/gi, '$1 rpm$3');
txt.value = txt.value.replace(/(\d) (rpm)([\s,.\/\)])/gi, '$1 rpm$3');
// Standardise symbol for pounds
txt.value = txt.value.replace(/(\d)\s?lbs/gi, '$1 lb');
txt.value = txt.value.replace(/(\d\+?)\s?lbs/gi, '$1 lb');
txt.value = txt.value.replace(/(\d lb)s/gi, '$1');
txt.value = txt.value.replace(/(\d)\s?(\[\[lbs\]\])/gi, '$1 \[\[Pound (mass)|lb\]\]');
// Standardise symbol for foot pounds
txt.value = txt.value.replace(/(\d)\s?(ft[ -.•\/]lb[fs])/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d)\s?(lb[fs][ -.•\/]ft)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d)\s?(lb[ -.•\/]ft)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d)\s?(ft[ -.•\/]lb)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d) (lb[fs][ -.•\/]ft)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d) (ft[ -.•\/]lb[fs])/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d) (lb[ -.•\/]ft)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d) (ft[ -.•\/]lb)/gi, '$1 ft·lbf');
// Symbols for feet and inches
txt.value = txt.value.replace(/([^;°]\s?\s?)(\d{1,4})\s?(['’])\s?(\d{1,2})\s?(["”])/gi, '$1$2 ft $4 in');
//txt.value = txt.value.replace(/([:=\/\(])\s*(\d{1,3)\s?(['’])\s?(1?\d)\s?(["”])/gi, '$1$2 ft $4 in');
//txt.value = txt.value.replace(/(1?\d)\s?(["”])/gi, '$1 in');
//txt.value = txt.value.replace(/(eight[:= ]{1,2})\s?(\d)-(\d{1,2})([\s,.\/\)])/gi, '$1 $2 ft $3 in');
// Give digital value a percent symbol '%' instead of word
txt.value = txt.value.replace(/(\d)[\s?-]per *cent([^aei])/gi, '$1%$2');
// Add a space before dB or B
txt.value = txt.value.replace(/(\d)\s?(dB|B)\b/g, '$1 $2');
// Add a space before any units that were missed before
txt.value = txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|n|p|f|a|z|y)?(g|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|Ω|F|Wb|T|H|S|Bq|Gy|Sv|kat|°C|°F|M)([\s,.\\/)])/g, '$1 $2$3$4');
// Separate one for seconds since they give a lot of false positives like "1970s". Only difference is mandatory prefix.
txt.value = txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|n|p|f|a|z|y)(s)([\s,.\/\)])/g, '$1 $2$3$4');
// bps or b/s or bits/s --> bit/s
txt.value = txt.value.replace(/([KkMmGgTtPpEeYyZz])(bps|bits?\/s|b\/s)/g, ' $1bit/s');
txt.value = txt.value.replace(/(\d)\s?(bps)/gi, '$1 bit/s');
// Bps or byte/s or bytes/s --> B/s
txt.value = txt.value.replace(/([KkMmGgTtPpEeYyZz])(Bps|bytes?\/s)/g, ' $1B/s');
// After that, make capitalization correct
txt.value = txt.value.replace(/K(bit|B)\/s/g, 'k$1/s');
txt.value = txt.value.replace(/m(bit|B)\/s/g, 'M$1/s');
txt.value = txt.value.replace(/g(bit|B)\/s/g, 'G$1/s');
txt.value = txt.value.replace(/t(bit|B)\/s/g, 'T$1/s');
txt.value = txt.value.replace(/e(bit|B)\/s/g, 'E$1/s');
txt.value = txt.value.replace(/y(bit|B)\/s/g, 'Y$1/s');
txt.value = txt.value.replace(/z(bit|B)\/s/g, 'Z$1/s');
// Common error
txt.value = txt.value.replace(/mibi(bit|byte)/g, 'mebi$1');
// Add a tag to the summary box
var txt = document.editform.wpSummary;
var summary = "units";
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt.value += " | ";
}
txt.value += summary;
}
// Press the diff button to check it
document.editform.wpDiff.click()
}
function slashdates(){
var txt = document.editform.wpTextbox1;
/*Note a leading colon could well be an "EasyTimeline" */
txt.value = txt.value.replace(/(\)|\>|\*|\||\(|\'|=|\s+)(\d\d\d\d)\/([0|1|2]?\d)\/([0|1|2|3]?\d)/gm, "$1[[$4 zz$3zz]] [[$2]]");
txt.value = txt.value.replace(/(\)|\>|\*|\||\(|\'|=|\s+)([0|1|2|3]?\d)\/([0|1|2]?\d)\/(\d\d\d\d)/gm, "$1[[$2 zz$3zz]] [[$4]]");
txt.value = txt.value.replace(/\[\[0(\d) zz/gm, "[[$1 zz");
txt.value = txt.value.replace(/zz0(\d)zz/gm, "zz$1zz");
txt.value = txt.value.replace(/zz1zz/gm, "January");
txt.value = txt.value.replace(/zz2zz/gm, "February");
txt.value = txt.value.replace(/zz3zz/gm, "March");
txt.value = txt.value.replace(/zz4zz/gm, "April");
txt.value = txt.value.replace(/zz5zz/gm, "May");
txt.value = txt.value.replace(/zz6zz/gm, "June");
txt.value = txt.value.replace(/zz7zz/gm, "July");
txt.value = txt.value.replace(/zz8zz/gm, "August");
txt.value = txt.value.replace(/zz9zz/gm, "September");
txt.value = txt.value.replace(/zz10zz/gm, "October");
txt.value = txt.value.replace(/zz11zz/gm, "November");
txt.value = txt.value.replace(/zz12zz/gm, "December");
document.forms.editform.wpSummary.value=document.forms.editform.wpSummary.value+"Wikify date(s).";
}
function slashdatesm(){ /* month day year - pox. */
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/(\)|\>|\*|\||\(|\'|=|\s+)(\d+)\/(\d+)\/(\d\d\d\d)/gm, "$1[[$3 zz$2zz]] [[$4]]");
txt.value = txt.value.replace(/\[\[0(\d) zz/gm, "[[$1 zz");
txt.value = txt.value.replace(/zz0(\d)zz/gm, "zz$1zz");
txt.value = txt.value.replace(/zz1zz/gm, "January");
txt.value = txt.value.replace(/zz2zz/gm, "February");
txt.value = txt.value.replace(/zz3zz/gm, "March");
txt.value = txt.value.replace(/zz4zz/gm, "April");
txt.value = txt.value.replace(/zz5zz/gm, "May");
txt.value = txt.value.replace(/zz6zz/gm, "June");
txt.value = txt.value.replace(/zz7zz/gm, "July");
txt.value = txt.value.replace(/zz8zz/gm, "August");
txt.value = txt.value.replace(/zz9zz/gm, "September");
txt.value = txt.value.replace(/zz10zz/gm, "October");
txt.value = txt.value.replace(/zz11zz/gm, "November");
txt.value = txt.value.replace(/zz12zz/gm, "December");
document.forms.editform.wpSummary.value=document.forms.editform.wpSummary.value+"Wikify date(s).";
}
function british(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/\[\[Old English\]\]/gim, "[[Old English language|Old English]]");
txt.value = txt.value.replace(/\[\[Old English\|/gim, "[[Old English language|");
txt.value = txt.value.replace(/\[\[British\]\]/gim, "[[United Kingdom|British]]");
txt.value = txt.value.replace(/\[\[British\|/gim, "[[United Kingdom|");
txt.value = txt.value.replace(/\[\[United kingdom\]\]/gim, "[[United Kingdom]]");
txt.value = txt.value.replace(/\[\[United kingdom\|/gim, "[[United Kingdom|"); document.forms.editform.wpSummary.value=document.forms.editform.wpSummary.value+"dab/red UK/OE.";
}
function math(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/\\binom\s*\{([^\}]*)\}\s*\{([^\}]*)\}/gim, "{ $1 \\choose $2 }");
txt.value = txt.value.replace(/\$\s*(.*?)\s*\$/gim, "\<math\>$1\<\/math\>");
txt.value = txt.value.replace(/\\displaystyle/gim, "");
txt.value = txt.value.replace(/\\partial/gim, "\\part");
txt.value = txt.value.replace(/\\end\{array\}/gim, "\\end{matrix}");
txt.value = txt.value.replace(/\\begin\{array\}\s*\(11\)/gim, "\\begin{matrix}");
txt.value = txt.value.replace(/\\rvert/gim, "|");
txt.value = txt.value.replace(/\\lvert/gim, "|");
txt.value = txt.value.replace(/\.\<\/math\>/gim, "\<\/math\>\.");
txt.value = txt.value.replace(/\,\<\/math\>/gim, "\<\/math\>\,");
txt.value = txt.value.replace(/\\mbox/gim, "");
txt.value = txt.value.replace(/\\mathscr/gim, "");
txt.value = txt.value.replace(/“/gim, "\"");
txt.value = txt.value.replace(/”/gim, "\"");
txt.value = txt.value + "<br>{{planetmath|id=|title=}} "
txt.value = txt.value + "[[Category:combinatorics]]"
document.forms.editform.wpSummary.value="Import from Planet Math";
}
function bold(){
var txt = document.editform.wpTextbox1;
/* var title = document.title.value;
txt.value = txt.value.replace(/\<\/b\>/gim, "'''");
*/
txt.value = txt.value.replace(/\<\/b\>/gim, "'''");
txt.value = txt.value.replace(/\<\/i\>/gim, "''");
txt.value = txt.value.replace(/\<b\>/gim, "'''");
txt.value = txt.value.replace(/\<i\>/gim, "''");
document.forms.editform.wpSummary.value=document.forms.editform.wpSummary.value+"Bold/Italics";
}
function datesplus(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(
/(\[\[\d*\s*(?:January|February|March|April|May|June|July|August|September|October|November|December)\s*\d*\]\])[,]*\s*(\d{4})/gim,
"$1 [[$2]]");
document.forms.editform.wpSummary.value=document.forms.editform.wpSummary.value+" Wikify dates(year part)";
}
function dates(){
var txt = document.editform.wpTextbox1;
/*
if (document.forms.editform.wpSummary.value=="Wikify dates") {
document.forms.editform.submit();
}
else
*/
if(txt.value.indexOf("opyvio") == -1){
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(January|February|March|April|May|June|July|August|September|October|November|December)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 $3]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(January|February|March|April|May|June|July|August|September|October|November|December)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$2 $3]] [[$4]]");
txt.value = txt.value.replace(/([^=\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s)(January|February|March|April|May|June|July|August|September|October|November|December)(\W+)/gim, "$1[[$2 $3]]$4");
txt.value = txt.value.replace(/([^=\[\d])(January|February|March|April|May|June|July|August|September|October|November|December)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$2 $3]]$4");
/* The xxx th of yyy */
txt.value =
txt.value.replace(/(?:the)?(?:\s)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd)?(?:\s*of\s*)(January|February|March|April|May|June|July|August|September|October|November|December)(?:[\s,]*)(\d{3,4})/gim, "[[$1 $2]] [[$3]]");
txt.value =
txt.value.replace(/(?:the)?(?:\s)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd)?(?:\s*of\s*)(January|February|March|April|May|June|July|August|September|October|November|December)(\W+)/gim, "[[$1 $2]]$3");
/* xx th of yyy
txt.value =
txt.value.replace(/([^=\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(January|February|March|April|May|June|July|August|September|October|November|December)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 $3]] [[$4]]");
txt.value =
txt.value.replace(/([^=\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s*of\s*)(January|February|March|April|May|June|July|August|September|October|November|December)(\W+)/gim, "$1[[$2 $3]]$4");
*/
/* jan.... */
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Jan\.?|January)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 January]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Jan\.?|January)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 January]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Jan\.?|January)(\W+)/gim, "$1[[$2 January]]$4");
txt.value = txt.value.replace(/([^\[\d])(Jan\.?|January])(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 January]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Feb)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 February]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Feb\.?|February)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 February]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Feb)(\W+)/gim, "$1[[$2 February]]$4");
txt.value = txt.value.replace(/([^\[\d])(Feb\.?|February)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 February]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Mar)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 March]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Mar\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 March]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Mar)(\W+)/gim, "$1[[$2 March]]$4");
txt.value = txt.value.replace(/([^\[\d])(Mar\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 March]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Apr)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 April]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Apr\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 April]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Apr)(\W+)/gim, "$1[[$2 April]]$4");
txt.value = txt.value.replace(/([^\[\d])(Apr\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 April]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Jun)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 June]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Jun\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 June]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Jun)(\W+)/gim, "$1[[$2 June]]$4");
txt.value = txt.value.replace(/([^\[\d])(Jun\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 June]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Jul)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 July]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Jul\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 July]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Jul)(\W+)/gim, "$1[[$2 July]]$4");
txt.value = txt.value.replace(/([^\[\d])(Jul\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 July]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Aug)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 August]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Aug\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 August]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Aug)(\W+)/gim, "$1[[$2 August]]$4");
txt.value = txt.value.replace(/([^\[\d])(Aug\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 August]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Sep|Sept)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 September]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Sep\.?|Sept\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 September]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Sep|Sept)(\W+)/gim, "$1[[$2 September]]$4");
txt.value = txt.value.replace(/([^\[\d])(Sep\.?|Sept\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 September]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Oct)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 October]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Oct\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 October]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Oct)(\W+)/gim, "$1[[$2 October]]$4");
txt.value = txt.value.replace(/([^\[\d])(Oct\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 October]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Nov)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 November]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Nov\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 November]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Nov)(\W+)/gim, "$1[[$2 November]]$4");
txt.value = txt.value.replace(/([^\[\d])(Nov\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 November]]$4");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s*)(Dec)(?:[\s,]*)(\d{3,4})/gim, "$1[[$2 December]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(Dec\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|st|rd|nd|)(?:[\s,]+)(\d{3,4})/gim, "$1[[$3 December]] [[$4]]");
txt.value = txt.value.replace(/([^\[\d])(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:\s*)(?:th|rd|st|nd|)(?:\s)(Dec)(\W+)/gim, "$1[[$2 December]]$4");
txt.value = txt.value.replace(/([^\[\d\_])(Dec\.?)(?:\s*)(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)(?:th|rd|st|nd|)([^\w])/gi, "$1[[$3 December]]$4");
document.forms.editform.wpSummary.value=document.forms.editform.wpSummary.value+"Wikify dates";
document.editform.wpDiff.click();
/*document.forms.editform.submit(); */
} /* if not a copyvio */
}
function capitals(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/([\.|\n]) +a/gm, "$1 A");
txt.value = txt.value.replace(/([\.|\n]) +b/gm, "$1 B");
txt.value = txt.value.replace(/([\.|\n]) +c/gm, "$1 C");
txt.value = txt.value.replace(/([\.|\n]) +d/gm, "$1 D");
txt.value = txt.value.replace(/([\.|\n]) +e/gm, "$1 E");
txt.value = txt.value.replace(/([\.|\n]) +f/gm, "$1 F");
txt.value = txt.value.replace(/([\.|\n]) +g/gm, "$1 G");
txt.value = txt.value.replace(/([\.|\n]) +h/gm, "$1 H");
txt.value = txt.value.replace(/([\.|\n]) +i/gm, "$1 I");
txt.value = txt.value.replace(/([\.|\n]) +j/gm, "$1 J");
txt.value = txt.value.replace(/([\.|\n]) +k/gm, "$1 K");
txt.value = txt.value.replace(/([\.|\n]) +l/gm, "$1 L");
txt.value = txt.value.replace(/([\.|\n]) +m/gm, "$1 M");
txt.value = txt.value.replace(/([\.|\n]) +n/gm, "$1 N");
txt.value = txt.value.replace(/([\.|\n]) +o/gm, "$1 O");
txt.value = txt.value.replace(/([\.|\n]) +p/gm, "$1 P");
txt.value = txt.value.replace(/([\.|\n]) +q/gm, "$1 Q");
txt.value = txt.value.replace(/([\.|\n]) +r/gm, "$1 R");
txt.value = txt.value.replace(/([\.|\n]) +s/gm, "$1 S");
txt.value = txt.value.replace(/([\.|\n]) +t/gm, "$1 T");
txt.value = txt.value.replace(/([\.|\n]) +u/gm, "$1 U");
txt.value = txt.value.replace(/([\.|\n]) +v/gm, "$1 V");
txt.value = txt.value.replace(/([\.|\n]) +w/gm, "$1 W");
txt.value = txt.value.replace(/([\.|\n]) +x/gm, "$1 X");
txt.value = txt.value.replace(/([\.|\n]) +y/gm, "$1 Y");
txt.value = txt.value.replace(/([\.|\n]) +z/gm, "$1 Z");
document.forms.editform.wpSummary.value+=" Caps";
}
function dewikifydates() {
var txt = document.editform.wpTextbox1;
// century
txt.value = txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th))[ -](century)\]\]/gi, '$1 century');
txt.value = txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ -]century\|(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ -]century\|(\d{1,2}(?:st|nd|rd|th)[ -]century)\]\]/gi, '$1 century');
txt.value = txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ -]century\|(\d{1,2}(?:st|nd|rd|th))[ -](centuries)\]\]/gi, '$1 centuries');
// decades
txt.value = txt.value.replace(/\[\[(\d{1,4}s)\]\]/gi, '$1');
// months
txt.value = txt.value.replace(/\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[January\|(Jan)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[February\|(Feb)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[March\|(Mar)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[April\|(Apr)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[May\|(May)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[June\|(Jun)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[July\|(Jul)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[August\|(Aug)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[September\|(Sep)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[October\|(Oct)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[November\|(Nov)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[December\|(Dec)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d{3,4})\]\]/gi, '$1');
// days of the week including optional plurals
txt.value = txt.value.replace(/\[\[(Mondays?|Tuesdays?|Wednesdays?|Thursdays?|Fridays?|Saturdays?|Sundays?)\]\]/gi, '$1');
// days of the week but leave out 'Sun' as potentially valid link to the Sun
txt.value = txt.value.replace(/\[\[(Mon|Tue|Tues|Wed|Thu|Thur|Thurs|Fri|Sat)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[Mondays?\|(Mondays?)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[Tuesdays?\|(Tuesdays?)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[Wednesdays?\|(Wednesdays?)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[Thursdays?\|(Thursdays?)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[Fridays?\|(Fridays?)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[Saturdays?\|(Saturdays?)\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[Sundays?\|(Sundays?)\]\]/gi, '$1');
// ranked days
txt.value = txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1');
// misconfigured
txt.value = txt.value.replace(/\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}\|(\d{1,2})\]\]/gi, '$1');
// year
//BC etc
txt.value = txt.value.replace(/\[\[(\d{1,4} (?:AD|BC|CE|BCE))\]\]/gi, '$1');
txt.value = txt.value.replace(/\[\[\d{1,4} (?:AD|BC|CE|BCE)\|(\d{1,4})\]\]/gi, '$1');
//4 digits years piped into 2
txt.value = txt.value.replace(/\[\[\d{1,4}\|(\d{1,2})\]\]/gi, '$1');
var x=0;
while (x<3) {x++;
//year: text on left, avoid links on right
txt.value = txt.value.replace(/([\w\(\);:.\*\|\&]\s?,?\-?\s?)\[\[(\d{1,4})\]\]([^\[]{4})/gi, '$1$2$3');
//year pair: text on left, avoid links on right
txt.value = txt.value.replace(/([\w\(\);:.\*\|\&]\s?,?\-?\s?)\[\[(\d{1,4})\]\](.?.?.?.?.?.?)\[\[(\d{1,4})\]\]([^\[]{4})/gi, '$1$2$3$4$5');
//year:avoid links on left, text on right
txt.value = txt.value.replace(/([^\]]{4})\[\[(\d{1,4})\]\](\s?,?\-?\s?[\w\(\);:.\*\|\&])/gi, '$1$2$3');
//year pair: avoid links on left, text on right
txt.value = txt.value.replace(/([^\]]{4})\[\[(\d{1,4})\]\](.?.?.?.?.?.?)\[\[(\d{1,4})\]\](\s?,?\-?\s?[\w\(\);:.\*\|\&])/gi, '$1$2$3$4$5');
//year:avoid links on both sides
txt.value = txt.value.replace(/([^\]]{4})\[\[(\d{1,4})\]\]([^\[]{4})/gi, '$1$2$3');
//year pair: avoid links on both sides
txt.value = txt.value.replace(/([^\]]{4})\[\[(\d{1,4})\]\](.?.?.?.?.?.?)\[\[(\d{1,4})\]\]([^\[]{4})/gi, '$1$2$3$4$5');
//year: last character in link on left is not month or digit, avoid links on right
txt.value = txt.value.replace(/([^yhletr\d]\]\]\s?,?\-?\s?)\[\[(\d{1,4})\]\]([^\[]{4})/gi, '$1$2$3');
//year pair: last character in link on left is not month or digit, avoid links on right
txt.value = txt.value.replace(/([^yhletr\d]\]\]\s?,?\-?\s?)\[\[(\d{1,4})\]\](.?.?.?.?.?.?)\[\[(\d{1,4})\]\]([^\[]{4})/gi, '$1$2$3$4$5');
//year: avoid links on left, first character in link on right is not month or digit
txt.value = txt.value.replace(/([^\]]{4})\[\[(\d{1,4})\]\](\s?,?\-?\s?\[\[[^jfmasond\d])/gi, '$1$2$3');
//year pair: avoid links on left, first character in link on right is not month or digit
txt.value = txt.value.replace(/([^\]]{4})\[\[(\d{1,4})\]\](.?.?.?.?.?.?)\[\[(\d{1,4})\]\](\s?,?\-?\s?\[\[[^jfmasond\d])/gi, '$1$2$3$4$5');
//year: last character in link on left is not month or digit, first character in link on right is not month or digit
txt.value = txt.value.replace(/([^yhletr\d]\]\]\s?,?\-?\s?)\[\[(\d{1,4})\]\](\s?,?\-?\s?\[\[[^jfmasond\d])/gi, '$1$2$3');
//year pair: last character in link on left is not month or digit, first character in link on right is not month or digit
txt.value = txt.value.replace(/([^yhletr\d]\]\]\s?,?\-?\s?)\[\[(\d{1,4})\]\](.?.?.?.?.?.?)\[\[(\d{1,4})\]\](\s?,?\-?\s?\[\[[^jfmasond\d])/gi, '$1$2$3$4$5');
}
// Add a tag to the summary box
var txt = document.editform.wpSummary;
var summary = "Date fragments delinked.";
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt.value += " ";
}
txt.value += summary;
}
// Press the diff button to check it
document.editform.wpDiff.click()
}
function cardinals(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/ 10( |\. |\, )/gm, " ten$1");
txt.value = txt.value.replace(/ 11( |\. |\, )/gm, " eleven$1");
txt.value = txt.value.replace(/ 12( |\. |\, )/gm, " twelve$1");
txt.value = txt.value.replace(/ 13( |\. |\, )/gm, " thirteen$1");
txt.value = txt.value.replace(/ 14( |\. |\, )/gm, " fourteen$1");
txt.value = txt.value.replace(/ 15( |\. |\, )/gm, " fifteen$1");
txt.value = txt.value.replace(/ 16( |\. |\, )/gm, " sixteen$1");
txt.value = txt.value.replace(/ 17( |\. |\, )/gm, " seventeen$1");
txt.value = txt.value.replace(/ 18( |\. |\, )/gm, " eighteen$1");
txt.value = txt.value.replace(/ 19( |\. |\, )/gm, " nineteen$1");
txt.value = txt.value.replace(/ 20( |\. |\, )/gm, " twenty$1");
txt.value = txt.value.replace(/ 30( |\. |\, )/gm, " thirty$1");
txt.value = txt.value.replace(/ 40( |\. |\, )/gm, " forty$1");
txt.value = txt.value.replace(/ 50( |\. |\, )/gm, " fifty$1");
txt.value = txt.value.replace(/ 60( |\. |\, )/gm, " sixty$1");
txt.value = txt.value.replace(/ 70( |\. |\, )/gm, " seventy$1");
txt.value = txt.value.replace(/ 80( |\. |\, )/gm, " eighty$1");
txt.value = txt.value.replace(/ 90( |\. |\, )/gm, " ninety$1");
txt.value = txt.value.replace(/ 100( |\. |\, )/gm, " one hundred$1");
txt.value = txt.value.replace(/ 2(\d)( |\. |\, )/gm, " twenty $1$2");
txt.value = txt.value.replace(/ 3(\d)( |\. |\, )/gm, " thirty $1$2");
txt.value = txt.value.replace(/ 4(\d)( |\. |\, )/gm, " forty $1$2");
txt.value = txt.value.replace(/ 5(\d)( |\. |\, )/gm, " fifty $1$2");
txt.value = txt.value.replace(/ 6(\d)( |\. |\, )/gm, " sixty $1$2");
txt.value = txt.value.replace(/ 7(\d)( |\. |\, )/gm, " seventy $1$2");
txt.value = txt.value.replace(/ 8(\d)( |\. |\, )/gm, " eighty $1$2");
txt.value = txt.value.replace(/ 9(\d)( |\. |\, )/gm, " ninety $1$2");
txt.value = txt.value.replace(/ 1( |\. |\, )/gm, " one$1");
txt.value = txt.value.replace(/ 2( |\. |\, )/gm, " two$1");
txt.value = txt.value.replace(/ 3( |\. |\, )/gm, " three$1");
txt.value = txt.value.replace(/ 4( |\. |\, )/gm, " four$1");
txt.value = txt.value.replace(/ 5( |\. |\, )/gm, " five$1");
txt.value = txt.value.replace(/ 6( |\. |\, )/gm, " six$1");
txt.value = txt.value.replace(/ 7( |\. |\, )/gm, " seven$1");
txt.value = txt.value.replace(/ 8( |\. |\, )/gm, " eight$1");
txt.value = txt.value.replace(/ 9( |\. |\, )/gm, " nine$1");
document.forms.editform.wpSummary.value += " cardinals";
}
function ordinals(){
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/ 10th/gm, " tenth");
txt.value = txt.value.replace(/ 11th/gm, " eleventh");
txt.value = txt.value.replace(/ 12th/gm, " twelfth");
txt.value = txt.value.replace(/ 13th/gm, " thirteenth");
txt.value = txt.value.replace(/ 14th/gm, " fourteenth");
txt.value = txt.value.replace(/ 15th/gm, " fifteenth");
txt.value = txt.value.replace(/ 16th/gm, " sixteenth");
txt.value = txt.value.replace(/ 17th/gm, " seventeenth");
txt.value = txt.value.replace(/ 18th/gm, " eighteenth");
txt.value = txt.value.replace(/ 19th/gm, " nineteenth");
txt.value = txt.value.replace(/ 20th/gm, " twentieth");
txt.value = txt.value.replace(/ 30th/gm, " thirtieth");
txt.value = txt.value.replace(/ 40th/gm, " fortieth");
txt.value = txt.value.replace(/ 50th/gm, " fiftieth");
txt.value = txt.value.replace(/ 60th/gm, " sixtieth");
txt.value = txt.value.replace(/ 70th/gm, " seventieth");
txt.value = txt.value.replace(/ 80th/gm, " eightieth");
txt.value = txt.value.replace(/ 90th/gm, " ninetieth");
txt.value = txt.value.replace(/ 2(\d)(st|nd|rd|th)/gm, " twenty $1$2");
txt.value = txt.value.replace(/ 3(\d)(st|nd|rd|th)/gm, " thirty $1$2");
txt.value = txt.value.replace(/ 4(\d)(st|nd|rd|th)/gm, " forty $1$2");
txt.value = txt.value.replace(/ 5(\d)(st|nd|rd|th)/gm, " fifty $1$2");
txt.value = txt.value.replace(/ 6(\d)(st|nd|rd|th)/gm, " sixty $1$2");
txt.value = txt.value.replace(/ 7(\d)(st|nd|rd|th)/gm, " seventy $1$2");
txt.value = txt.value.replace(/ 8(\d)(st|nd|rd|th)/gm, " eighty $1$2");
txt.value = txt.value.replace(/ 9(\d)(st|nd|rd|th)/gm, " ninety $1$2");
txt.value = txt.value.replace(/ 1st/gm, " first");
txt.value = txt.value.replace(/ 2nd/gm, " second");
txt.value = txt.value.replace(/ 3rd/gm, " third");
txt.value = txt.value.replace(/ 4th/gm, " fourth");
txt.value = txt.value.replace(/ 5th/gm, " fifth");
txt.value = txt.value.replace(/ 6th/gm, " sixth");
txt.value = txt.value.replace(/ 7th/gm, " seventh");
txt.value = txt.value.replace(/ 8th/gm, " eighth");
txt.value = txt.value.replace(/ 9th/gm, " ninth");
document.forms.editform.wpSummary.value += " ordinals";
}
function afdresult(){
var res = prompt("Result?");
if(!res) return;
document.editform.wpSummary.value = 'VFD result - ' + res.replace(/'/g, '');
var txt = document.editform.wpTextbox1;
if(txt.value.length > 0) txt.value += '\n';
txt.value += '==VFD==\nOn [[DAY MONTH]] [[2005]], this article was nominated for deletion. The result was ' + res + '. See [[Wikipedia:Articles for deletion/{{subst:PAGENAME}}]] for a record of the discussion. – ~~~~';
txt.focus();
}
function hideafd(){
var divs = document.getElementsByTagName("div");
for(var x = 0; x < divs.length; ++x)
if(divs[x].className.indexOf("afd") != -1)
divs[x].style.display = "none";
document.getElementById('footer').style.display = 'none';
}
function showafd(){
var divs = document.getElementsByTagName("div");
for(var x = 0; x < divs.length; ++x)
if(divs[x].className.indexOf("afd") != -1)
divs[x].style.display = "";
document.getElementById('footer').style.display = '';
}
function addlilink(tabs, url, name, id){
var na = document.createElement('a');
na.href = url;
na.id = id;
na.appendChild(document.createTextNode(name));
var li = document.createElement('li');
li.appendChild(na);
tabs.appendChild(li);
return li;
}
function afdlinks(){
if(!document.getElementById) return;
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlilink(tabs, 'javascript:hideafd()', 'hide closed', 'ca-hide');
addlilink(tabs, 'javascript:showafd()', 'show closed', 'ca-show');
}
function addPurge(){
ta['ca-purge'] = ['g', 'Purge the internal cache for this page'];
if(!document.getElementById) return;
var x = document.getElementById('ca-history');
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(!x) return;
if(x.children) x = x.children[0];
else x = x.childNodes[0];
addlilink(tabs, x.href.replace(/=history/, "=purge"), 'pge', 'ca-purge');
}
function addEditSection0(){
ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
if(!document.getElementById) return;
var x = document.getElementById('ca-edit');
if(!x) return;
var y = document.createElement('LI');
y.id = 'ca-edit-0';
if(x.className == 'selected'){
if(/&action=edit§ion=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected';
} else {
x.className = 'selected istalk';
}
} else if(x.className == 'selected istalk'){
if(/&action=edit§ion=0$/.test(window.location.href)){
x.className = 'istalk';
y.className = 'selected istalk';
} else {
y.className = 'istalk';
}
} else {
y.className = x.className;
x.className = 'istalk';
}
var z = document.createElement('A');
if(x.children){
z.href = x.children[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
}else{
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
}
}
function changeLinks(){
if(!document.getElementById) return;
document.getElementById('pt-mytalk').firstChild.innerHTML = 'talk';
document.getElementById('pt-watchlist').firstChild.innerHTML = 'watchlist';
document.getElementById('pt-mycontris').firstChild.innerHTML = 'contributions';
}
function addForceSummary(){
if(!/&action=edit/.test(window.location.href)) return;
if(/§ion=new/.test(window.location.href)) return;
if(!document.forms.editform) return;
/* document.forms.editform.wpSave.onclick = forceSummary;*/
}
function forceSummary(){
if(!document.forms.editform.wpSummary.value.replace(/^(?:\/\\*.*\\*\/)? *(.*) *$/,'$1')){
var r = prompt('Are you sure you want to submit without adding a summary?\nTo add a summary, type it in the box below:',document.forms.editform.wpSummary.value);
if(r == null) return false;
document.forms.editform.wpSummary.value = r;
}
return true;
}
function afddelete(){
var form = document.forms.deleteconfirm;
form.wpReason.value = '[[Wikipedia:Articles for deletion/' + unescape(window.location.href.replace(/^.*\?title=([^&]+)&action=delete.*$/, '$1').replace(/_/g, ' ')) + ']]';
form.wpConfirm.checked = true;
}
function morelinks(){
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
if(document.title.indexOf("Editing Wikipedia:Articles for deletion") == 0){
addlilink(tabs, 'javascript:closeafd("keep", "")', 'keep', '');
addlilink(tabs, 'javascript:closeafd("merge and redirect", " to [[" + prompt("Merge and redirect to?") + "]]")', 'merge', '');
addlilink(tabs, 'javascript:closeafd("redirect", " to [[" + prompt("Redirect to?") + "]]")', 'redir', '');
addlilink(tabs, 'javascript:closeafd("transwiki", " to " + prompt("Transwiki to?"))', 'trans', '');
addlilink(tabs, 'javascript:closeafd("transwiki", " to Wiktionary")', 'wikt', '');
addlilink(tabs, 'javascript:closeafd("speedy delete", "")', 'speedy', '');
addlilink(tabs, 'javascript:closeafd("delete", "")', 'del', '');
addlilink(tabs, 'javascript:closeafd(prompt("Result?"), "")', 'other', '');
addlilink(tabs, 'javascript:replace()', 'replace', '');
}else if(document.title.indexOf("Editing ") == 0){
addlilink(tabs, 'javascript:replace()', '/r', '');
addlilink(tabs, 'javascript:bold()', 'bl', '');
addlilink(tabs, 'javascript:decomma()', ',', '');
addlilink(tabs, 'javascript:normcase()', '.', '');
addlilink(tabs, 'javascript:census()', '2', '');
addlilink(tabs, 'javascript:dates()', 'd', 't');
addlilink(tabs, 'javascript:datesplus()', '+', '');
addlilink(tabs, 'javascript:dewikifydates()', '-', '');
addlilink(tabs, 'javascript:slashdates()', '/', '');
addlilink(tabs, 'javascript:slashdatesm()', 'm/', '');
addlilink(tabs, 'javascript:math()', 'm', '');
addlilink(tabs, 'javascript:british()', 'b', '');
addlilink(tabs, 'javascript:spelling()', 's', '');
addlilink(tabs, 'javascript:capitals()', 'C', '');
addlilink(tabs, 'javascript:ordinals()', 'st', '');
addlilink(tabs, 'javascript:cardinals()', '1', '');
if(document.title.indexOf(":") == -1){
if(document.title.indexOf("/") == -1){
if (document.forms.editform.wpSummary.value == msg && insist==1) {document.forms.editform.submit();}
else if (document.forms.editform.wpSummary.value != msg) {always();}
}
};
addlilink(tabs, 'javascript:afdresult()', 'afd rst', '');
}else if(document.title.indexOf("Confirm delete - Delete") == 0){
addlilink(tabs, 'javascript:afddelete()', 'afd', '');
}
}
function addToolBoxLinks(){
var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0];
addlilink(tb, '/wiki/Special:Newpages', 'New pages', '');
addlilink(tb, '/wiki/Special:Shortpages', 'Short pages', '');
}
function myLoadFuncs(){
addPurge();
addEditSection0();
changeLinks();
addForceSummary();
if(document.title.indexOf("Wikipedia:Articles for deletion") != -1 && document.title.indexOf("Editing ") != 0) afdlinks();
morelinks();
addToolBoxLinks();
if(document.title.indexOf("Confirm delete - Delete") == 0)
addVfdLink();
}
if (window.addEventListener) window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent) window.attachEvent("onload",myLoadFuncs);
else{
window._old_ABCD_onload = window.onload;
window.onload = function(){
window._old_ABCD_onload();
myLoadFuncs();
}
}
/* </nowiki> </pre>*/