Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
(17 intermediate revisions by the same user not shown) | |||
Line 103:
var page = data.query.pages[0];
var content = page.revisions[0].slots.main.content;
// Define the templates to check for▼
const templatesToCheck = [▼
'{{short description',▼
'{{DISPLAYTITLE',▼
'{{Lowercase title',▼
'{{Italic title',▼
'{{about',▼
'{{redirect',▼
'{{Distinguish',▼
'{{for'▼
];▼
// Find the position to insert the new template▼
let insertPosition = 0;▼
insertPosition = i + 1;▼
break;▼
}▼
}▼
// Create the reason string
let reason = '
if (duplicateInfo.length > 0) {
duplicateInfo.forEach((info) => {
reason += `* ${info.url} (refs: ${info.refs.map(r => r.number).join(', ')})
});
}
//
var newContent = lines.join('\n');▼
const wikitextPage = new Morebits.wikitext.page(content);
// Define templates that should come before the duplicated citations template
'displaytitle',
'distinguish',
'Featured article',
'Use American English',
'Use British English'
▲ ];
// Insert the template after the specified templates
// The third parameter is flags (default 'i' for case-insensitive)
// The fourth parameter can include pre-template content like HTML comments
wikitextPage.insertAfterTemplates(templateToInsert, precedingTemplates, 'i', ['<!--[\\s\\S]*?-->']);
let summary = `Tagged [[WP:DUPREF|duplicate citations]] using [[User:Polygnotus/DuplicateReferences|DuplicateReferences]]
return api.postWithToken('csrf', {
Line 273 ⟶ 279:
!url.includes("wikipedia.org") &&
!url.includes("_(identifier)") && // Templates like ISBN and ISSN and OCLC and S2CID contain (identifier)
!url.startsWith("https://
!url.startsWith("https://www.
!url.startsWith("https://www.
!url.startsWith("https://www.nbcnews.com/news/world/live-blog/") &&
!url.startsWith("https://www.theguardian.com/world/live/") &&
!url.startsWith("https://www.nytimes.com/live/") &&
!url.startsWith("https://edition.cnn.com/world/live-news/") &&
!url.startsWith("https://www.timesofisrael.com/liveblog") &&
!url.startsWith("https://www.france24.com/en/live-news/") &&
!url.startsWith("https://books.google.com/") && //may be 2 different pages of the same book
!url.startsWith("https://archive.org/details/isbn_")
|