- 08 Jun, 2017 9 commits
-
-
Sean Hammond authored
-
Sean Hammond authored
-
Sean Hammond authored
-
Sean Hammond authored
-
Sean Hammond authored
If the host page contains a service setting then the client should de…
-
Robert Knight authored
Don't throw if hypothesisConfig() isn't a function
-
Robert Knight authored
Don't throw on invalid JSON
-
Robert Knight authored
Simplify reading query and annotations
-
Sheetal Umesh Kumar authored
We need to be able to support the client to work with different annotation services, other than just `https://hypothes.is/api`. If the settings from the host doesn't specify a service, the client should fall back to using the default apiUrl which would be `https://hypothes.is/api`. https://github.com/hypothesis/product-backlog/issues/278
-
- 07 Jun, 2017 8 commits
-
-
Sean Hammond authored
Log a warning, rather than throwing an error, if window.hypothesisConfig() exists but isn't a function. "Warn but continue" is in line with our general approach to handling invalid configuration in the client. For example if there's an invalid js-hypothesis-config script in the page it logs a warning and continues. For some required config settings, such as config.app, if the setting is invalid then the client crashes out immediately because it can't continue. But otherwise it should warn and continue.
-
Sean Hammond authored
Don't throw an error when parsing an invalid js-hypothesis-config JSON script. This error thrown by shared.settings#jsonConfigsFrom() was caught in one of the places where that function is called, but not in other places where it's called. Move the error catching and warning logging into the shared function instead. This now means, for example, that boot/index.js no longer crashes (bringing down the entire app) if the host page contains an invalid js-hypothesis-config. Unfortunately since jsonConfigsFrom() is called _twice_ on page load to read the same js-hypothesis-config objects from the host page (it's called once by boot/index.js and once by annotator/config/config.js) if there's an invalid js-hypothesis-config a warning about it will be logged twice.
-
Sean Hammond authored
-
Sean Hammond authored
There was some code complexity here aimed at ensuring that _either_ config.annotations or config.query would be set but never both. It isn't really necessary for the code to maintain this condition, especially given that the way that both settings are read from the URL fragment means that both cannot be present at once anyway.
-
Sean Hammond authored
Extract a new configFuncSettingsFrom() function
-
Sean Hammond authored
-
Robert Knight authored
Extract app() into separate function
-
Robert Knight authored
Simplify a test fake
-
- 06 Jun, 2017 12 commits
-
-
Sean Roberts authored
-
Sean Roberts authored
-
Sean Hammond authored
Extract some code for reading config settings from a window.hypothesisConfig() function out of annotator.config.config#configFrom() and into a new, separate function annotator.config.settings#configFuncSettingsFrom(). This function can now be unit-tested separately and the long configFrom() function gets a bit shorter.
-
Sean Hammond authored
-
Sean Hammond authored
-
Sean Hammond authored
Extract the code for reading the config.app setting into a separate function. This function can now be unit tested separately, and the long configFrom() function gets a little shorter.
-
Sean Hammond authored
Search by DOI: Include DOI URIs in search URI list
-
Robert Knight authored
When the `search_for_doi` feature flag is enabled, include `doi:` URIs in the query to the `/annotations/search` endpoint. This enables the client to fetch annotations made on different URLs which are associated with the same DOI as the current page.
-
Sean Roberts authored
adding console log capture to karma
-
Sean Hammond authored
Search by DOI: Add document metadata to app state
-
Sean Hammond authored
Move config.js and extract-annotation-query.js into new config dir
-
Sean Hammond authored
-
- 05 Jun, 2017 11 commits
-
-
Robert Knight authored
Fix ghost adder
-
Sean Hammond authored
The adder is not off screen, it's in the top-left corner.
-
Sean Hammond authored
Hide the `<hypothesis-adder-toolbar>` element, rather than its containing `<hypothesis-adder>` element, when hiding/showing the adder. Since 56f5243e hiding the parent `<hypothesis-adder>` element doesn't work because, to protect them from third-party CSS elsewhere in the DOM, its child elements no longer inherit its CSS properties. Fixes https://github.com/hypothesis/client/issues/414
-
Sean Hammond authored
Adder() contains a `var self = this` line and a line that assigns the `element` that `createAdderDOM()` returns to `this.element`, but it usually accesses `element` via the local variable element (and occassionally as `this.element`). Change this to be consistent: assign `self.element = createAdderDOM()`; always access it as `self.element` not `this.element`; delete the local variable `element`. This just makes the code a little simpler and more self-consistent.
-
Robert Knight authored
Move the extraction of search URIs from frame metadata out of the callback for the "getDocumentInfo" cross-frame request and into a selector function. This will make it easier to change the set of search URIs that the client sends for a given set of connected frames depending on enabled features. It also makes it easier to implement tests for this. * Remove `searchUris` from frame objects in the app state and instead compute this list on-demand from the frame URI and metadata when needed.
-
Robert Knight authored
In preparation for conditionally including 'doi:' URIs in the set of search URIs depending on the active feature flags, store the complete document metadata for connected frames in the app state, instead of just extracting the document fingerprint and search URIs. This will allow the code that searches for annotations to later extract the set of search URIs just before it sends the query, at a point when the client has feature flag information.
-
Robert Knight authored
In particular add a test for the `documentFingerprint` property in preparation for changing the structure of frames objects in the app state.
-
Sean Hammond authored
extract-annotation-query.js is purely about reading a couple of config settings and is only used by config/config.js, so move it from the util/ dir into a new config/settings.js file. config/settings.js is going to become a file containing all of the different functions for reading different config settings. These functions are imported and used by config/settings.js. For a start, move extract-annotation-query.js's two functions into settings.js, but later we'll be adding more functions to this file. These functions are in a separate settings.js file, rather than just in the config.js file that uses them, so that they can be unit tested separately.
-
Sean Hammond authored
Add a src/annotator/config/ directory to contain all config-related code for the src/annotator/ part of the code. Move config.js into the directory. We're going to be adding more config-related files in this directory later.
-
Sean Hammond authored
Ignore all config other than direct linked ID from host page.
-
Sheetal Umesh Kumar authored
configuration on the host page other than the query and annotations. Fixes https://github.com/hypothesis/product-backlog/issues/209
-