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

Content deleted Content added
Undid revision 892614449 by Gary (talk)
use another selector
Line 425:
run() {
if (
['', 'MediaWiki', 'Special'].includes(
mw.config.get('wgCanonicalNamespace') === '' ||
mw.config.get('wgCanonicalNamespace') === 'MediaWiki' ||
);
mw.config.get('wgCanonicalNamespace') === 'Special'
) {
return;
}
 
const disabledUrls = ['action=history'];
 
// Check for disabled URLs.
const isDisabledUrl = disabledUrls['action=history'].some((disabledUrl) =>
document.___location.href.includes(disabledUrl)
);
Line 442 ⟶ 440:
return;
}
 
const wikiPreview = ['action=edit', 'action=submit'];
 
// Check what ID we should use, to get the page's text.
const hasUniqueUrl = wikiPreview.some((text) =>
document.___location.href.includes(text)
);
 
const elementId = hasUniqueUrl ? 'wikiPreview' : 'bodyContent';
const contentText = document.querySelector(`#${elementId}`);
 
this.replaceText(
const contentText = document.querySelector(`#${elementId}`'.mw-parser-output');,
contentText,
/(\d{1,2}):(\d{2}), (\d{1,2}) ([A-Z][a-z]+) (\d{4}) \(UTC\)/
);