User:Killer9000/common.js: Difference between revisions

From wowdev
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
   // 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(clr);
   console.log(elm.style.background);
   // Switch on the possible values we know of
   // Switch on the possible values we know of
   switch (clr)
   switch (clr)
   {
   {
  case "#eee":
   case "rgb(238, 238, 238)":
   case "rgb(238, 238, 238)":
     elm.style.background = "#000000";
     elm.style.background = "#000000";
     break;
     break;
   }
   }
  console.log(elm.style.background);
});
});

Revision as of 22:23, 14 May 2022

var elms = document.querySelectorAll("*[style]");
Array.prototype.forEach.call(elms, function(elm) {
  // Get the color value
  var clr = elm.style.background || "";
  // Remove all whitespace, make it all lower case
  clr = clr.replace(/\s/g, "").toLowerCase();
  console.log(elm.style.background);
  // Switch on the possible values we know of
  switch (clr)
  {
  case "rgb(238, 238, 238)":
    elm.style.background = "#000000";
    break;
  }
  console.log(elm.style.background);
});