hypothesis / hypothesis/product-backlog
Feature to enable/disable Hypothesis client on client side routed websites
- Dominant language
- No language data
- Stars
- 122
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
## Feature Request Form
### Problem you are trying to address with this feature
We would like to enable the Hypothesis embedded client on certain pages of our client side routed single page website www.semanticscholar.org. Currently we have to unload and re-load the client after each navigation. Requesting for a feature to suppress and enable the client on certain pages.
### Current workaround
On componentDidMount
```
const script = document.createElement('script');
script.url = 'https://hypothes.is/embed.js';
head.appendChild(BrowserUtil.createScript(url));
```
On componentUnmont
```
const script = document.querySelector(`script[src='https://hypothes.is/embed.js']`);
script.parentNode.removeChild(script);
const annotatorLink = document.querySelector('link[type="application/annotator+html"]');
const destroyEvent = new Event('destroy');
annotatorLink.dispatchEvent(destroyEvent);
```
### Add tags - did you add labels?
If this a customer requested feature, make sure to add that label.
Allen Institute for AI - Semantic Scholar (www.semanticscholar.org)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the componentDidMount/componentUnmont workaround and the https://hypothes.is/embed.js lifecycle described in the issue. Define the enable/disable behavior for client-side route changes and how completion will be verified; no repository files or tests are named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100