Set minimum font weight

Set the minimum font weight on a page, to make things readable

  1. // ==UserScript==
  2. // @name Set minimum font weight
  3. // @namespace http://md5-f3c5e23e69e2fa0b44e254d4548c5915.committed-identity.internal/setminimumfontweight
  4. // @version 1.0
  5. // @description Set the minimum font weight on a page, to make things readable
  6. // @author Committed Identity MD5 f3c5e23e69e2fa0b44e254d4548c5915
  7. // @copyright Copyright (C) 2017 Committed Identity MD5 f3c5e23e69e2fa0b44e254d4548c5915
  8. // @license https://opensource.org/licenses/MIT
  9. // @match http://*/*
  10. // @match https://*/*
  11. // @grant none
  12. // @run-at document-idle
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. var minweight = 400;
  19.  
  20. var all = document.getElementsByTagName("*");
  21. for (var i=0, max=all.length; i < max; i++) {
  22. var weight = parseFloat(window.getComputedStyle(all.item(i), null).getPropertyValue('font-weight'));
  23. if (weight < minweight) {
  24. all.item(i).style.fontWeight = minweight;
  25. }
  26. }
  27.  
  28. })();