User:DreamRimmer/adminnewslettertools.js: Difference between revisions

Content deleted Content added
fix
fixes
Line 547:
return Promise.all(promises).then(results => {
const allRfcs = results.flat();
console.log('Total RfCs found:', allRfcs.length);
console.log('RfC data:', allRfcs.slice(0, 3));
return createRfCDisplay(allRfcs);
});
Line 553 ⟶ 555:
function parseRfCs(wikitext, topicName) {
const rfcs = [];
const rfcPattern = /'''\[\[([^\]]+)\]\]'''[\s\S]*?\{\{rfcquote\|text=([^}]+)\}\}/g;
let match;
while ((match = rfcPattern.exec(wikitext)) !== null) {
const linkText = match[1];
const timestampStrrfcquoteText = timestampMatchmatch[12];
let pageName, anchor;
Line 567 ⟶ 570:
}
const afterMatchtimestampMatch = wikitextrfcquoteText.substring(match.index(/(\d{2}:\d{2}, \d{1,2} \w+ match[0].length\d{4} \(UTC\))/);
const rfcquoteMatch = afterMatch.match(/\{\{rfcquote\|text=([^}]+)\}\}/);
if (rfcquoteMatchtimestampMatch) {
const rfcquoteTexttimestampStr = rfcquoteMatchtimestampMatch[1];
const timestampMatchrfcDate = rfcquoteTextnew Date(timestampStr.matchreplace(/' (\d{2}:\d{2}UTC)', \d{1,2}' \w+ \d{4} \(UTC\)')/);
const now = new }Date();
const daysDiff = Math.floor((now - rfcDate) / (1000 * 60 * 60 * 24));
ifconst (timestampMatch)url = anchor ? {
`https://en.wikipedia.org/wiki/${encodeURIComponent(pageName)}#${encodeURIComponent(anchor)}` :
const timestampStr = timestampMatch[1];
const rfcDate = new Date(timestampStr`https://en.replacewikipedia.org/wiki/${encodeURIComponent(' (UTC)', ' UTC')pageName)}`;
const now = new Date();
const daysDiff = Mathrfcs.floorpush((now - rfcDate) / (1000 * 60 * 60 * 24));{
topic: topicName,
const url = anchor ?title: pageName,
`httpsurl://en.wikipedia.org/wiki/${encodeURIComponent(pageName)}#${encodeURIComponent(anchor)}` :url,
daysOld: `https://en.wikipedia.org/wiki/${encodeURIComponent(pageName)}`;daysDiff,
timestamp: timestampStr
rfcs.push({});
topic: topicName,
title: pageName,
url: url,
daysOld: daysDiff,
timestamp: timestampStr
});
}
}
}
Line 624 ⟶ 621:
});
html += `</select></p>`;
 
if (rfcs.length > 0) {
html += '<h4>All Current RfCs</h4><table class="wikitable sortable"><thead><tr><th>Topic</th><th>Title</th><th>Days Old</th><th>Started</th></tr></thead><tbody>';
rfcs.sort((a, b) => a.daysOld - b.daysOld).forEach(rfc => {
html += `<tr><td>${rfc.topic}</td><td><a href="${rfc.url}" target="_blank">${rfc.title}</a></td><td>${rfc.daysOld}</td><td>${rfc.timestamp}</td></tr>`;
});
html += url: url,'</tbody></table>';
}
 
html += '<div id="rfc-summary-table"><h4>RfC Count Summary</h4><table class="wikitable"><thead><tr><th>Topic</th>';