Revision as of 22:19, 31 October 2010 view sourceOhconfucius (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers328,951 edits November← Previous edit |
Revision as of 03:20, 6 November 2010 view source Ohconfucius (talk | contribs)Autopatrolled, Extended confirmed users, Pending changes reviewers328,951 edits tweaksNext edit → |
Line 4: |
Line 4: |
|
// PLEASE READ THE DOCUMENTATION at ] (click on the link above) before using. |
|
// 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 |
|
// Feedback and constructive criticism are welcome |
|
|
|
|
|
function Ohc_fix_common_errors() { |
|
function Ohc_fix_common_errors() { |
|
var txt=document.editform.wpTextbox1; |
|
var txt=document.editform.wpTextbox1; |
|
|
|
|
|
|
protect_dates_in_titles(); |
|
// 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 |
|
//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'); |
|
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'); |
Line 37: |
Line 21: |
|
//rem redundant spaces (and commas) in date formats |
|
//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)+(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|30|31)(\]?\]?)(?:*,*)(\\d{2,3}(\sAD|\sBC|\sCE|\sBCE|)\]?\]?)/gi, '$1$2 $3$4, $5'); |
|
txt.value=txt.value.replace(/(\+(?\d)(\]?\]?)+(\?\]?)/gi, '$1$2 $3$4, $5'); |
|
txt.value=txt.value.replace(/(\+(?\d|30|31)(\]?\]?)+(\?\]?)/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 |
|
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(); |
|
Ohc_protect_dates_in_titles(); |
|
//remove unlinked ordinal date formats |
|
//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|), (?\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|)(\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'); |
Line 65: |
Line 49: |
|
|
|
|
|
//permanent protection for dmy dates within images |
|
//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)*{1,30})\s(?\d|30|31)(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(/((?:file|image|img)*{1,30})\s(?\d|30|31)(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(/(\((?: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|30|31)(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'); |
|
txt.value=txt.value.replace(/(?\d|30|31)(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 |
|
//protect dmy date formats within titles of citation templates |
|
txt.value=txt.value.replace(/(\|*(?:title|work|quote)*=*)((?:?\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'); |
|
txt.value=txt.value.replace(/(\|*(?:title|work|quote)*=*)((?:?\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|\.|))(*?\|)/gi, '$1$2 $3$4'); |
|
//blockquotes |
|
//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'); |
|
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'); |
Line 78: |
Line 64: |
|
|
|
|
|
//permanent protection for mdy dates within images |
|
//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)*{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|30|31)(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(/((?: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|30|31)(th|st|nd|rd|)(,)?\s(\d{3,4})/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|)(,)?\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'); |
|
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|30|31)(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|30|31)(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|30|31)(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|30|31)(th|st|nd|rd|)(\.png|\.jpe?g)/gi, '$1$2_$3$4$5'); |
|
|
|
|
|
//protect mdy date formats within titles of citation templates |
|
//protect mdy date formats within titles of citation templates |
|
txt.value=txt.value.replace(/(\|*(?:title|work|quote|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'); |
|
txt.value=txt.value.replace(/(\|*(?:title|work|quote|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 |
|
//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'); |
|
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'); |
|
|
|
|
|
|
|
|
} |
|
} |
|
|
|
|
Line 102: |
Line 91: |
|
txt.value=txt.value.replace(/\\]-(\d-\d)/gi, '$1-$2'); |
|
txt.value=txt.value.replace(/\\]-(\d-\d)/gi, '$1-$2'); |
|
|
|
|
|
//delink full dates - dmy |
|
//delink full dates |
|
⚫ |
txt.value=txt.value.replace(/\?\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 $3'); |
|
|
|
|
⚫ |
txt.value=txt.value.replace(/\?\d)(?:th|st|nd|rd|)(?:\]\],? \\]/gi, '$1 $2, $3'); |
|
|
|
|
|
//delink single dm or 'dth the m' |
|
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'); |
|
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'); |
|
|
|
|
Line 112: |
Line 106: |
|
|
|
|
|
//removal of 'year in foo' in full dates (with or without links) with incorrect ']' |
|
//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\]{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{{(?: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\]{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'); |
|
// 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 |
|
//month+day+year piped pseudo-ISO dates |
Line 179: |
Line 173: |
|
|
|
|
|
// spaces and commas - mdy birth and death date ranges |
|
// 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'); |
|
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|30|31),? (\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|30|31),? (\d{1,3}|?\d{3})()/gi, '$1$2 $3, $4 – $5 $6, $7$8'); |
|
//dmy birth and death date ranges) |
|
//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'); |
|
txt.value=txt.value.replace(/()(?\d|30|31)\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|30|31)\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'); |
|
|
|
|
|
} |
|
} |
Line 191: |
Line 185: |
|
txt.value=txt.value.replace(/()(\d{4}-\d\d-\d\d)(<\s?\/ref.*?>)/g, '$1$2 $3'); |
|
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 |
|
//code to convert ref ISO-dates outside citation templates and between ref tags |
|
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})-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})-02-0(\d)()(*?<\s?\/ref.*?>)/g, '$1$2$4 February $3$5$6'); |
Line 262: |
Line 256: |
|
var txt=document.editform.wpTextbox1; |
|
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|npby|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(/{{(?:avyear|npby|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(/\+\|(\d{1,4})\]\]/gi, '$1'); |
|
txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1'); |
|
txt.value=txt.value.replace(/\]{1,30})\]\]/gi, '$1'); |
|
|
|
|
|
txt.value=txt.value.replace(/\\]/gi, '$1$2'); |
|
txt.value=txt.value.replace(/\\]/gi, '$1$2'); |
|
|
|
|
|
|
|
|
} |
|
} |
Line 281: |
Line 274: |
|
//protect certain dates |
|
//protect certain dates |
|
txt.value=txt.value.replace(/(\[\[4)(AD)/gi, '$1♫$2'); |
|
txt.value=txt.value.replace(/(\[\[4)(AD)/gi, '$1♫$2'); |
|
⚫ |
txt.value=txt.value.replace(/(\\])/gi, '$1♫$2'); |
|
txt.value=txt.value.replace(/(March )((?:8|14) Alliance)/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 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(/(\\])/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(/(\'\'June )(1, 1974\'\')/gi, '$1♫$2'); |
|
txt.value=txt.value.replace(/(\\])/gi, '$1♫$2'); |
|
txt.value=txt.value.replace(/(26th\sof\s)(July Movement)/gi, '$1♫$2'); |
|
⚫ |
txt.value=txt.value.replace(/(6th\sof\s)(October City)/gi, '$1♫$2'); |
|
} |
|
} |
|
|
|
|
Line 294: |
Line 288: |
|
//unprotect certain dates |
|
//unprotect certain dates |
|
txt.value=txt.value.replace(/(\[\[4)♫(AD)/gi, '$1♫$2'); |
|
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(/(\\])/gi, '$1 $2'); |
|
⚫ |
txt.value=txt.value.replace(/(\[\[March )♫((?:8|14) Alliance)/gi, '$1$2'); |
|
⚫ |
txt.value=txt.value.replace(/(June )♫(1, 1974)/gi, '$1$2'); |
|
⚫ |
txt.value=txt.value.replace(/(26th\sof\s)♫(July Movement)/gi, '$1$2'); |
|
txt.value=txt.value.replace(/(6th\sof\s)♫(October City)/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(/(\w)♫(\w)/g, '$1$2'); //remove any spurious protection markers |
|
txt.value=txt.value.replace(/(\w)♫(\w)/g, '$1$2'); //2010-10-06 quick patch to remove any spurious protection markers |
|
|
txt.value=txt.value.replace(/\x02(+)\x03/g, function(x, n){ |
|
txt.value=txt.value.replace(/\x02(+)\x03/g, function(x, n){ |
|
return linkmap; |
|
return linkmap; |
Line 319: |
Line 315: |
|
var txt=document.editform.wpTextbox1; |
|
var txt=document.editform.wpTextbox1; |
|
// insert 'dmy' template |
|
// insert 'dmy' template |
|
txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|mdy)(\|*)?}}/gi, '{{Use dmy dates|date=November 2010}}'); |
|
txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|dmy)(\|*)?}}/gi, '{{Use dmy dates|date=November 2010}}'); |
|
if (txt.value.search(/{{use dmy dates|date=November 2010}}/gi) == -1) |
|
if (txt.value.search(/{{dmy}}/gi) == -1) |
|
{ |
|
{ |
|
txt.value='{{Use dmy dates|date=November 2010}}\r\n'+txt.value; |
|
txt.value='{{Use dmy dates|date=November 2010}}\r\n'+txt.value; |
Line 338: |
Line 334: |
|
|
|
|
|
//convert mdy-mdy to dmy-dmy (birth and death date ranges) |
|
//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'); |
|
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|30|31), (?\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|30|31), (?\d{0,3})()/gi, '$1$3 $2 $4 – $6 $5 $7$8'); |
|
|
|
|
|
//convert md-mdy date ranges to dm-dmy |
|
//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'); |
|
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|30|31)(?:th|st|nd|rd|)(\/|\s?\s?|\s(?:and|to|&)\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|30|31)(?:th|st|nd|rd|),?\s(?:of\s)?(\d{3,4})/gi, '$1$3 $2 – $6 $5$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|30|31)(?:th|st|nd|rd|)(\/|\s?\s?|\s(?:and|to|&)\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|30|31)(?:th|st|nd|rd|)()/gi, '$1$3 $2 – $6 $5$7'); |
|
|
//convert md-dy date ranges to d-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}), (?\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|30|31)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?\s?|\s(?:and|to|&)\s)(?\d|30|31)(?: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|30|31)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),? (?\d|30|31)(?: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|30|31)(?:th|st|nd|rd|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}), (?\d|30|31)(?: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) |
|
//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|)((?:,?\s?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?\s?|\s(?:and|to|&)\s)(?\d|30|31)(?: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|),?){1,6})(\s(?:and|to|&)\s)(?\d|30|31)(?: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'); |
|
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') |
|
//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'); |
|
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|30|31)(?:th|st|nd|rd|)(|*\r)/gi, '$1$3 $4$5 $2$6'); |
|
|
|
|
|
//'md, md,' to 'dm, dm,' |
|
//'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'); |
|
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| 30| 31),( (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| 30| 31)()/gi, '$1$3$2,$5$4,$6'); |
|
|
|
|
|
//convert simple mdy dates to dmy |
|
//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|30|31)(?: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|30|31)(?: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'); |
|
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|30|31)(?: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" |
|
//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|30|31)(?: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'); |
|
txt.value=txt.value.replace(/()(?\d|30|31)(?: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 (); |
|
Ohc_remove_leading_zeros_from_nonlinked_dates (); |
Line 379: |
Line 375: |
|
// insert 'mdy' template |
|
// insert 'mdy' template |
|
txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|dmy)(\|*)?}}/gi, '{{Use mdy dates|date=November 2010}}'); |
|
txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|dmy)(\|*)?}}/gi, '{{Use mdy dates|date=November 2010}}'); |
|
if (txt.value.search(/{{use mdy dates|date=November 2010}}/gi) == -1) |
|
if (txt.value.search(/{{mdy}}/gi) == -1) |
|
{ |
|
{ |
|
txt.value='{{Use mdy dates|date=November 2010}}\r\n'+txt.value; |
|
txt.value='{{Use mdy dates|date=November 2010}}\r\n'+txt.value; |
Line 394: |
Line 390: |
|
|
|
|
|
//convert dmy-dmy to mdy-mdy (birth and death date ranges) |
|
//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'); |
|
txt.value=txt.value.replace(/()(?\d|30|31)\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|30|31)\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 |
|
//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'); |
|
txt.value=txt.value.replace(/()(?\d|30|31)(?: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|\.|))(\/|{0,3}(?:and|to|&|-|–){0,3})(?\d|30|31)(?: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$3 $2 – $6 $5,$7'); |
|
|
txt.value=txt.value.replace(/()(?\d|30|31)(?: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|\.|))(\/|{0,3}(?:and|to|&|-|–){0,3})(?\d|30|31)(?: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|\.|))()/gi, '$1$3 $2 – $6 $5,$7'); |
|
|
//convert d-dmy date ranges to md-d,y |
|
|
txt.value=txt.value.replace(/()((?:?\d|30|31)(?:th|st|nd|rd|),\s){0,6}(?\d|30|31)(?:th|st|nd|rd|)(\/|{0,3}(?:and|to|&|-|–){0,3})(?\d|30|31)(?: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) |
|
//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|),?\s){0,6})(?\d|30|31)(?:th|st|nd|rd|)(\/|{0,3}(?:and|to|&|-|–){0,3})(?\d|30|31)(?: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'); |
|
txt.value=txt.value.replace(/()((?:?\d(?:th|st|nd|rd|),?{1,3}){1,6})(?\d|30|31)(?: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') |
|
//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'); |
|
txt.value=txt.value.replace(/()(?\d|30|31)(?:th|st|nd|rd|)({0,3}{0,3}|\sto{0,3})(?\d|30|31)(?: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,' |
|
//'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| 30| 31)( (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| 30| 31)( (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'); |
|
|
|
|
|
|
|
txt.value=txt.value.replace(/()(?\d|30|31)(?: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'); |
|
//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|30|31)(?: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|)\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'); |
|
txt.value=txt.value.replace(/()(?\d|30|31)(?: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'); |
|
|
|
|
|
//Month+day_number "March 7th" -> "March 7" |
|
//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'); |
|
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|30|31)(?:th|st|nd|rd)(|*\r)/gi, '$1$2 $3$4'); |
|
|
|
|
|
//add comma when missing |
|
//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'); |
|
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|30|31)(?:th|st|nd|rd|)(\s\d{1,4})/gi, '$1$2 $3,$4'); |
|
|
|
|
|
Ohc_remove_leading_zeros_from_nonlinked_dates (); |
|
Ohc_remove_leading_zeros_from_nonlinked_dates (); |
Line 537: |
Line 532: |
|
addOnloadHook(function () { |
|
addOnloadHook(function () { |
|
if(document.forms.editform) { |
|
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_dmy()', 'ALL dates to dmy', 'ca-unitfixer', 'Align all dates to dmy', '', ''); |
|
addPortletLink('p-tb', 'javascript:Ohc_all_dates_to_mdy()', 'All dates to mdy', 'ca-unitfixer', 'Fixes some unit formatting', '', ''); |
|
addPortletLink('p-tb', 'javascript:Ohc_all_dates_to_mdy()', 'ALL dates to mdy', 'ca-unitfixer', 'Align all dates to mdy', '', ''); |
|
addPortletLink('p-tb', 'javascript:Ohc_body_to_dmy()', 'Body dates to dmy', 't-dmy', 'day month', '', ''); |
|
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_body_to_mdy()', 'Body dates to mdy', 't-mdy', 'month day', '', ''); |