Content deleted Content added
DreamRimmer (talk | contribs) fix (DR) |
DreamRimmer (talk | contribs) add convenient-discussions tag (DR) |
||
(13 intermediate revisions by the same user not shown) | |||
Line 7:
*/
$(document).ready(function() {
var apiCache = {};
var CACHE_DURATION = 10 * 60 * 1000; // 10 minutes
Line 56 ⟶ 55:
min: 2005,
max: new Date().getFullYear() + 1,
step: 1,
showButtons: true
}),
sectionSelect = new OO.ui.DropdownWidget({
Line 103:
monthSelect.getMenu().selectItemByData(currentMonth);
sectionSelect.getMenu().selectItemByData('all');
var labels = {
monthLabel: $('<p>').text('Month:').css('font-weight', 'bold'),
Line 615 ⟶ 614:
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);
});
Line 816 ⟶ 815:
return promise.then(results => {
return fetchPageBatch(batch).then(batchResults => {
// Add delay between batches except for the last one▼
if (index < batches.length - 1) {
return new Promise(resolve => {
Line 837 ⟶ 835:
function parseRfCs(wikitext, topicName) {
const rfcs = [];
const rfcEntryPattern = /'''\[\[([^\]|]+)(?:\|([^\]]+))?\]\]'''[\s\S]*?\{\{rfcquote\|text=((?:[^{}]|\
const now = new Date();
const currentUtcYear = now.getUTCFullYear();
Line 850 ⟶ 849:
let pageName, anchor, displayTitle;
const link = match[1];
displayTitle = match[2] || (anchor ? `${link}#${anchor}` : link);
if (link.includes('#')) {
[pageName, anchor] = link.split('#');
Line 858 ⟶ 857:
}
const
let timestampStr = null;
let daysDiff = null;
const months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" if (monthNum !== -1) { daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
if (daysDiff < 0) daysDiff = 0;
}
}
Line 891 ⟶ 898:
url: url,
daysOld: daysDiff,
timestamp: timestampStr || "unavailable"
});
}
return rfcs;
}
Line 906 ⟶ 914:
const ageOptions = [3, 7, 10, 15, 20, 25, 30];
const
rfcs.forEach(rfc => {
const uniqueKey = `${rfc.url}|${rfc.title}`;
if (rfcMap.has(uniqueKey)) {
if (!existing.topics.includes(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">`;
Line 926 ⟶ 943:
function renderRfCTable(filteredRfcs) {
if (filteredRfcs.length > 0) {
let table = '<h4>Current RfCs</h4><table class="wikitable sortable"><thead><tr><th>Topic</th><th>
filteredRfcs.sort((a, b) => a.daysOld - b.daysOld).forEach((rfc, index) => {
let topicDisplay;
table += `<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>`;▼
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)
<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>${
});
table += '</tbody></table>';
Line 940 ⟶ 978:
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(
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;
Line 950 ⟶ 998:
document.getElementById('rfc-list-table').innerHTML = (${renderRfCTable.toString()})(filteredRfcs);
}
document.getElementById('rfc-age-filter').addEventListener('change', updateRfCTable);
updateRfCTable();
</script>`;
return html;
}
|