User:Killer9000/common.js: Difference between revisions

From wowdev
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
var elms = document.querySelectorAll("*[style]");
var elms = document.querySelectorAll("*[style]");
Array.prototype.forEach.call(elms, function(elm) {
Array.prototype.forEach.call(elms, function(elm) {
   var clr = elm.style.background || "";
   var clr = elm.style.background.color || "";
   // Remove all whitespace, make it all lower case
   // Remove all whitespace, make it all lower case
   clr = clr.replace(/\s/g, "").toLowerCase();
   clr = clr.replace(/\s/g, "").toLowerCase();
  console.log("- " + elm.style.background.color);
   switch (clr)
   switch (clr)
   {
   {
   case "#eee":
   case "#eee":
   case "rgb(238, 238, 238)":
   case "rgb(238, 238, 238)":
     console.log(elm.style.background);
     elm.style.background.color = "rgb(22, 22, 22)";
    elm.style.background = "rgb(22, 22, 22)";
     console.log("-- " + elm.style.background);
     console.log(elm.style.background);
     break;
     break;
   }
   }
});
});

Revision as of 22:28, 14 May 2022

var elms = document.querySelectorAll("*[style]");
Array.prototype.forEach.call(elms, function(elm) {
  var clr = elm.style.background.color || "";
  // Remove all whitespace, make it all lower case
  clr = clr.replace(/\s/g, "").toLowerCase();
  console.log("- " + elm.style.background.color);
  switch (clr)
  {
  case "#eee":
  case "rgb(238, 238, 238)":
    elm.style.background.color = "rgb(22, 22, 22)";
    console.log("-- " + elm.style.background);
    break;
  }
});