User:Bobblewik/monobook.js/dates.js: Difference between revisions

Content deleted Content added
Bobblewik (talk | contribs)
mNo edit summary
m Maintenance: Replacing addOnloadHook with native jQuery (mw:ResourceLoader/Migration_guide_(users)#addOnloadHook - phab:T130879)
 
(9 intermediate revisions by one other user not shown)
Line 15:
txt.value = txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ \-]century\|(\d{1,2}(?:st|nd|rd|th))[ \-]century\s(AD|BC|CE|BCE)\]\]/gi, '$1 century $2');
txt.value = txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[ \-]century\|(\d{1,2}(?:st|nd|rd|th))[ \-]centuries\s(AD|BC|CE|BCE)\]\]/gi, '$1 centuries $2');
txt.value = txt.value.replace(/(\d(?:st|nd|rd|th))[ \-]Century/ggi, '$1 century');
 
// piped decades and years
Line 141:
//'present'
txt.value = txt.value.replace(/\[\[Present \(time\)\|(Present)\]\]/gi, '$1');
 
//Eliminate 'surprise links' also known as 'easter egg links'
txt.value = txt.value.replace(/\[\[\d{1,4}s?\sin\s[^\|]{1,30}\|(\d{1,4}s?)\]\]/gi, '$1');
 
 
Line 158 ⟶ 161:
}
 
addOnloadHook$(function () {
if(document.forms.editform) {
addLink('p-cactions', 'javascript:formatdates()', 'dates', 'ca-datefixer', 'Fixes some date formatting', '', '');