Skip to content

Instantly share code, notes, and snippets.

@AFutureD
Last active January 7, 2024 23:00
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AFutureD/7a5674cd515ebb57db7ac5b5bff47049 to your computer and use it in GitHub Desktop.
Save AFutureD/7a5674cd515ebb57db7ac5b5bff47049 to your computer and use it in GitHub Desktop.
A Tempermonkey script for Hypothes.is
// ==UserScript==
// @name Hypothesis
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author AFuture
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
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)
var css = ""; css += [
"[class^=\"annotator-bucket-bar\"]{display:none;}"
].join("\n");
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
var heads = document.getElementsByTagName("head");
if (heads.length > 0) { heads[0].appendChild(node); }
else { document.documentElement.appendChild(node); }
})();
@vanbang9710
Copy link

Could you please change the file name to Hypothesis.user.js for easier integration to Tampermonkey?

@AFutureD
Copy link
Author

@vanbang9710 Hi, I'v changed the file name as you wish.

@tophee
Copy link

tophee commented May 22, 2023

I wonder whether there is any way of hiding the hypothesis sidebar (without deactivating the script), or perhaps moving the expand button ("<") to a different place?

Reason: in its default position at the top right corner, that button tends to cover site navigation or menu items. A floating button that can be positioned wherever it's not in the way would be great!

@Qusunyee
Copy link

用了好几年,才找到这个好东西

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment