1. 08 Jun, 2017 9 commits
  2. 07 Jun, 2017 8 commits
    • Sean Hammond's avatar
      Don't throw if hypothesisConfig() isn't a function · 1376ebb0
      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.
      1376ebb0
    • Sean Hammond's avatar
      Don't throw on invalid JSON · a6869f48
      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.
      a6869f48
    • Sean Hammond's avatar
      Small formatting improvement · 983d75cd
      Sean Hammond authored
      983d75cd
    • Sean Hammond's avatar
      Simplify reading query and annotations · 3a234d07
      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.
      3a234d07
    • Sean Hammond's avatar
      Merge pull request #424 from hypothesis/extract-configFuncSettingsFrom · 2a99b84b
      Sean Hammond authored
      Extract a new configFuncSettingsFrom() function
      2a99b84b
    • Sean Hammond's avatar
      Update docs link · 5bce43e6
      Sean Hammond authored
      5bce43e6
    • Robert Knight's avatar
      Merge pull request #422 from hypothesis/extract-app-function · a7454216
      Robert Knight authored
      Extract app() into separate function
      a7454216
    • Robert Knight's avatar
      Merge pull request #423 from hypothesis/simplify-a-test-fake · 58e214a2
      Robert Knight authored
      Simplify a test fake
      58e214a2
  3. 06 Jun, 2017 12 commits
  4. 05 Jun, 2017 11 commits
    • Robert Knight's avatar
      Merge pull request #419 from hypothesis/fix-ghost-adder · 2c4d883e
      Robert Knight authored
      Fix ghost adder
      2c4d883e
    • Sean Hammond's avatar
      Correct a comment · 488c5b4f
      Sean Hammond authored
      The adder is not off screen, it's in the top-left corner.
      488c5b4f
    • Sean Hammond's avatar
      Hide the <hypothesis-adder-toolbar> not its parent · c9f31eca
      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
      c9f31eca
    • Sean Hammond's avatar
      Access element as self.element · 9ba75b00
      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.
      9ba75b00
    • Robert Knight's avatar
      Move search URI extraction to a selector · 24a44817
      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.
      24a44817
    • Robert Knight's avatar
      Save document metadata in app state. · 58ee6ee2
      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.
      58ee6ee2
    • Robert Knight's avatar
      Add basic test for `<help-panel>` component. · a31ca792
      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.
      a31ca792
    • Sean Hammond's avatar
      Move extract-annotation-query.js to settings.js · b9860ff6
      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.
      b9860ff6
    • Sean Hammond's avatar
      Move config.js into config/ dir · b6f282c8
      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.
      b6f282c8
    • Sean Hammond's avatar
      Merge pull request #410 from hypothesis/ext-ignore-host-config · 0d8dbabb
      Sean Hammond authored
      Ignore all config other than direct linked ID  from host page.
      0d8dbabb
    • Sheetal Umesh Kumar's avatar
      When the client is injected by the browser extension, it should ignore most · 2e72d312
      Sheetal Umesh Kumar authored
      configuration on the host page other than the query and annotations.
      
      Fixes https://github.com/hypothesis/product-backlog/issues/209
      2e72d312