logoalt Hacker News

yakshaving_jgttoday at 8:48 AM1 replyview on HN

Have you tried enabling Reader Mode in your browser?


Replies

bmachotoday at 10:49 AM

Does not work nice with code blocks. But here's how you can add Javascript Snippets to every webpage via Tampermonkey:

  // ==UserScript==
  // @name         JS Snippets
  // @match        *://*/*
  // @grant        GM_registerMenuCommand
  // ==/UserScript==
  
  GM_registerMenuCommand("Set font to default", () => {
      document.querySelectorAll("body *:not(pre *)").forEach(el => {
          el.style.fontFamily = "nonExistentFont";
      });
  });
you can run them by clicking the Tampermonkey icon and picking the action you want. You can add website dependent snippets by checking the location before you register the menu items, it's dynamic.