User:Killer9000/common.js: Difference between revisions
Jump to navigation
Jump to search
Killer9000 (talk | contribs) No edit summary |
Killer9000 (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
Array.prototype.forEach.call(elms, function(elm) { | Array.prototype.forEach.call(elms, function(elm) { | ||
// Get the color value | // Get the color value | ||
var clr = elm.style.background|| ""; | var clr = elm.style.background || ""; | ||
console.log(clr); | console.log(clr); | ||
// Remove all whitespace, make it all lower case | // Remove all whitespace, make it all lower case | ||
Line 12: | Line 12: | ||
case "#eee": | case "#eee": | ||
case "rgb(238, 238, 238)": | case "rgb(238, 238, 238)": | ||
elm.style. | elm.style.background = "#000000"; | ||
break; | break; | ||
} | } | ||
}); | }); |
Revision as of 22:21, 14 May 2022
var elms = document.querySelectorAll("*[style]");
Array.prototype.forEach.call(elms, function(elm) {
// Get the color value
var clr = elm.style.background || "";
console.log(clr);
// Remove all whitespace, make it all lower case
clr = clr.replace(/\s/g, "").toLowerCase();
// Switch on the possible values we know of
switch (clr)
{
case "#eee":
case "rgb(238, 238, 238)":
elm.style.background = "#000000";
break;
}
});