| @ -0,0 +1,36 @@ | |||||
| --- | |||||
| title: "make hypothes.is bookmarklet work where sites block it" | |||||
| layout: page | |||||
| tags: ["technicalities", "user scripts"] | |||||
| toplevel: false | |||||
| permalink: "/user-scripts/hypothesis/" | |||||
| --- | |||||
| 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. | |||||
| 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. | |||||
| [Tampermonkey](https://www.tampermonkey.net/) to the rescue! That same bookmarklet code just gets shoved in a script. | |||||
| ``` | |||||
| // ==UserScript== | |||||
| // @name hypothesize | |||||
| // @namespace http://tampermonkey.net/ | |||||
| // @version 0.1 | |||||
| // @description sometimes settings block the hypothes.is bookmarklet from working. this uses a sledgehammer to make it work. | |||||
| // @author https://maya.land/ | |||||
| // @match https://news.ycombinator.com/* | |||||
| // @match https://*.marginalia.nu/* | |||||
| // @match https://*.bulletin.com/* | |||||
| // @match https://forum.obsidian.md/* | |||||
| // @grant none | |||||
| // ==/UserScript== | |||||
| (function() { | |||||
| 'use strict'; | |||||
| window.hypothesisConfig=function(){return{showHighlights:true,appType:'bookmarklet'};}; | |||||
| var d=document,s=d.createElement('script'); | |||||
| s.setAttribute('src','https://hypothes.is/embed.js'); | |||||
| d.body.appendChild(s) | |||||
| })(); | |||||
| ``` | |||||