I'm trying to remove the results from Wikipedia's AFL/VFL season pages (eg https://en.wikipedia.org/wiki/1992_AFL_season#Round_1)
I've got rid of the 'def.', 'def. by' and the scores, which is pretty good going considering I started learning to write Tampermonkey scripts about half an hour ago. But I can't figure out a way to remove the bolding on the winning team's name. In the source, it's this:
<td style="font-weight: bold;">
The script I've got so far is this:
(function(NoWinner) {
var els = document.getElementsByTagName("TD");
for (var i = 0, l = els.length; i < l; i++) {
var el = els[i];
el.innerHTML = el.innerHTML.replace(/def.*/gi, '');
el.innerHTML = el.innerHTML.replace(/\d{1,2}\.\d{1,2}\s\(\d{1,3}\)/gi, '');
}
NoWinner();
})();
I'm just not sure how to replace the actual tag, rather than the contents of the element.
You can select the bold td elements directly and remove the style propterty "font-weight":
const allBoldTd = document.querySelectorAll('td[style*="font-weight: bold"]');
allBoldTd.forEach(td => td.style.removeProperty('font-weight'))