.md for great justice!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.4 KiB

  1. ---
  2. title: "make hypothes.is bookmarklet work where sites block it"
  3. layout: page
  4. tags: ["technicalities", "user scripts"]
  5. toplevel: false
  6. permalink: "/user-scripts/hypothesis/"
  7. ---
  8. If you're a [hypothes.is](https://hypothes.is) user on Firefox, you'll be familiar with their little bookmarklet that tacks the annotation interface onto the side of any webpage.
  9. Well, almost any webpage. Sometimes the settings will block the JavaScript from being able to execute right. I've got a few here where you can see it's been useful to me.
  10. [Tampermonkey](https://www.tampermonkey.net/) to the rescue! That same bookmarklet code just gets shoved in a script.
  11. ```
  12. // ==UserScript==
  13. // @name hypothesize
  14. // @namespace http://tampermonkey.net/
  15. // @version 0.1
  16. // @description sometimes settings block the hypothes.is bookmarklet from working. this uses a sledgehammer to make it work.
  17. // @author https://maya.land/
  18. // @match https://news.ycombinator.com/*
  19. // @match https://*.marginalia.nu/*
  20. // @match https://*.bulletin.com/*
  21. // @match https://forum.obsidian.md/*
  22. // @grant none
  23. // ==/UserScript==
  24. (function() {
  25. 'use strict';
  26. window.hypothesisConfig=function(){return{showHighlights:true,appType:'bookmarklet'};};
  27. var d=document,s=d.createElement('script');
  28. s.setAttribute('src','https://hypothes.is/embed.js');
  29. d.body.appendChild(s)
  30. })();
  31. ```