Darken Javascript Bookmarklet Update

Posted by

This is just a simple modification of the Javascript bookmarklet called “Darken” by Gina Trapani. No idea if it had already been updated or not, but here’s the list of what I changed for anybody interested:

  • Running the bookmarklet multiple times toggles the darken effect on and off! Saves refreshing the page
  • Changed the colour scheme to green text
  • Added hover effect for links
  • Changed link colour and added underline to differentiate links
  • Changed link visited colour
  • Only uses the appendChild method as that’s all the Browsers I use support (Opera, IE9, Firefox, Chrome)
javascript: (function (){var newSS, styles = '* { background-color: black ! important; color: green !important; }a:link, a:link * { color: green !important; text-style: underline; }a:visited, a:visited * { color: #7f0000 !important; }a:hover, a:hover * { color: red !important; }';var elemHead = document.getElementsByTagName("head")[0];var elemCSS = document.getElementById("darkenCSS");if (elemCSS){elemHead.removeChild(elemCSS);}else{newSS = document.createElement('link');newSS.rel = 'stylesheet';newSS.href = 'data:text/css,' + escape(styles);newSS.id = "darkenCSS";elemHead.appendChild(newSS);}})();
Terry Butler