User:Gary/comments in local time.js: Difference between revisions

Content deleted Content added
Make changes to comments.
sync from User:SD0001/comments in local time.js - requested on talk
Tag: Reverted
Line 1:
// Forked from [[User:Gary/comments in local time.js]]
/**
* COMMENTS IN LOCAL TIME
Line 9 ⟶ 10:
* [[Wikipedia:Comments in Local Time]]
*/
mw.hook('wikipage.content').add(($content) => {
$(() => {
/**
* Given a number, add a leading zero if necessary, so that the final number
Line 503 ⟶ 504:
 
if (isDisabledUrl) {
return;
}
// If this content already contains localcomments class, it was
// already worked on.
if document($content[0].querySelector('.mw-parser-outputlocalcomments'),) {
return;
}
 
this.replaceText(
$content[0],
document.querySelector('.mw-parser-output'),
/(\d{1,2}):(\d{2}), (\d{1,2}) ([A-Z][a-z]+) (\d{4}) \(UTC\)/
);
Line 618 ⟶ 625:
}
 
const commentsInLocalTime = new CommentsInLocalTime().run();
// Check if we've already ran this script.
if (window.commentsInLocalTimeWasRun) {
return;
}
 
window.commentsInLocalTimeWasRun = true;
 
const commentsInLocalTime = new CommentsInLocalTime();
 
commentsInLocalTime.run();
});