I'm trying to change the color of every user's profile link in my browser using a userscript. My code:
// ==UserScript==
// @name Color changer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description none
// @author You
// @match https://puzzling.stackexchange.com/questions/*
// @grant none
// ==/UserScript==
let users = document.getElementsByClassName("user-details");
for (let user of users) {
user.getElementsByTagName("a")[0].style.color = "red";
}
For some reason,
- for some posts this only changes the color of the OP's link in every question page, not the links of the commenters and answerers.
Error:
ERROR: Execution of script 'New Userscript' failed! user.getElementsByTagName(...)[0] is undefined
- for some posts this doesn't work at all.
Error:
ERROR: Execution of script 'New Userscript' failed! user.getElementsByTagName(...)[0] is undefined
- for some posts this only changes the color of the OP's link and answer's link in every question page, not the links of the commenters.
No error.
How can I change the color of all the user profile links in the page?