manubot / rootstock

Clone me to create your Manubot manuscript
https://manubot.github.io/rootstock/
Other
451 stars 178 forks source link

Toggle Annotate/Highlight Popup // Add Unhighlight Ability #111

Open Miserlou opened 6 years ago

Miserlou commented 6 years ago

I highlight text with my mouse as I'm reading this. Apparently, there are lots of us who do this.

This is really annoying on Manubot HTML outputs because the highlight popup comes up every time. One time I clicked it by mistake and now there's no way for me to get rid of my highlight and I feel like a jackass who highlighted some unimportant text.

It'd be great if I could a) toggle the highlight-popup and b) un-highlight.

dhimmel commented 6 years ago

This is due to the Hypothesis integration from https://github.com/greenelab/manubot-rootstock/issues/90 / https://github.com/greenelab/manubot-rootstock/issues/95.

I agree it'd be nice to have Hypothesis popovers and highlighting be more optional. For example, they could be off by default with the option to activate in the Hypothesis sidebar. @dsiddy do you know if there are any configuration options for https://github.com/hypothesis/client that would allow the user to enable/disable popovers and highlighting as desired?

@Miserlou also note that you can disable Hypothesis integration for a specific manuscript by removing the line:

https://github.com/greenelab/manubot-rootstock/blob/310dd078c4c60bedd63442f93906f26a4ea25a4b/build/build.sh#L41

dsiddy commented 6 years ago

@dhimmel, the showHighlights option may be worth a look. It doesn't affect the pop-up, regrettably, but will allow you to hide highlights by default if that's what you're after.

@Miserlou, my tests suggest that your highlights shouldn't persist on page reload unless you're logged in to Hypothesis, in which case you should be able to delete them from the sidebar. If I'm mistaken, though, please feel free to elaborate and we can troubleshoot further.

dhimmel commented 4 years ago

@vincerubinetti: would it be hard for us to create a little button or something that enables/disables hypothesis altogether?

vincerubinetti commented 4 years ago

Probably not hard. We might be able to make it easier/better to use when it is open/active, too. I'm not thrilled about Hypothesis's UI in general.

As a side note, does Hypothesis have no competitors that we could try out?

dhimmel commented 4 years ago

As a side note, does Hypothesis have no competitors that we could try out?

One aspect of Hypothesis is that they currently host the largest open corpus of annotations. I think we do want comments to become part of this corpus, although that should be possible with a different frontend. Not sure if any of the services listed here are alternative viewers that use the same database backend and account system.

dhimmel commented 4 years ago

Was talking with @dwhly from Hypothesis at a "Beyond Preprints" workshop about the ability to tobble on and off the Hypothesis extension. He pointed me to this source code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Hypothesis Button Test</title>
</head>
<body>
    <div class = 'hypothesis_status'></div>
    <script>function toggle_visibility(){var e=document.querySelector(".annotator-frame");if(e&&"none"!=e.style.display)e&&(e.style.display="none"),document.head.removeChild(document.getElementById("hypothesis_embed_script"));else{e&&(e.style.display="block");var t=document.createElement("script");t.type="text/javascript",t.id="hypothesis_embed_script",t.src="https://hypothes.is/embed.js",t.async=!1,document.head.appendChild(t)}}function reqListener(){console.log(this.responseText),respObj=JSON.parse(this.responseText);var e=document.createElement("div");e.style.backgroundImage="url('http://hypothesisjournal.herokuapp.com/static/icon.png')",e.style.backgroundRepeat="no-repeat",e.style.backgroundSize="contain",e.style.width="25px",e.style.height="30px",document.querySelector(".hypothesis_status").appendChild(e);var t=document.createElement("div");t.style.textAlign="center",t.innerHTML=respObj.total,document.querySelector(".hypothesis_status").appendChild(t),document.querySelector(".hypothesis_status").addEventListener("click",toggle_visibility)}document.querySelector(".hypothesis_status").style["float"]="left",document.querySelector(".hypothesis_status").style.cursor="pointer";var oReq=new XMLHttpRequest;oReq.addEventListener("load",reqListener),oReq.open("GET","https://hypothes.is//api/search?uri="+window.location.href),oReq.send();</script>
</body>
</html>

@vincerubinetti perhaps this will be of some use.

dwhly commented 4 years ago

@judell Probably has a better example ^