From 6d68469f7bbbbf44ed04e9a1f433860a64b7e6b7 Mon Sep 17 00:00:00 2001 From: ubuntu Date: Tue, 8 Feb 2022 10:51:09 -0800 Subject: [PATCH] automated commit from wiki --- user-scripts-hypothesis.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 user-scripts-hypothesis.md diff --git a/user-scripts-hypothesis.md b/user-scripts-hypothesis.md new file mode 100644 index 0000000..7d7459a --- /dev/null +++ b/user-scripts-hypothesis.md @@ -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) +})(); +``` \ No newline at end of file