1. 21 Mar, 2016 7 commits
    • Robert Knight's avatar
      Clarify why the GROUP_FOCUSED event is ignored if an annotation fetch is in progress · abd2c79b
      Robert Knight authored
      Also avoid using `@p` to refer to parameter names in function
      documentation, since this isn't valid JSDoc syntax. Use markdown
      backticks instead, following conventions in Angular's docs.
      abd2c79b
    • Robert Knight's avatar
      Unload all current annotations when new frames connect · 20db17a6
      Robert Knight authored
      The sidebar supports multiple client pages connecting to it
      and displaying annotations for all of the connected clients.
      As far as I am aware, this functionality is not actually used
      anywhere, but this commit fixes an issue where annotations
      would be loaded multiple times for some clients if multiple
      clients connected.
      20db17a6
    • Robert Knight's avatar
      Extract 'noCallThru' helper into a separate module. · 75e1309f
      Robert Knight authored
      This was duplicated with varying levels of explanation in several
      places.
      
      Although the function is trivial, having it in its own module is useful
      for documentation on why it should be used by default.
      75e1309f
    • Robert Knight's avatar
      Focus the first selected annotation on load · f3f3fce4
      Robert Knight authored
      When the selection is initialized as a result of following
      a direct link to an annotation, focus and scroll to the annotation
      after it has been successfully fetched from the service.
      f3f3fce4
    • Robert Knight's avatar
      Switch to the group containing the selected annotation · 5a04f66c
      Robert Knight authored
      When the sidebar loads as a result of an '#annotations'
      fragment, we do not know which group that annotation is in.
      
      Handle this by first fetching annotations in all groups,
      then finding the group containing the selected annotation(s)
      and finally filtering the results by that group.
      
      An alternative approach would be to first fetch the
      selected annotations in order to determine the group and
      then fetching annotations in that group.
      
      This approach however avoids an extra round-trip to the server
      in the common case where the total number of annotations across
      all groups is less than the default chunk size (200).
      5a04f66c
    • Robert Knight's avatar
      Avoid emitting GROUP_FOCUSED event if the group has not changed · c81fea3c
      Robert Knight authored
      widget-controller.js triggers a reload of annotations whenever a
      GROUP_FOCUSED event is emitted. Avoid reloading annotations
      unnecessarily if group.focus() is called with the currently focused
      group.
      c81fea3c
    • Robert Knight's avatar
      Factor out pagination through search results into a separate module · 23256279
      Robert Knight authored
      Extract the logic for paging through search results from
      the API into a separate module.
      23256279
  2. 16 Mar, 2016 6 commits
    • Nick Stenning's avatar
      Merge pull request #3085 from hypothesis/open-sidebar-when-annot-fragment-present · e32aa63c
      Nick Stenning authored
      (1/3) Open sidebar and set selection when '#annotations' URL fragment is present
      e32aa63c
    • Robert Knight's avatar
      Initialize the selected annotations from app settings · 7f69532e
      Robert Knight authored
      When the sidebar loads in a page with a '#annotations'
      URL fragment, the 'annotations' setting will be
      passed through to the client as `settings.annotations`.
      
      Use this to initialize the selection so that
      the annotation specified by '#annotations:<ID>' is
      selected when the client loads.
      7f69532e
    • Robert Knight's avatar
      Open the sidebar on load in response to annotations fragment · 11eb5fa2
      Robert Knight authored
      If the host page's URL contains a '#annotations:' fragment,
      open the sidebar automatically when the client loads.
      
       * Move code for reading Hypothesis configuration from
         the environment into config.js and add tests
      
       * Read the '#annotations' fragment from the URL and
         pass it to app.html along with any other options
         as query string parameters.
      11eb5fa2
    • Nick Stenning's avatar
      Merge pull request #3094 from hypothesis/postgres-storage-expand_uri · 76478213
      Nick Stenning authored
      Postgres read support for storage.expand_uri
      76478213
    • Nick Stenning's avatar
      Merge pull request #3097 from hypothesis/291-detect-existing-h-client · d7063ecb
      Nick Stenning authored
      Enable Chrome extension to detect when H is already present on page
      d7063ecb
    • Robert Knight's avatar
      Enable Chrome extension to detect when H is already present on page · 1bfb930a
      Robert Knight authored
      This reworks the way that Hypothesis detects whether it is
      already present on the page in embed.js, in a way that
      enables it to report back the app.html URL for the
      existing instance to the Chrome extension.
      
      The Chrome extension can then update its state for that
      tab to reflect the fact that it is not injected.
      
      In this PR, that is done by simply setting the tab state
      to inactive. We could in future add an indicator that
      the user tried to activate H but that another instance
      is already active, or have the extension override the
      instance of H on the page.
      
       * Detect the <link> element added to the page by embed.js,
         rather than window.annotator. This enables detection to work
         when embed.js is run in an isolated world that shares the DOM
         but not the JS environment, as is the case for content scripts
         in Chrome and Firefox.
      
       * Change unloading to operate by firing an event at the <link>
         element. This enables a content script to trigger unloading
         of H from an isolated JS environment.
      
       * Change injection of embed.js in the Chrome extension to
         execute embed.js as a content script, rather than by
         adding it as a `<script>` tag. This enables embed.js to
         access extension APIs and also report its result back
         to the extension via the return value of the script.
      
         A side benefit is that it also avoids a bug in Firefox
         current WebExtensions implementation where `<script>` tags
         added to the page by a content script are not executed.
      1bfb930a
  3. 15 Mar, 2016 3 commits
    • Nick Stenning's avatar
      Merge pull request #3084 from hypothesis/simplify-client-auth · 229616ce
      Nick Stenning authored
      Simplify API authentication in the client and fix #3083, #2924
      229616ce
    • Nick Stenning's avatar
      Merge pull request #3078 from... · 9f1eb5ef
      Nick Stenning authored
      Merge pull request #3078 from hypothesis/sheetaluk/281-update-the-toolbar-s-note-icon-tooltip-and-update-the-adder-design
      
      changing adder icons and note icon in toolbar.
      9f1eb5ef
    • Sheetal Umesh Kumar's avatar
      changing adder icons and note icon in toolbar. · 0717221f
      Sheetal Umesh Kumar authored
      Addressing some PR comments.
      
      Changed styling of the adder a bit.
      Changed annotatoin icon click on the toolbar to create a new annotation instead of a new page note, when text has been selected.
      Added a for attr for icon labels in the adder.
      
      getting scripts/update-icon-font from branch: annotation-card-design-refresh
      
      comitting new woff and icomoon css
      
      showing adder in the middle top of selection rather than mousePosition.
      
      Revert "showing adder in the middle top of selection rather than mousePosition."
      
      This reverts commit 99491e42eb4103953f0cfa87afdd37e5ac8ece4d.
      
      showing adder a little above the mouse position
      
      check for end of text selection after current event loop tick
      
      only show tooltip for toolbar and not adder
      
      cursor pointer for adder labels
      
      some styling
      
      cleaning up css nesting.
      
      more styling :/
      
      Eliminate deadzone in adder buttons
      
       * Remove the margin between the adder buttons and the
         edge of the toolbar, and apply padding to the buttons instead.
         This removes the deadzone between the edge of the visible toolbar
         and the clickable area.
      
       * Add pointer cursor for the buttons
      
       * Use flexbox for laying out the toolbar for consistency
         with how the Adder is laid out
      
       * Use a transparent background for the individual buttons, so
         that their background does not obscure the rounded borders
         of the toolbar.
      
      removing console.log
      0717221f
  4. 14 Mar, 2016 2 commits
  5. 11 Mar, 2016 1 commit
  6. 10 Mar, 2016 3 commits
    • Robert Knight's avatar
      Simplify API authentication in the client · e5af8365
      Robert Knight authored
      In order to make API requests, the client needs to
      fetch a JWT token and then configure 'angular-jwt'
      to provide it on subsequent HTTP requests to
      API endpoints.
      
      This fairly simple task was complicated by
      the inclusion of an emulation of the deprecated
      Mozilla IdentityManager API - see https://developer.mozilla.org/en-US/docs/Web/API/IdentityManager
      
      This commit replaces the identity module with
      a much simpler implementation that only does
      what we actually need at present:
      
       1. Enable the 'angular-jwt' interceptor which
          adds 'Authorization: Bearer <Token>' headers
          to API HTTP requests.
      
       2. Provide the JWT interceptor with a function
          which fetches JWT tokens and caches them.
      
      The new implementation fixes two bugs in the previous
      implementation:
      
       1. Cached API tokens were not invalidated properly when
          signing out (#3083).
      
          (In the old code, 'authPromise' was set to a rejected promise
           after signing out, but 'checkAuthentication()' checked for
           'authPromise' being _null_ when deciding whether to retrieve
           a new token. Consequently API requests made immediately
           after signing in could end up being unauthenticated).
      
       2. The value of $scope.auth.username and session.state.userid
          could get out of sync (#2924).
      
          In the new implementation, $scope.auth.username is always
          updated whenever the USER_CHANGED event is emitted and that
          event is always emitted when session.state.userid changes.
      
      Fixes #3083
      Fixes #2924
      e5af8365
    • Nick Stenning's avatar
      Merge pull request #3075 from hypothesis/decaf-tool · e0ef6831
      Nick Stenning authored
      Add a utility script to assist with CoffeeScript -> JS conversion
      e0ef6831
    • Nick Stenning's avatar
      Merge pull request #3074 from hypothesis/annotation-ui-decaf · 111f29c1
      Nick Stenning authored
      Convert 'annotation-ui' from CoffeeScript to JS
      111f29c1
  7. 09 Mar, 2016 4 commits
    • Nick Stenning's avatar
      Merge pull request #3042 from hypothesis/remove-mathjax-fallback · 38010360
      Nick Stenning authored
      Remove the MathJax math rendering fallback
      38010360
    • Robert Knight's avatar
    • Robert Knight's avatar
      Add a utility script to assist with CoffeeScript -> JS conversion · c0a2709b
      Robert Knight authored
      It accepts a list of CoffeeScript file paths on stdin
      and for each <path>.coffee file in the input, it writes
      a <path>.js output file containing the converted,
      reformatted source.
      
      The result is ES2015 source so will require some
      fixups as long as we're using ES5 in the main app
      codebase.
      
      The current transformation process involves:
      
       1. Performing an initial CoffeeScript -> JS
          conversion with 'decaffeinate'
      
       2. Applying some fixups for common issues, currently
          done with dumb string modifications.
      
          In future I might look at writing a Babel transformer.
      
       3. Parsing the source with Babylon to check that it is valid ES2015
          If not, the user is prompted to go and simplify the CoffeeScript
          so that decaffeinate can process it correctly.
      
       4. Reformatting the source with typescript-formatter, which
          takes care of indentation and high-level formatting.
      
       5. Running the source through JSCS' fix mode which deals
          with smaller details.
      c0a2709b
    • Robert Knight's avatar
      Convert 'annotation-ui' from CoffeeScript to JS · 57209793
      Robert Knight authored
      Since this is a very simple module with no Angular
      dependencies, I've also de-Angularized the unit test.
      57209793
  8. 08 Mar, 2016 3 commits
    • Nick Stenning's avatar
      Merge pull request #3065 from hypothesis/url-polyfill-update · 77db5fd6
      Nick Stenning authored
      Fix installation of URL polyfill with js-polyfills v0.1.16
      77db5fd6
    • Robert Knight's avatar
      Fix installation of URL polyfill with js-polyfills v0.1.16 · e76f270b
      Robert Knight authored
      js-polyfills v0.1.15 used to install the polyfill on
      `this.URL`, where `this` was set to module.exports in
      the context of a Browserify bundle. Consequently the result
      was available as `require('js-polyfills/url').URL`.
      
      As of v0.1.16 however, it installs the polyfill on `self`,
      which is the Window object in the context of the browser
      and so `require('js-polyfills/url').URL` is undefined.
      
      Fixes #3064
      e76f270b
    • Robert Knight's avatar
      Remove the MathJax math rendering fallback · 715b1a52
      Robert Knight authored
      The MathJax fallback was inadvertently broken during recent
      refactoring of the <markdown> component and has long been untested.
      
      This removes the fallback for the moment and in doing so
      provides a clearer definition of what math we support -
      the subset supported by KaTeX.
      
      Looking at our public annotations, there is very little use
      of complex math currently.
      
      When we find a clear use case for it, we can revisit supporting
      additional math beyond what KaTeX supports.
      
      See https://trello.com/c/9KkjsO6v/66-remove-the-mathjax-fallback
      for more background.
      715b1a52
  9. 07 Mar, 2016 5 commits
  10. 05 Mar, 2016 2 commits
  11. 04 Mar, 2016 4 commits