Content deleted Content added
m Novem Linguae moved page User:DreamRimmer/rightschangeslogs.js to User:DreamRimmer/adminnewslettertools.js without leaving a redirect: off wiki request |
DreamRimmer (talk | contribs) section name extraction from edit comments using regex |
||
Line 318:
if (!data.length) return `<p>No ${title.toLowerCase()} found for this period.</p>`;
const headerLabel = title.includes('ArbCom topics') ? 'Topic' : 'Comment';
let html = `<h4>${title}</h4><table class="wikitable sortable"><thead><tr><th>Date</th><th>User</th><th>
data.forEach(item => {
Line 328 ⟶ 329:
const userLink = `<a href="https://en.wikipedia.org/wiki/User:${encodeURIComponent(finalUsername)}" target="_blank">${item.user}</a>`;
if (title.includes('ArbCom topics') && item.comment && item.revid) {
const sectionMatch = item.comment.match(/\/\*\s*([^*]+?)\s*\*\//);
if (sectionMatch) {
const sectionName = sectionMatch[1].trim();
const encodedSection = encodeURIComponent(sectionName.replace(/ /g, '_'));
cellContent = `<a href="https://en.wikipedia.org/w/index.php?diff=${item.revid}#${encodedSection}" target="_blank">${sectionName}</a>`;
}
}
html += `<tr><td>${timestamp}</td><td>${userLink}</td><td>${cellContent}</td></tr>`;
});
|