Content deleted Content added
DreamRimmer (talk | contribs) fixes |
DreamRimmer (talk | contribs) add convenient-discussions tag (DR) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 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 835:
function parseRfCs(wikitext, topicName) {
const rfcs = [];
const rfcEntryPattern = /'''\[\[([^\]|]+)(?:\|([^\]]+))?\]\]'''[\s\S]*?\{\{rfcquote\|text=((?:[^{}]|\
const now = new Date();
Line 849:
let pageName, anchor, displayTitle;
const link = match[1];
displayTitle = match[2] || (anchor ? `${link}#${anchor}` : link);
if (link.includes('#')) {
[pageName, anchor] = link.split('#');
Line 862 ⟶ 861:
let daysDiff = null;
const timestampMatch = rfcText.match(/(\d{2}):(\d{2}), (\d{1,2}) (\w+) (\d{4}) \(UTC\)
if (timestampMatch) {
const
const monthNum =
if (monthNum !== -1)
const
monthNum,▼
0, 0▼
daysDiff = Math.floor(timeDiff /
if (daysDiff < 0) daysDiff =
▲ parseInt(day, 10),
▲ parseInt(hour, 10),
▲ parseInt(minute, 10),
▲ 0, 0
▲ ));
const timeDiff = currentUtc.getTime() - tsDate.getTime();▼
if (daysDiff < 0) daysDiff = 0;▼
▲ }
}
}
Line 918 ⟶ 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 939 ⟶ 944:
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;
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 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 952 ⟶ 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 962 ⟶ 998:
document.getElementById('rfc-list-table').innerHTML = (${renderRfCTable.toString()})(filteredRfcs);
}
document.getElementById('rfc-age-filter').addEventListener('change', updateRfCTable);
updateRfCTable();
</script>`;
return html;
}
|