User:DreamRimmer/adminnewslettertools.js: Difference between revisions

Content deleted Content added
fix (DR)
add convenient-discussions tag (DR)
 
(29 intermediate revisions by the same user not shown)
Line 7:
*/
$(document).ready(function() {
var apiCache = {};
var CACHE_DURATION = 10 * 60 * 1000; // 10 minutes
 
function getCacheKey(api, params) {
return JSON.stringify({api: api.toString(), params: params});
}
 
function getCachedResult(key) {
var cached = apiCache[key];
if (cached && (Date.now() - cached.timestamp < CACHE_DURATION)) {
return cached.data;
}
return null;
}
 
function setCachedResult(key, data) {
apiCache[key] = {
data: data,
timestamp: Date.now()
};
}
 
function initializeAdminNewsTools() {
$('#mw-content-text > p').remove();
$('#firstHeading').text('AdminNewsToolsAdministrators\' newsletter tools');
 
var monthSelect = new OO.ui.DropdownWidget({
Line 33 ⟶ 55:
min: 2005,
max: new Date().getFullYear() + 1,
step: 1,
showButtons: true
}),
sectionSelect = new OO.ui.DropdownWidget({
Line 80 ⟶ 103:
monthSelect.getMenu().selectItemByData(currentMonth);
sectionSelect.getMenu().selectItemByData('all');
 
var labels = {
monthLabel: $('<p>').text('Month:').css('font-weight', 'bold'),
Line 319 ⟶ 341:
 
const headerLabel = title.includes('ArbCom topics') ? 'Topic' : 'Comment';
const userLabel = title.includes('ArbCom topics') ? 'Arbitrator/Clerk' : 'User';
let html = `<h4>${title}</h4><table class="wikitable sortable"><thead><tr><th>Date</th><th>User</th><th>${headerLabel}</th></tr></thead><tbody>`;
const dateLabel = title.includes('ArbCom topics') ? 'Timestamp' : 'Date';
let html = `<h4>${title}</h4><table class="wikitable sortable"><thead><tr><th>${dateLabel}</th><th>${userLabel}</th><th>${headerLabel}</th></tr></thead><tbody>`;
 
data.forEach(item => {
Line 362 ⟶ 386:
}
 
function fetchAllLogEventsfetchAllLogEventsBatched(api, params, results = [], batchSize = 50, delay = 200) {
returnvar api.get(params).then(responsecacheKey => {getCacheKey(api, params);
var cached = results.pushgetCachedResult(...(response.query.logevents || [])cacheKey);
if (response.continuecached) {
return fetchAllLogEventsPromise.resolve(api, { ...params, ...response.continue }, resultscached);
}
 
return results;
var currentParams = {...params, lelimit: Math.min(batchSize, params.lelimit || 500)};
});
function fetchBatch() {
return new Promise((resolve, reject) => {
var timeout = setTimeout(() => {
reject(new Error('API request timeout'));
}, 15000);
 
api.get(currentParams).then(response => {
clearTimeout(timeout);
var newResults = response.query.logevents || [];
results.push(...newResults);
if (response.continue && results.length < (params.lelimit || 500)) {
currentParams = {...currentParams, ...response.continue};
setTimeout(() => {
fetchBatch().then(resolve).catch(reject);
}, delay);
} else {
setCachedResult(cacheKey, results);
resolve(results);
}
}).catch(error => {
clearTimeout(timeout);
reject(error);
});
});
}
return fetchBatch();
}
 
function fetchAllRevisionsfetchAllRevisionsBatched(api, params, results = [], batchSize = 50, delay = 200) {
returnvar api.get(params).then(responsecacheKey => {getCacheKey(api, params);
var const pagescached = response.query.pages || {}getCachedResult(cacheKey);
if Object.values(pagescached).forEach(page => {
return if Promise.resolve(page.revisionscached) {;
results.push(...page.revisions);}
 
}
var currentParams = {...params, rvlimit: Math.min(batchSize, params.rvlimit || 500)};
function fetchBatch() {
return new Promise((resolve, reject) => {
var timeout = setTimeout(() => {
reject(new Error('API request timeout'));
}, 15000);
 
api.get(currentParams).then(response => {
clearTimeout(timeout);
const pages = response.query.pages || {};
Object.values(pages).forEach(page => {
if (page.revisions) {
results.push(...page.revisions);
}
});
if (response.continue && results.length < (params.rvlimit || 500)) {
currentParams = {...currentParams, ...response.continue};
setTimeout(() => {
fetchBatch().then(resolve).catch(reject);
}, delay);
} else {
setCachedResult(cacheKey, results);
resolve(results);
}
}).catch(error => {
clearTimeout(timeout);
reject(error);
});
});
if (response.continue) {}
return fetchAllRevisions(api, { ...params, ...response.continue }, results);
return }fetchBatch();
return results;
});
}
 
const metaApi = new mw.ForeignApi('https://meta.wikimedia.org/w/api.php', { headers: { 'Api-User-Agent': 'User:DreamRimmer/adminnewslettertools.js; https://en.wikipedia.org/wiki/User:DreamRimmer' } });
const localApi = new mw.Api({ headers: { 'Api-User-Agent': 'User:DreamRimmer/adminnewslettertools.js; https://en.wikipedia.org/wiki/User:DreamRimmer' } });
 
function fetchRightsChanges(startTs, endTs, startLabel, endLabel) {
 
return Promise.all([
fetchAllLogEventsfetchAllLogEventsBatched(metaApi, {
action: 'query',
list: 'logevents',
Line 399 ⟶ 480:
lestart: endTs,
leend: startTs,
lelimit: 'max'500,
leprop: 'timestamp|title|user|userid|details|params|type|comment|ids',
format: 'json'
}),
fetchAllLogEventsfetchAllLogEventsBatched(localApi, {
action: 'query',
list: 'logevents',
Line 409 ⟶ 490:
lestart: endTs,
leend: startTs,
lelimit: 'max'500,
leprop: 'timestamp|title|user|userid|details|params|type|comment|ids',
format: 'json'
Line 433 ⟶ 514:
}
 
function fetchTechNewsfetchTechNewsBatched(year, month) {
const weeks = getWeeksInMonth(year, month);
var cacheKey = `tech_news_${year}_${month}`;
var cached = getCachedResult(cacheKey);
if (cached) {
return Promise.resolve(cached);
}
constfunction promises = weeks.mapfetchWeekBatch(week =>weekBatch) {
return metaApiPromise.getall(weekBatch.map(week => {
action:return 'parse',new Promise((resolve) => {
page: `Tech/News/${year}/$ var timeout = setTimeout(() => {week}`,
format: 'json', resolve(null);
prop: 'text' }, 10000);
 
}).then(response => {
if (response.parse && response metaApi.parse.text) get({
const html = response.parse.text[ action: '*parse'];,
const match = html.match( page: `Tech/News/(\d${4year}), week (\d+) \(([^)]+)\)/);${week}`,
if (match) { format: 'json',
constprop: weekDate = match[3];'text'
const parsedDate}).then(response => new Date(weekDate);{
if clearTimeout(parsedDate.getMonth() === month - 1timeout) {;
if (response.parse && return { week, date: weekDate, url: `https://metaresponse.wikimediaparse.org/wiki/Tech/News/$text) {year}/${week}` };
const html = response.parse.text['*'];
const match = html.match(/(\d{4}), week (\d+) \(([^)]+)\)/);
if (match) {
const weekDate = match[3];
const parsedDate = new Date(weekDate);
if (parsedDate.getMonth() === month - 1) {
resolve({ week, date: weekDate, url: `https://meta.wikimedia.org/wiki/Tech/News/${year}/${week}` });
return;
}
}
}
} resolve(null);
}).catch(() => {
return null clearTimeout(timeout);
}).catch(() => resolve(null);
});
});
}));
}
 
returnconst Promise.all(promises).then(resultsbatchSize => {2;
const batches = [];
for (let i = 0; i < weeks.length; i += batchSize) {
batches.push(weeks.slice(i, i + batchSize));
}
 
return batches.reduce((promise, batch) => {
return promise.then(results => {
return fetchWeekBatch(batch).then(batchResults => {
return results.concat(batchResults);
});
});
}, Promise.resolve([])).then(results => {
const validWeeks = results.filter(r => r !== null);
let html;
if (!validWeeks.length) {
returnhtml = '<p>No tech news found for this period.</p>';
} else {
html = '<h4>Tech News Links</h4><ul>';
validWeeks.forEach(({ week, date, url }) => {
html += `<li><a href="${url}" target="_blank">Tech/News/${year}/${week}</a> (${date})</li>`;
});
html += '</ul>';
}
setCachedResult(cacheKey, html);
 
let html = '<h4>Tech News Links</h4><ul>';
validWeeks.forEach(({ week, date, url }) => {
html += `<li><a href="${url}" target="_blank">Tech/News/${year}/${week}</a> (${date})</li>`;
});
html += '</ul>';
return html;
});
Line 475 ⟶ 588:
function fetchCentralizedDiscussion(startTs, endTs) {
return fetchAllRevisionsfetchAllRevisionsBatched(localApi, {
action: 'query',
titles: 'Template:Centralized discussion',
Line 481 ⟶ 594:
rvstart: endTs,
rvend: startTs,
rvlimit: 'max'500,
rvprop: 'timestamp|user|comment|ids',
format: 'json'
Line 491 ⟶ 604:
function fetchArbComNotices(startTs, endTs) {
return fetchAllRevisionsfetchAllRevisionsBatched(localApi, {
action: 'query',
titles: 'Wikipedia:Arbitration Committee/Noticeboard',
Line 497 ⟶ 610:
rvstart: endTs,
rvend: startTs,
rvlimit: 'max'500,
rvprop: 'timestamp|user|comment|tags|ids',
format: 'json'
}).then(revisions => {
const filtered = revisions.filter(rev => rev.tags && (rev.tags.includes('discussiontools-newtopic') || rev.tags.includes('convenient-discussions')));
return createEditTable('ArbCom topics', filtered, true);
});
}
 
function fetchArbComCases() {
var cacheKey = 'arbcom_cases';
var cached = getCachedResult(cacheKey);
if (cached) {
return Promise.resolve(cached);
}
 
return Promise.all([
new Promise((resolve) => {
var timeout = setTimeout(() => resolve({ parse: null }), 10000);
localApi.get({
action: 'parse',
page: 'Template:ArbComOpenTasks/Cases',
format: 'json',
prop: 'text'
}).then(response => {
clearTimeout(timeout);
resolve(response);
}).catch(() => {
clearTimeout(timeout);
resolve({ parse: null });
});
}),
new Promise((resolve) => {
var timeout = setTimeout(() => resolve({ parse: null }), 10000);
localApi.get({
action: 'parse',
page: 'Template:ArbComOpenTasks/ClosedCases',
format: 'json',
prop: 'text'
}).then(response => {
clearTimeout(timeout);
resolve(response);
}).catch(() => {
clearTimeout(timeout);
resolve({ parse: null });
});
})
]).then(([openResponse, closedResponse]) => {
let html = '';
if (openResponse.parse && openResponse.parse.text) {
const openHtml = openResponse.parse.text['*'];
const openCases = parseArbComCases(openHtml, 'open');
html += createArbComTable('Open cases', openCases, 'open');
} else {
html += '<h4>Open cases</h4><p>No cases are in this period open.</p>';
}
if (closedResponse.parse && closedResponse.parse.text) {
const closedHtml = closedResponse.parse.text['*'];
const closedCases = parseArbComCases(closedHtml, 'closed');
html += createArbComTable('Recently closed cases', closedCases, 'closed');
} else {
html += '<h4>Recently closed cases</h4><p>No cases are in this period closed.</p>';
}
html += '<p><a href="https://en.wikipedia.org/wiki/Template:ArbComOpenTasks" target="_blank">See detailed statistics</a></p>';
setCachedResult(cacheKey, html);
return html;
});
}
function parseArbComCases(html, type) {
const cases = [];
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const rows = doc.querySelectorAll('table.wikitable tbody tr');
rows.forEach((row, index) => {
if (index === 0) return;
const cells = row.querySelectorAll('td');
if (cells.length === 0) return;
const firstCell = cells[0];
const link = firstCell.querySelector('a');
if (!link) return;
const caseName = link.textContent.trim();
const href = link.getAttribute('href');
const fullUrl = href.startsWith('/wiki/') ? `https://en.wikipedia.org${href}` : href;
if (type === 'open' && cells.length >= 4) {
const evidenceDeadline = cells[2] ? cells[2].textContent.trim() : '';
const pdDeadline = cells[3] ? cells[3].textContent.trim() : '';
cases.push({
name: caseName,
url: fullUrl,
evidenceDeadline: evidenceDeadline,
pdDeadline: pdDeadline
});
} else if (type === 'closed' && cells.length >= 2) {
const dateClosed = cells[1] ? cells[1].textContent.trim() : '';
cases.push({
name: caseName,
url: fullUrl,
dateClosed: dateClosed
});
}
});
return cases;
}
function createArbComTable(title, cases, type) {
let html = `<h4>${title}</h4>`;
if (cases.length === 0) {
const period = type === 'open' ? 'open' : 'closed';
html += `<p>No cases are in this period ${period}.</p>`;
return html;
}
if (type === 'open') {
html += '<table class="wikitable"><thead><tr><th>Case name</th><th>Evidence deadline</th><th>PD deadline</th></tr></thead><tbody>';
cases.forEach(caseItem => {
html += `<tr><td><i><a href="${caseItem.url}" target="_blank">${caseItem.name}</a></i></td><td>${caseItem.evidenceDeadline}</td><td>${caseItem.pdDeadline}</td></tr>`;
});
} else {
html += '<table class="wikitable"><thead><tr><th>Case name</th><th>Date closed</th></tr></thead><tbody>';
cases.forEach(caseItem => {
html += `<tr><td><i><a href="${caseItem.url}" target="_blank">${caseItem.name}</a></i></td><td>${caseItem.dateClosed}</td></tr>`;
});
}
html += '</tbody></table>';
return html;
}
 
function fetchRecentRfCsBatched() {
var cacheKey = 'recent_rfcs';
var cached = getCachedResult(cacheKey);
if (cached) {
return Promise.resolve(cached);
}
 
const rfcPages = [
{ name: 'Biographies', url: 'Wikipedia:Requests_for_comment/Biographies' },
{ name: 'Economy, trade, and companies', url: 'Wikipedia:Requests_for_comment/Economy,_trade,_and_companies' },
{ name: 'History and geography', url: 'Wikipedia:Requests_for_comment/History_and_geography' },
{ name: 'Language and linguistics', url: 'Wikipedia:Requests_for_comment/Language_and_linguistics' },
{ name: 'Maths, science, and technology', url: 'Wikipedia:Requests_for_comment/Maths,_science,_and_technology' },
{ name: 'Art, architecture, literature, and media', url: 'Wikipedia:Requests_for_comment/Art,_architecture,_literature,_and_media' },
{ name: 'Politics, government, and law', url: 'Wikipedia:Requests_for_comment/Politics,_government,_and_law' },
{ name: 'Religion and philosophy', url: 'Wikipedia:Requests_for_comment/Religion_and_philosophy' },
{ name: 'Society, sports, and culture', url: 'Wikipedia:Requests_for_comment/Society,_sports,_and_culture' },
{ name: 'Wikipedia style and naming', url: 'Wikipedia:Requests_for_comment/Wikipedia_style_and_naming' },
{ name: 'Wikipedia policies and guidelines', url: 'Wikipedia:Requests_for_comment/Wikipedia_policies_and_guidelines' },
{ name: 'WikiProjects and collaborations', url: 'Wikipedia:Requests_for_comment/WikiProjects_and_collaborations' },
{ name: 'Wikipedia technical issues and templates', url: 'Wikipedia:Requests_for_comment/Wikipedia_technical_issues_and_templates' },
{ name: 'Wikipedia proposals', url: 'Wikipedia:Requests_for_comment/Wikipedia_proposals' },
{ name: 'Unsorted', url: 'Wikipedia:Requests_for_comment/Unsorted' },
{ name: 'User names', url: 'Wikipedia:Requests_for_comment/User_names' }
];
 
function fetchPageBatch(pageBatch) {
return Promise.all(pageBatch.map(page => {
return new Promise((resolve) => {
var timeout = setTimeout(() => {
resolve([]);
}, 10000);
 
localApi.get({
action: 'parse',
page: page.url,
format: 'json',
prop: 'wikitext'
}).then(response => {
clearTimeout(timeout);
if (response.parse && response.parse.wikitext) {
const wikitext = response.parse.wikitext['*'];
const rfcs = parseRfCs(wikitext, page.name);
resolve(rfcs);
} else {
resolve([]);
}
}).catch(() => {
clearTimeout(timeout);
resolve([]);
});
});
}));
}
 
const batchSize = 3;
const batches = [];
for (let i = 0; i < rfcPages.length; i += batchSize) {
batches.push(rfcPages.slice(i, i + batchSize));
}
 
return batches.reduce((promise, batch, index) => {
return promise.then(results => {
return fetchPageBatch(batch).then(batchResults => {
if (index < batches.length - 1) {
return new Promise(resolve => {
setTimeout(() => {
resolve(results.concat(batchResults.flat()));
}, 300);
});
} else {
return results.concat(batchResults.flat());
}
});
});
}, Promise.resolve([])).then(allRfcs => {
const result = createRfCDisplay(allRfcs);
setCachedResult(cacheKey, result);
return result;
});
}
 
function parseRfCs(wikitext, topicName) {
const rfcs = [];
const rfcEntryPattern = /'''\[\[([^\]|]+)(?:\|([^\]]+))?\]\]'''[\s\S]*?\{\{rfcquote\|text=((?:[^{}]|\{[^{]|\}[^}]|\{\{(?:[^{}]|\{[^{]|\}[^}])*\}\})*)\}\}/gi;
const now = new Date();
const currentUtcYear = now.getUTCFullYear();
const currentUtcMonth = now.getUTCMonth();
const currentUtcDate = now.getUTCDate();
const currentUtcHours = now.getUTCHours();
const currentUtcMinutes = now.getUTCMinutes();
const currentUtc = new Date(Date.UTC(currentUtcYear, currentUtcMonth, currentUtcDate, currentUtcHours, currentUtcMinutes, 0, 0));
let match;
while ((match = rfcEntryPattern.exec(wikitext)) !== null) {
let pageName, anchor, displayTitle;
const link = match[1];
displayTitle = match[2] || (anchor ? `${link}#${anchor}` : link);
if (link.includes('#')) {
[pageName, anchor] = link.split('#');
} else {
pageName = link;
anchor = '';
}
const rfcText = match[3];
let timestampStr = null;
let daysDiff = null;
const timestampMatch = rfcText.match(/(\d{2}):(\d{2}), (\d{1,2}) (\w+) (\d{4}) \(UTC\)/);
if (timestampMatch) {
const [fullMatch, hour, minute, day, monthText, year] = timestampMatch;
timestampStr = fullMatch;
const months = [
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
];
const monthNum = months.indexOf(monthText);
if (monthNum !== -1) {
const tsDate = new Date(Date.UTC(
parseInt(year, 10),
monthNum,
parseInt(day, 10),
parseInt(hour, 10),
parseInt(minute, 10),
0, 0
));
const timeDiff = currentUtc.getTime() - tsDate.getTime();
daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
if (daysDiff < 0) daysDiff = 0;
}
}
const url = anchor ?
`https://en.wikipedia.org/wiki/${encodeURIComponent(pageName)}#${encodeURIComponent(anchor)}` :
`https://en.wikipedia.org/wiki/${encodeURIComponent(pageName)}`;
rfcs.push({
topic: topicName,
title: displayTitle || pageName,
url: url,
daysOld: daysDiff,
timestamp: timestampStr || "unavailable"
});
}
return rfcs;
}
 
function createRfCDisplay(rfcs) {
const currentDate = new Date().toLocaleDateString('en-GB', {
day: 'numeric',
month: 'long',
year: 'numeric',
timeZone: 'UTC'
}) + ' UTC';
const ageOptions = [3, 7, 10, 15, 20, 25, 30];
const rfcMap = new Map();
rfcs.forEach(rfc => {
const uniqueKey = `${rfc.url}|${rfc.title}`;
if (rfcMap.has(uniqueKey)) {
const existing = rfcMap.get(uniqueKey);
if (!existing.topics.includes(rfc.topic)) {
existing.topics.push(rfc.topic);
}
} else {
rfcMap.set(uniqueKey, {
...rfc,
topics: [rfc.topic]
});
}
});
const deduplicatedRfcs = Array.from(rfcMap.values());
let html = `<p><small>Current date: ${currentDate}</small></p>`;
html += `<p>Age filter: <select id="rfc-age-filter">`;
ageOptions.forEach(age => {
const selected = age === 7 ? ' selected' : '';
html += `<option value="${age}"${selected}>${age} days old</option>`;
});
html += `</select></p>`;
function renderRfCTable(filteredRfcs) {
if (filteredRfcs.length > 0) {
let table = '<h4>Current RfCs</h4><table class="wikitable sortable"><thead><tr><th>Topic</th><th>RfC</th><th>Days Old</th><th>Started</th></tr></thead><tbody>';
filteredRfcs.sort((a, b) => a.daysOld - b.daysOld).forEach((rfc, index) => {
let topicDisplay;
if (rfc.topics.length === 1) {
topicDisplay = rfc.topics[0];
} else {
const mainTopic = rfc.topics[0];
const additionalCount = rfc.topics.length - 1;
const additionalTopics = rfc.topics.slice(1).join(', ');
topicDisplay = `
<span class="main-topic">${mainTopic}</span>
<span class="additional-topics" style="color: #0645ad; cursor: pointer; text-decoration: underline;"
onclick="toggleTopics('topics-${index}')"
title="${additionalTopics}">
(+${additionalCount} more)
</span>
<div id="topics-${index}" style="display: none; margin-top: 5px; font-size: 0.9em; color: #666;">
${rfc.topics.slice(1).map(topic => `<div>• ${topic}</div>`).join('')}
</div>
`;
}
table += `<tr><td>${topicDisplay}</td><td><a href="${rfc.url}" target="_blank">${rfc.title}</a></td><td>${rfc.daysOld}</td><td>${rfc.timestamp}</td></tr>`;
});
table += '</tbody></table>';
return table;
} else {
return `<p>No RfCs found for selected age filter.</p>`;
}
}
html += `<div id="rfc-list-table"></div>`;
html += '<p><a href="https://en.wikipedia.org/wiki/Wikipedia:Requests_for_comment/All" target="_blank">All open RfCs</a></p>';
html += `<script>
window._rfcs = ${JSON.stringify(deduplicatedRfcs)};
window._ageOptions = ${JSON.stringify(ageOptions)};
function toggleTopics(elementId) {
var element = document.getElementById(elementId);
if (element.style.display === 'none') {
element.style.display = 'block';
} else {
element.style.display = 'none';
}
}
function updateRfCTable() {
var rfcs = window._rfcs;
var age = parseInt(document.getElementById('rfc-age-filter').value, 10);
var filteredRfcs = rfcs.filter(function(rfc) {
return !isNaN(rfc.daysOld) && rfc.daysOld <= age;
});
document.getElementById('rfc-list-table').innerHTML = (${renderRfCTable.toString()})(filteredRfcs);
}
document.getElementById('rfc-age-filter').addEventListener('change', updateRfCTable);
updateRfCTable();
</script>`;
return html;
}
 
function checkPageExists(title) {
returnvar localApi.get(cacheKey = `page_exists_${title}`;
var cached = action: 'query',getCachedResult(cacheKey);
if (cached !== null) titles: title,{
format:return 'json'Promise.resolve(cached);
}).then(response => {
 
const pages = response.query.pages || {};
return new Promise((resolve) => {
return !Object.values(pages).some(page => page.hasOwnProperty('missing'));
}).catch var timeout = setTimeout(() => false);{
setCachedResult(cacheKey, false);
resolve(false);
}, 10000);
 
localApi.get({
action: 'query',
titles: title,
format: 'json'
}).then(response => {
clearTimeout(timeout);
const pages = response.query.pages || {};
const exists = !Object.values(pages).some(page => page.hasOwnProperty('missing'));
setCachedResult(cacheKey, exists);
resolve(exists);
}).catch(() => {
clearTimeout(timeout);
setCachedResult(cacheKey, false);
resolve(false);
});
});
}
 
Line 562 ⟶ 1,082:
 
if (section === 'all' || section === 'tech') {
promises.push(fetchTechNewsfetchTechNewsBatched(year, month));
sections.push('tech');
}
Line 574 ⟶ 1,094:
promises.push(fetchArbComNotices(startTs, endTs));
sections.push('arbcom');
}
 
if ((section === 'all' || section === 'rfc') && isCurrentOrLastMonth) {
promises.push(fetchRecentRfCsBatched());
sections.push('rfc');
}
 
Line 618 ⟶ 1,143:
resultsContainer.append(arbcomHtml);
resultIndex++;
fetchArbComCases().then(arbcomCasesHtml => {
const arbcomTasksHtml = createCollapsibleSection('Arbitration Committee open and recently closed cases', arbcomCasesHtml);
resultsContainer.append(arbcomTasksHtml);
});
}
if (sections.includes('rfc')) {
if ((section === 'all' ||const sectionrfcHtml === createCollapsibleSection('arbcomRecent RfCs'), && isCurrentOrLastMonthresults[resultIndex]) {;
const arbcomTasksHtml = createCollapsibleSection('Arbitration Committee open and recently closed cases', '<p><a href="https://en.wikipedia.org/wiki/Template:ArbComOpenTasks" target="_blank">Arbitration Committee open and recently closed cases</a></p>');
resultsContainer.append(arbcomTasksHtml);
}
 
if ((section === 'all' || section === 'rfc') && isCurrentOrLastMonth) {
const rfcHtml = createCollapsibleSection('Recent RfCs', '<p><a href="https://en.wikipedia.org/wiki/Wikipedia:Requests_for_comment/All" target="_blank">Recent RfCs</a></p>');
resultsContainer.append(rfcHtml);
} resultIndex++;
}
if (section === 'all' || section === 'misc') {
const miscPromises = [];