This is an old revision of this page, as edited by Ohconfucius (talk | contribs) at 06:23, 22 September 2010 (bug fix). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Revision as of 06:23, 22 September 2010 by Ohconfucius (talk | contribs) (bug fix)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)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. |
This user script seems to have a documentation page at User:Ohconfucius/script/MOSNUM dates. |
//NOTE TO SELF: Date parameters in {{dmy/mdy}} template need updating at the start of each month // This script aligns dates into one of two formats allowed by ]. // PLEASE READ THE DOCUMENTATION at ] (click on the link above) before using. // Feedback and constructive criticism are welcome... however, please don't tell me something I know already function Ohc_fix_common_errors() { var txt=document.editform.wpTextbox1; // capitalise month names txt.value=txt.value.replace(/(\s)jan(|uary|\.)(\s)/g, '$1Jan$2$3'); txt.value=txt.value.replace(/(\s)feb(|ruary|\.)(\s)/g, '$1Feb$2$3'); txt.value=txt.value.replace(/(\d\s)mar(|ch|\.)(\s)/g, '$1Mar$2$3'); txt.value=txt.value.replace(/(\s)mar(|ch|\.)(\s\d)/g, '$1Mar$2$3'); txt.value=txt.value.replace(/(\s)apr(|il|\.)(\s)/g, '$1Apr$2$3'); txt.value=txt.value.replace(/(\d\s)may(,|\.)(\s)/g, '$1May$2$3'); txt.value=txt.value.replace(/(\s)may(|\.)(\s\d)/g, '$1May$2$3'); txt.value=txt.value.replace(/(\s)jun(|e|\.)(\s)/g, '$1Jun$2$3'); txt.value=txt.value.replace(/(\s)jul(|y|\.)(\s)/g, '$1Jul$2$3'); txt.value=txt.value.replace(/(\s)aug(|ust|\.)(\s)/g, '$1Aug$2$3'); txt.value=txt.value.replace(/(\s)sep(|tember|\.)(\s)/g, '$1Sep$2$3'); txt.value=txt.value.replace(/(\d{1,2}\s)sept(\s)/g, '$1Sep$2'); txt.value=txt.value.replace(/(\s)oct(|ober|\.)(\s)/g, '$1Oct$2$3'); txt.value=txt.value.replace(/(\s)nov(|ember|\.)(\s)/g, '$1Nov$2$3'); txt.value=txt.value.replace(/(\s)dec(|ember|\.)(\s)/g, '$1Dec$2$3'); //underscore in linked dates - dmy txt.value=txt.value.replace(/(\?\d)_(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\]\])/gi, '$1 $2$3'); //underscore in linked dates - mdy txt.value=txt.value.replace(/(\?\d\]\])/gi, '$1$2 $3'); //remove leading zero from linked date txt.value=txt.value.replace(/(\\])/gi, '$1$2 $3$4'); txt.value=txt.value.replace(/(\\])/gi, '$1$2 $3$4'); //rem redundant spaces (and commas) in date formats txt.value=txt.value.replace(/(\?\d)+(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\]\])?*,*(\?\]?)/gi, '$1 $2$3 $4'); txt.value=txt.value.replace(/(\+(?\d)(\]?\]?)(?:*,*)(\?\]?)/gi, '$1$2 $3$4, $5'); txt.value=txt.value.replace(/(\+(?\d)(\]?\]?)+(\?\]?)/gi, '$1$2 $3$4, $5'); txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?:, | of )(\d{3,4})/gi, '$1 $2'); //repeat after delinking Ohc_protect_dates_in_titles(); //remove unlinked ordinal date formats txt.value=txt.value.replace(/(?:the\s?)?(?\d)(?:th|st|nd|rd|), (?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))()/gi, '$1, $2$3 $4 $5'); txt.value=txt.value.replace(/(?:the\s?)?(?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))()/gi, '$1$2 $3$4'); txt.value=txt.value.replace(/(?:the\s?)?(?\d)(?:th|st|nd|rd|)(?:\sof\s?)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\w\d])/gi, '$1 $2$3'); txt.value=txt.value.replace(/(?:the\s?)?(?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))()/gi, '$1 $2$3'); txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s)?(?\d)(?:th|st|nd|rd|),\s(?:the\s)?(?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s)?(?\d)(?:th|st|nd|rd|)(\|\w\d])/gi, '$1 $2, $3$4 $5$6'); txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s)?(?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s)?(?\d)(?:th|st|nd|rd|)(\|\w\d])/gi, '$1 $2$3$4$5'); txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s)?(?\d)(?:th|st|nd|rd)(\|\w\d])/gi, '$1 $2$3'); //fix 'bda' template redirect txt.value=txt.value.replace(/{{bda\|(+)}}/gi, '{{birth date and age|$1}}'); //zap redundant templates ('date', 'as of', 'English', '#dateformat:') txt.value=txt.value.replace(/\{\{date\|(+)(?:+)?\}\}/gi, '$1'); txt.value=txt.value.replace(/{{#dateformat:(+)(?:\|dmy|\|mdy)?}}/gi,'$1'); } function Ohc_protect_dates_in_titles(){ var txt=document.editform.wpTextbox1; //permanent protection for dmy dates within images txt.value=txt.value.replace(/((?:file|image|img)*{1,30})\s(?\d)(th|st|nd|rd|)(\sof)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(,)?(\s(?:\d{3,4}))?/gi, '$1_$2$3$4_$5$6$7'); txt.value=txt.value.replace(/(\((?:file|image|img)*?\d)(th|st|nd|rd|)(\sof)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(,)?(\s(?:\d{3,4}))?/gi, '$1$2$3_$4$5_$6$7'); txt.value=txt.value.replace(/(?\d)(th|st|nd|rd|)(\sof)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(,)?\s(\d{3,4})(\.jpe?g)/gi, '$1$2$3_$4$5_$6$7'); txt.value=txt.value.replace(/(?\d)(th|st|nd|rd|)(\sof)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\.jpe?g)/gi, '$1$2$3_$4$5'); //protect dmy date formats within titles of citation templates txt.value=txt.value.replace(/(\|*(?:title|work)*=*)((?:?\d)(?:th|st|nd|rd|),?(?:\sof)?)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))({0,30}\|)/gi, '$1$2 $3$4'); //blockquotes txt.value=txt.value.replace(/(<blockquote>+?)((?:?\d)(?:th|st|nd|rd|),?(?:\sof)?)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(,)?\s?(\d{1,4})?(+?<\/blockquote>)/g, '$1$2 $3$4'); //permanent protection for mdy dates within images txt.value=txt.value.replace(/((?:file|image|img)*{1,60})\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s(?\d)(th|st|nd|rd|)(,)?(\s(?:\d{3,4}))?/gi, '$1_$2$3_$4$5$6$7'); txt.value=txt.value.replace(/((?:file|image|img)*)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s(?\d)(th|st|nd|rd|)(,)?(\s(?:\d{3,4}))?/gi, '$1$2$3_$4$5$6$7'); //re-enabled 13 Aug 2010 txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s(?\d)(th|st|nd|rd|)(,)?\s(\d{3,4})(\.(?:png|jpe?g))/gi, '$1$2_$3$4$5_$6$7'); txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s(?\d)(th|st|nd|rd|)(\.png|\.jpe?g)/gi, '$1$2_$3$4$5'); //protect mdy date formats within titles of citation templates txt.value=txt.value.replace(/(\|*(?:title|work|chapter)*=+?)()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s((?:?\d)(?:th|st|nd|rd|))()/gi, '$1$2$3$4 $5$6'); //blockquotes txt.value=txt.value.replace(/(<blockquote>+?)()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s((?:?\d)(?:th|st|nd|rd|),?)\s(\d{1,4})(+?<\/blockquote>)/g, '$1$2$3$4 $5 $6$7'); } function Ohc_code_delink_dates() { var txt=document.editform.wpTextbox1; Ohc_protect_dates (); Ohc_fix_common_errors(); //delink ISO8601 dates txt.value=txt.value.replace(/\\d-\d)\]\]/gi, '$1'); txt.value=txt.value.replace(/\\]-\\d-\d)\]\]/gi, '$1-$2'); txt.value=txt.value.replace(/(\d{4})-\\d-\d)\]\]/gi, '$1-$2'); txt.value=txt.value.replace(/\\]-(\d-\d)/gi, '$1-$2'); //delink full dates - dmy txt.value=txt.value.replace(/(?:the\s)?\?\d)(?:th|st|nd|rd|)(?:of)?(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]\]/gi, '$1 $2'); //delink single md or 'm the dth' txt.value=txt.value.replace(/\(?:the)?(?\d)(?:th|st|nd|rd|)\]\]()/gi, '$1 $2$3'); //Month+day_number "]th" -> "March 7" txt.value=txt.value.replace(/\?\d)\]\](?:th|st|nd|rd)/gi, '$1'); //removal of 'year in foo' in full dates (with or without links) with incorrect ']' txt.value=txt.value.replace(/(\|)\]?\]?),\s\]{1,32}\]\]/gi, '$1 $2'); txt.value=txt.value.replace(/(\|)\]?\]?),\s{{(?:avyear|by|fy|ly|mlb|scy|sdy)\|(\d{1,4})}}/gi, '$1 $2'); txt.value=txt.value.replace(/(\|)\s(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]?\]?)\s\]{1,32}\]\]/gi, '$1 $2'); txt.value=txt.value.replace(/(\|)\s(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]?\]?)\s{{(?:avyear|by|fy|ly|mlb|scy|sdy)\|(\d{1,4})}}/gi, '$1 $2'); //month+day+year piped pseudo-ISO dates txt.value=txt.value.replace(/\?\d)\|?\d-?\d\]\]-(?:\\d\d\d)(\|\d{2,4})?(?:\]\])?/gi, '$1$2, $3'); txt.value=txt.value.replace(/\\d\s(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))\|?\d-?\d\]\]-(?:\\d{3})(\]\])?/gi, '$1 $2'); //month+day piped txt.value=txt.value.replace(/(?:the\s)?\(?:of)?(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\|(]{1,30})\]\]/gi, '$1'); //']Xyyyy ' to 'month day, year' txt.value=txt.value.replace(/\\].(\d{3,4})/gi, '$1 $2, $3'); //']Xyyyy' to 'day month year' txt.value=txt.value.replace(/\\].(\d{3,4})/gi, '$1 $2 $3'); // century txt.value=txt.value.replace(/\\]/gi, '$1$2$3'); txt.value=txt.value.replace(/\(?:century|centuries)(?:\sAD|\sBC|\sCE|\sBCE|)\|(]{1,30})\]\]/gi, '$1'); txt.value=txt.value.replace(/\)(century|centuries)(\sAD|\sBC|\sCE|\sBCE|)\]\]/gi, '$1$2$3'); txt.value=txt.value.replace(/\(?:century|centuries)(?:\sAD|\sBC|\sCE|\sBCE|)\|(]{1,30})\]\]/gi, '$1'); // months txt.value=txt.value.replace(/\\]/gi, '$1'); txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1'); // decades and years txt.value=txt.value.replace(/\\]/g, '$1s'); txt.value=txt.value.replace(/\]{1,30})\]\]/g, '$1'); txt.value=txt.value.replace(/\\]/gi, '$1$2 $3'); txt.value=txt.value.replace(/\?)(AD|BC|CE|BCE|)\]\]/gi, '$1$2'); txt.value=txt.value.replace(/\?)(\d{1,4})\]\]/gi, '$3$2$1'); txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1'); txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1'); //month+year //Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below txt.value=txt.value.replace(/\]+\|((?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s\d{3,4})\]\]/gi, '$1'); txt.value=txt.value.replace(/\\]/gi, '$1'); txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1'); //removed piped years when in full date txt.value=txt.value.replace(/(\\],?\s?\]{1,32}\|(\d{1,4}\]\])/gi, '$1$2'); txt.value=txt.value.replace(/(\\],?\s?\]{1,32}\|(\d{1,4}\]\])/gi, '$1$2'); //Identify surprise or 'Easter egg' diversions linking months to year articles. txt.value=txt.value.replace(/\]+\|(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]\]/gi, '$1'); // month and day piped txt.value=txt.value.replace(/(\d{4,4}-)\\d{1,2}(?:th|st|nd|rd|)\|(\d-)(\d)\]\]/gi, '$10$20$3'); txt.value=txt.value.replace(/(\d{4,4}-)\\d{1,2}(?:th|st|nd|rd|)\|(\d\d-)(\d)\]\]/gi, '$1$20$3'); txt.value=txt.value.replace(/(\d{4,4}-)\\d{1,2}(?:th|st|nd|rd|)\|(\d-)(\d\d)\]\]/gi, '$10$2$3'); txt.value=txt.value.replace(/\\d{1,2}(?:th|st|nd|rd|)\|(]{1,30})\]\]/gi, '$1'); txt.value=txt.value.replace(/\(?:of)?(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\|(]{1,30})\]\]/gi, '$1'); txt.value=txt.value.replace(/\\]/gi, '$1'); //4 digit years piped txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1'); txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?:, | of )(\d{3,4})/gi, '$1 $2'); //repeat removal of commas and 'of' between month and year //double/triple spaces txt.value=txt.value.replace(/(?: ?)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))/gi, ' $1'); txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))( ?)/gi, '$1 '); // spaces and commas - mdy birth and death date ranges txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d),? (\d{1,3}|?\d{3})(?:**)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d),? (\d{1,3}|?\d{3})()/gi, '$1$2 $3, $4 – $5 $6, $7$8'); //dmy birth and death date ranges) txt.value=txt.value.replace(/()(?\d)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),? (\d{1,3}|?\d{3})(?:\s?\s?)(?\d)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),? (\d{1,3}|?\d{3})()/gi, '$1$2 $3 $4 – $5 $6 $7$8'); } function Ohc_delink_ISO_to_dmy() { var txt = document.editform.wpTextbox1; txt.value = yyyymmdd_to_dmy(txt.value); // See User:Plastikspork/datetools.js txt.value=txt.value.replace(/()(\d{4}-\d\d-\d\d)(<\s?\/ref.*?>)/g, '$1$2 $3'); //code to convert ref ISO-dates outside citation templates txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-01-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 January $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-02-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 February $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-03-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 March $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-04-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 April $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-05-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 May $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-06-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 June $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-07-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 July $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-08-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 August $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-09-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 September $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-10-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 October $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-11-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 November $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-12-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 December $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-01-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 January $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-02-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 February $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-03-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 March $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-04-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 April $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-05-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 May $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-06-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 June $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-07-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 July $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-08-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 August $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-09-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 September $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-10-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 October $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-11-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 November $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-12-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 December $3$5$6'); Ohc_remove_leading_zeros_from_nonlinked_dates (); } function Ohc_delink_ISO_to_mdy() { var txt = document.editform.wpTextbox1; txt.value = yyyymmdd_to_mdy(txt.value); // See User:Plastikspork/datetools.js txt.value=txt.value.replace(/()(\d{4}-\d\d-\d\d)(<\s?\/ref.*?>)/g, '$1$2 $3'); //code to convert ref ISO-dates outside citation templates txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-01-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2January $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-02-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2February $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-03-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2March $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-04-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2April $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-05-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2May $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-06-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2June $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-07-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2July $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-08-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2August $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-09-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2September $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-10-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2October $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-11-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2November $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-12-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2December $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-01-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2January $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-02-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2February $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-03-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2March $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-04-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2April $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-05-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2May $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-06-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2June $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-07-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2July $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-08-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2August $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-09-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2September $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-10-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2October $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-11-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2November $4, $3$5$6'); txt.value=txt.value.replace(/(<\s?ref.*?>+?)()(\d{4})-12-(\d)()(*?<\s?\/ref.*?>)/g, '$1$2December $4, $3$5$6'); Ohc_remove_leading_zeros_from_nonlinked_dates (); } function Ohc_delink_year_in_X(){ var txt=document.editform.wpTextbox1; txt.value=txt.value.replace(/{{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|(\d{1,4})}}/gi, '$1'); txt.value=txt.value.replace(/{{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|(?:\d{1,4})\|(\d{1,4})}}/gi, '$1'); txt.value=txt.value.replace(/\+\|(\d{1,4})\]\]/gi, '$1'); txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1'); txt.value=txt.value.replace(/\\]/gi, '$1$2'); } var linkmap=; function Ohc_protect_dates(){ var txt=document.editform.wpTextbox1; txt.value=txt.value.replace(/Image:+/gi, function(img){ linkmap.push(img); return "\x02"+(linkmap.length-1)+"\x03"; }); //protect certain dates txt.value=txt.value.replace(/(\[\[4)(AD)/gi, '$1♫$2'); txt.value=txt.value.replace(/(March )((?:8|14) Alliance)/gi, '$1♫$2'); txt.value=txt.value.replace(/(6th\sof\s)(October City)/gi, '$1♫$2'); txt.value=txt.value.replace(/(\\])/gi, '$1 in France|May 1968$2'); txt.value=txt.value.replace(/(\\])/gi, '$1♫$2'); //June 1, 1974 is the name of an album txt.value=txt.value.replace(/(\'\'June )(1, 1974\'\')/gi, '$1♫$2'); txt.value=txt.value.replace(/(\\])/gi, '$1♫$2'); } function Ohc_unprotect_dates(){ var txt=document.editform.wpTextbox1; //unprotect certain dates txt.value=txt.value.replace(/(\[\[4)♫(AD)/gi, '$1♫$2'); txt.value=txt.value.replace(/(\[\[(?:8|14))♫(March Alliance)/gi, '$1$2'); txt.value=txt.value.replace(/(6th\sof\s)♫(October City)/gi, '$1$2'); txt.value=txt.value.replace(/(June )♫(1, 1974)/gi, '$1$2'); txt.value=txt.value.replace(/(\\])/gi, '$1 $2'); txt.value=txt.value.replace(/\x02(+)\x03/g, function(x, n){ return linkmap; }); } function Ohc_remove_leading_zeros_from_nonlinked_dates () { var txt=document.editform.wpTextbox1; //remove leading zero from nonlinked date txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d)(?:th|st|nd|rd|),?\s(\d{4})(|*\r)/gi, '$1$2 $3, $4$5'); txt.value=txt.value.replace(/()0(\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{4})(|*\r)/gi, '$1$2 $3 $4$5'); txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d)(?:th|st|nd|rd|)(|*\r)/gi, '$1$2 $3$4'); txt.value=txt.value.replace(/()0(\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$2 $3$4'); } function Ohc_dates_to_dmy(){ var txt=document.editform.wpTextbox1; // insert 'dmy' template txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|mdy)(\|*)?}}/gi, '{{Use dmy dates|date=September 2010}}'); if (txt.value.search(/{{use dmy dates|date=September 2010}}/gi) == -1) { txt.value='{{Use dmy dates|date=September 2010}}\r\n'+txt.value; } Ohc_code_delink_dates(); //repeat protect dates because 'unprotect dates' function is within 'delink dates' function Ohc_protect_dates(); //change start and end templates txt.value=txt.value.replace(/({{(start\sdate|end\sdate)*\|)df=ye?s?\|(*df=ye?s?)/gi, '$1$2'); //change deprecated birth and death templates txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*)\|mf=ye?s?/gi, '$1'); txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*\|)/gi, '$1df=yes|'); txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*\|)df=ye?s?\|(*df=ye?s?)/gi, '$1$2'); //convert mdy-mdy to dmy-dmy (birth and death date ranges) txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d), (?\d{0,3})(?:\s?\s?)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d), (?\d{0,3})()/gi, '$1$3 $2 $4 – $6 $5 $7$8'); //convert md-mdy date ranges to dm-dmy txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?\s?|\s(?:and|to|&)\s)(?\d)(?:th|st|nd|rd|),?\s(?:of\s)?(\d{3,4})/gi, '$1$3$4$5$6 $2 $7'); //test code txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),? (?\d)(?:th|st|nd|rd|),?\s(?:of\s)?(\d{3,4})/gi, '$1$3$4, $5 $2$6'); txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}), (?\d)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3$4, $5 $2$6'); //convert md,d,d, date ranges to d,d,dm (multiple, separated by commas) txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?\s?|\s(?:and|to|&)\s)(?\d)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3$4$5$6 $2$7'); txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))((?:\s?\d(?:th|st|nd|rd|),?){1,6})(\s(?:and|to|&)\s)(?\d)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3$4$5 $2$6'); txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){1,6})(|*\r)/gi, '$1$3$4 $2$5'); //convert md date ranges to dm (simple, separated by hyphens and dashes or 'to') txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)(\s?\s?|\sto\s)(?\d)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3 $4$5 $2$6'); //'md, md,' to 'dm, dm,' txt.value=txt.value.replace(/()( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( ?\d),( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( ?\d)()/gi, '$1$3$2,$5$4,$6'); //convert simple mdy dates to dmy txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|),?\s(\d{1,4}\s?(?:AD|BC|CE|BCE))/gi, '$1$3 $2 $4'); txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|),?\s(\d{3,4})(|*\r)/gi, '$1$3 $2 $4$5'); txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3 $2$4'); //Repeat line to capture some instances that get missed first time //(needed because the date component 'September 19, 1881' within the string 'March 4-September 19, 1881' is blocked from conversion by the '4') txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|),?\s(\d{1,4})(|*\r)/gi, '$1$3 $2 $4$5'); //Month+day_number " 7th March" -> "7 March" txt.value=txt.value.replace(/()(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{1,4})(|*\r)/gi, '$1$2 $3 $4$5'); txt.value=txt.value.replace(/()(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$2 $3$4'); Ohc_remove_leading_zeros_from_nonlinked_dates (); //remove comma in International date format txt.value=txt.value.replace(/(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?),?\s?(\d{3,4})()/gi, '$1 $2 $3$4'); Ohc_unprotect_dates(); } function Ohc_dates_to_mdy(){ var txt=document.editform.wpTextbox1; // insert 'mdy' template txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|dmy)(\|*)?}}/gi, '{{Use mdy dates|date=September 2010}}'); if (txt.value.search(/{{use mdy dates|date=September 2010}}/gi) == -1) { txt.value='{{Use mdy dates|date=September 2010}}\r\n'+txt.value; } Ohc_code_delink_dates(); //repeat protect dates because 'unprotect dates' function is within 'delink dates' function Ohc_protect_dates(); //change deprecated birth and death templates txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*)\|df=ye?s?/gi, '$1'); // txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*\|)/gi, '$1mf=yes|'); txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)*\|)mf=ye?s?\|(*mf=ye?s?)/gi, '$1$2'); //convert dmy-dmy to mdy-mdy (birth and death date ranges) txt.value=txt.value.replace(/()(?\d)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),? (?\d{0,3})(?:\s?\s?)(?\d)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),? (?\d{0,3})()/gi, '$1$3 $2, $4 – $6 $5, $7$8'); //convert dm-dmy date ranges to md-mdy txt.value=txt.value.replace(/()((?:?\d)(?:th|st|nd|rd|),\s){0,6}(?\d)(?:th|st|nd|rd|)(\/|{0,3}(?:and|to|&|-|–){0,3})(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{3,4})/gi, '$1$6 $2$3$4$5, $7'); //convert d,d,dm date ranges to md,d,d (multiple, separated by commas) txt.value=txt.value.replace(/()((?:?\d(?:th|st|nd|rd|),?\s){0,6})(?\d)(?:th|st|nd|rd|)(\/|{0,3}(?:and|to|&|-|–){0,3})(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$6 $2$3$4$5$7'); txt.value=txt.value.replace(/()((?:?\d(?:th|st|nd|rd|),?{1,3}){1,6})(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$4 $2$3$5'); //convert dm date ranges to md (simple, separated by hyphen, dash or 'to') txt.value=txt.value.replace(/()(?\d)(?:th|st|nd|rd|)({0,3}{0,3}|\sto{0,3})(?\d)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$5 $2$3$4$6'); //'dm, dm,' to 'md, md,' txt.value=txt.value.replace(/()( ?\d)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))),( ?\d)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))(?)/gi, '$1$3$2,$5$4,$6'); txt.value=txt.value.replace(/()(?\d)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),?\s(\d{1,4}\s?(?:AD|BC|CE|BCE))/gi, '$1$3 $2, $4'); txt.value=txt.value.replace(/()(?\d)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)),?\s(\d{3,4})(|*\r)/gi, '$1$3 $2, $4$5'); txt.value=txt.value.replace(/()(?\d)(?:th|st|nd|rd|){1,3}(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$3 $2$4'); //repeat previous two bits of code to capture some date ranges that were missed first time round // txt.value=txt.value.replace(/()(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d{1,4})(|*\r)/gi, '$1$3 $2, $4$5'); // txt.value=txt.value.replace(/()(?\d)(?:th|st|nd|rd|)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(|*\r)/gi, '$1$3 $2$4'); //Month+day_number "March 7th" -> "March 7" txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd)(|*\r)/gi, '$1$2 $3$4'); //add comma when missing txt.value=txt.value.replace(/()(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?\d)(?:th|st|nd|rd|)(\s\d{1,4})/gi, '$1$2 $3,$4'); Ohc_remove_leading_zeros_from_nonlinked_dates (); Ohc_unprotect_dates(); } function Ohc_MOSNUM_edit_summary(){ // Add a tag to the summary box var txt=document.editform.wpSummary; var summary = "], rem ]"; if (txt.value.indexOf(summary) == -1) { if (txt.value.match(/?\s*$/)) { txt.value += " , "; } txt.value += summary; } document.forms.editform.wpMinoredit.checked = true; document.editform.wpDiff.click(); } function yyyymmdd_to_dmy(str) { // This code from User:Plastikspork/datetools.js str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 January $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 February $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 March $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 April $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 May $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 June $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 July $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 August $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 September $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 October $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 November $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 December $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 January $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 February $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 March $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 April $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 May $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 June $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 July $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 August $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 September $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 October $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 November $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1$3 December $2'); return str; } function yyyymmdd_to_mdy(str) { // This code from User:Plastikspork/datetools.js str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1January $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1February $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1March $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1April $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1May $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1June $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1July $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1August $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1September $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1October $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1November $3, $2'); str=str.replace(/(\|*(?:date|archivedate)*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1December $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1January $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1February $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1March $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1April $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1May $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1June $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1July $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1August $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1September $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1October $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1November $3, $2'); str=str.replace(/(\|*accessdate*=*)(?:\{3})(?:\]\]-\|)(?:\]\])?/gi, '$1December $3, $2'); return str; } function Ohc_all_dates_to_dmy() { Ohc_dates_to_dmy(); Ohc_delink_ISO_to_dmy(); Ohc_delink_year_in_X(); Ohc_MOSNUM_edit_summary(); } function Ohc_all_dates_to_mdy() { Ohc_dates_to_mdy(); Ohc_delink_ISO_to_mdy(); Ohc_delink_year_in_X(); Ohc_MOSNUM_edit_summary(); } function Ohc_body_to_dmy() { Ohc_dates_to_dmy(); Ohc_MOSNUM_edit_summary(); } function Ohc_body_to_mdy() { Ohc_dates_to_mdy(); Ohc_MOSNUM_edit_summary(); } function Ohc_ISO_to_dmy() { Ohc_delink_ISO_to_dmy(); // Ohc_MOSNUM_edit_summary(); } function Ohc_ISO_to_mdy() { Ohc_delink_ISO_to_mdy(); // Ohc_MOSNUM_edit_summary(); } addOnloadHook(function () { if(document.forms.editform) { addPortletLink('p-tb', 'javascript:Ohc_all_dates_to_dmy()', 'All dates to dmy', 'ca-unitfixer', 'Fixes some unit formatting', '', ''); addPortletLink('p-tb', 'javascript:Ohc_all_dates_to_mdy()', 'All dates to mdy', 'ca-unitfixer', 'Fixes some unit formatting', '', ''); addPortletLink('p-tb', 'javascript:Ohc_body_to_dmy()', 'Body dates to dmy', 't-dmy', 'day month', '', ''); addPortletLink('p-tb', 'javascript:Ohc_body_to_mdy()', 'Body dates to mdy', 't-mdy', 'month day', '', ''); addPortletLink('p-tb', 'javascript:Ohc_ISO_to_dmy()', 'ISO to dmy', 't-ISOdmy', 'ISO day month', '', ''); addPortletLink('p-tb', 'javascript:Ohc_ISO_to_mdy()', 'ISO to mdy', 't-ISOmdy', 'ISO month day', '', ''); addPortletLink('p-tb', 'javascript:Ohc_delink_year_in_X()' , 'Del year-in-X dates', 't-yearinX', 'Year in X', '', ''); } });