User:DreamRimmer/adminnewslettertools.js: Difference between revisions

Content deleted Content added
fix date parser
Tag: Reverted
rm summary table
Tag: Reverted
Line 623:
html += `</select></p>`;
 
const defaultAge = 7;
const defaultFilteredRfcs = rfcs.filter(rfc => rfc.daysOld <= defaultAge);
if (defaultFilteredRfcs.length > 0) {
html += `<h4>Current RfCs (${defaultAge} days or newer)</h4><table class="wikitable sortable"><thead><tr><th>Topic</th><th>Title</th><th>Days Old</th><th>Started</th></tr></thead><tbody>`;
defaultFilteredRfcs.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 += '</tbody></table>';
} else {
html += `<p>No RfCs found that are ${defaultAge} days old or newer.</p>`;
}
 
html += '<div id="rfc-summary-table"><h4>RfC Count Summary</h4><table class="wikitable"><thead><tr><th>Topic</th>';
ageOptions.forEach(age => {
htmlconst filteredRfcs += `<thrfcs.filter(rfc =>${age}d !isNaN(rfc.daysOld) && rfc.daysOld </th>`= age);
const displayStyle = age === 7 ? 'block' : 'none';
const defaultAge = 7;
html += `<div class="rfc-main-table" data-age="${age}" style="display: ${displayStyle};">`;
if (defaultFilteredRfcsfilteredRfcs.length > 0) {
html += `<h4>Current RfCs (${age} days or newer) - ${filteredRfcs.length} total</h4>`;
html += `<h4>Current RfCs (${defaultAge}html days+= or newer)</h4>'<table class="wikitable sortable"><thead><tr><th>Topic</th><th>Title</th><th>Days Old</th><th>Started</th></tr></thead><tbody>`';
defaultFilteredRfcs filteredRfcs.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 += '</tbody></table>';
} else {
html += `<h4>Current RfCs (${age} days or newer)</h4>`;
html += `<p>No RfCs found that are ${defaultAgeage} days old or newer.</p>`;
});
html += '</trdiv>';
});
html += '</tr></thead><tbody>';
 
topicNames.forEach(topic => {
html += `<tr><td>${topic}</td>`;
ageOptions.forEach(age => {
const count = rfcs.filter(rfc => rfc.topic === topic && !isNaN(rfc.daysOld) && rfc.daysOld <= age).length;
html += `<td>${count}</td>`;
});
html += '</tr>';
});
html += '</tbody></table></div>';
 
ageOptions.forEach(age => {
Line 682 ⟶ 673:
const selectedAge = document.getElementById('rfc-age-filter').value;
const groups = document.querySelectorAll('.rfc-age-group');
const tables = document.querySelectorAll('.rfc-main-table');
groups.forEach(group => {
group.style.display = group.dataset.age == selectedAge ? 'block' : 'none';
});
topicNames tables.forEach(topictable => {
table.style.display = table.dataset.age == selectedAge ? 'block' : 'none';
});
}