Jump to content

User:Rich Farmbrough/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Rich Farmbrough (talk | contribs) at 22:09, 13 September 2005. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
/* <nowiki> */
function closevfd(bold, notbold){
  var txt = document.editform.wpTextbox1;
  txt.value = "{{subst:vt}} '''" + bold + "'''" + notbold + ". &ndash; ~~~~\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 regexp?");
    if(s){ 
        var r = prompt("Replace regexp?");
        var txt = document.editform.wpTextbox1;
        txt.value = txt.value.replace(new RegExp(s, "g"), r);
    }
}

function spelling(){

  var txt = document.editform.wpTextbox1;
  txt.value = txt.value.replace(/orientate/gm, "orient");
  txt.value = txt.value.replace(/Orientate/gm, "Orient");
  document.forms.editform.wpSummary.value="tweak";
 
}

function slashdates(){
  var txt = document.editform.wpTextbox1;
  txt.value = txt.value.replace(/(\||\s+)(\d\d\d\d)\/(\d\d)\/(\d\d)/gm, "$1[[$4 zz$3zz]] [[$2]]");
  txt.value = txt.value.replace(/(\||\s+)(\d\d)\/(\d\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(/\[\[British\]\]/gim, "[[United Kingdom|British]]");
  txt.value = txt.value.replace(/\[\[British\|/gim, "[[United Kingdom|");
  document.forms.editform.wpSummary.value=document.forms.editform.wpSummary.value+"Disambiguate British - > United Kingdom";

}

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 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.";
}

function dates(){
  var txt = document.editform.wpTextbox1;

  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)(?:[\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)(\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.";

}

function vfdresult(){
    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:Votes for deletion/{{subst:PAGENAME}}]] for a record of the discussion. &ndash; ~~~~';
    txt.focus();
}

function hidevfd(){
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs[x].className.indexOf("vfd") != -1)
            divs[x].style.display = "none";
    document.getElementById('footer').style.display = 'none';
}

function showvfd(){
    var divs = document.getElementsByTagName("div");
    for(var x = 0; x < divs.length; ++x)
        if(divs[x].className.indexOf("vfd") != -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 vfdlinks(){
    if(!document.getElementById) return;
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    addlilink(tabs, 'javascript:hidevfd()', 'hide closed', 'ca-hide');
    addlilink(tabs, 'javascript:showvfd()', '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"), 'purge', '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&section=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&section=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 + '&section=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 + '&section=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(/&section=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 vfddelete(){
    var form = document.forms.deleteconfirm;
    form.wpReason.value = '[[Wikipedia:Votes 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:Votes for deletion") == 0){
        addlilink(tabs, 'javascript:closevfd("keep", "")', 'keep', '');
        addlilink(tabs, 'javascript:closevfd("merge and redirect", " to [[" + prompt("Merge and redirect to?") + "]]")', 'merge', '');
        addlilink(tabs, 'javascript:closevfd("redirect", " to [[" + prompt("Redirect to?") + "]]")', 'redir', '');
        addlilink(tabs, 'javascript:closevfd("transwiki", " to " + prompt("Transwiki to?"))', 'trans', '');
        addlilink(tabs, 'javascript:closevfd("transwiki", " to Wiktionary")', 'wikt', '');
        addlilink(tabs, 'javascript:closevfd("speedy delete", "")', 'speedy', '');
        addlilink(tabs, 'javascript:closevfd("delete", "")', 'del', '');
        addlilink(tabs, 'javascript:closevfd(prompt("Result?"), "")', 'other', '');
        addlilink(tabs, 'javascript:replace()', 'replace', '');
    }else if(document.title.indexOf("Editing ") == 0){
        addlilink(tabs, 'javascript:replace()', 'replace', '');
        addlilink(tabs, 'javascript:dates()', 'd', ''); 
        addlilink(tabs, 'javascript:datesplus()', 'd+', ''); 
        addlilink(tabs, 'javascript:slashdates()', '/', ''); 
        addlilink(tabs, 'javascript:slashdatesm()', 'm/', ''); 
        addlilink(tabs, 'javascript:math()', 'm', ''); 
        addlilink(tabs, 'javascript:british()', 'b', ''); 
        addlilink(tabs, 'javascript:spelling()', 's', ''); 
/*        var s = prompt("Offset: "+document.title.indexOf(":")); */

        if(document.title.indexOf(":") == -1){
        };
        addlilink(tabs, 'javascript:vfdresult()', 'vfd result', '');
    }else if(document.title.indexOf("Confirm delete - Delete") == 0){
        addlilink(tabs, 'javascript:vfddelete()', 'vfd', '');
    }
}

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:Votes for deletion") != -1 && document.title.indexOf("Editing ") != 0) vfdlinks();
    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> */