Prefix title with word count

Prefixes tab title with (approx) page word count

  1. // ==UserScript==
  2. // @name Prefix title with word count
  3. // @version 1.0
  4. // @description Prefixes tab title with (approx) page word count
  5. // @author jamesdeluk
  6. // @match http://*/*
  7. // @match https://*/*
  8. // @namespace https://greasyfork.org/users/242246
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. function addCount() {
  13. let wc=document.body.innerText.match(/[\w\d]+/gi).length;
  14. let title=document.title;
  15. document.title="["+wc+"] "+title;
  16. }
  17. addCount();
  18. })();