1. 14 Jun, 2017 8 commits
    • Sean Hammond's avatar
      Add hostPageSetting() method (not used yet) · 5a2181e3
      Sean Hammond authored
      Add a new `annotator.config.settingsFrom#hostPageSetting(settingName)`
      method that encapsulates a bunch of logic in one method:
      
      - It always returns null if the client is from a browser extension.
        Browser extensions don't read settings from the host page.
      - If the host page's `window.hypothesisConfig()` function returned a
        value for the requested setting, `hostPageSetting(settingName)` returns
        that value.
      - If `hypothesisConfig()` doesn't return the setting it looks for it in
        `js-hypothesis-config` scripts in the host page
      - If the setting isn't defined in either place it returns `undefined`.
      5a2181e3
    • Robert Knight's avatar
      Merge pull request #437 from hypothesis/turn-config-settings-into-one-closure-func · 6d9bd921
      Robert Knight authored
      (config 3/n): Turn the settings obj into a settingsFrom function 
      6d9bd921
    • Sean Hammond's avatar
      Turn the settings obj into a settingsFrom function · ae3e804a
      Sean Hammond authored
      annotator.config.settings currently exports an object containing
      individual standalone functions for returning different settings'
      values:
      
          module.exports = {
            app: appFunction,
            annotations: annotationsFunction,
            ...
          };
      
      Change it to export just a single constructor function - settingsFrom()
      - that returns an object containing the previously-exported functions as
      methods:
      
          function settingsFrom(window_) {
            ...
            return {
              get app() { return app(); },
              get annotations() { return annotations(); },
              ...
            };
          }
      
          module.exports = settingsFrom;
      
      Note that ES5 getters are used so that, even though app() and
      annotations() are methods rather than simple properties now, they can
      still be accessed as properties - settings.app not settings.app(). This
      makes the code that uses this object slightly simpler, and makes mocking
      this object in unit tests simpler.
      
      The diff of this commit looks big, because the indentation of a lot of
      code is changed, but it really is just changing functions into methods
      and not actually changing the code of any of those functions.
      
      The reason for turning functions into an object with methods is so that
      the object that settingsFrom() returns can have state (by having closure
      variables inside the settingsFrom() function). We don't make any use of
      this state yet but future commits will do.
      ae3e804a
    • Robert Knight's avatar
      Merge pull request #436 from hypothesis/move-configFuncSettingsFrom-into-own-file · f13dbe86
      Robert Knight authored
      (config 2/n): Move configFuncSettingsFrom() into its own file
      f13dbe86
    • Sean Hammond's avatar
      Move configFuncSettingsFrom() into its own file · 287ea62b
      Sean Hammond authored
      Cut-paste the configFuncSettingsFrom() function and its unit tests out
      of settings.js and into its own config-func-settings-from.js file.
      
      This is because in a future refactoring index.js isn't going to call
      configFuncSettingsFrom() anymore, only settings.js will call it, which
      would make configFuncSettingsFrom() a private helper function of
      settings.js, but I don't want to lose configFuncSettingsFrom()'s unit
      tests so I'm moving it into its own file from where settings.js (in the
      future, index.js currently) can import and use it. This way
      configFuncSettingsFrom() remains part of the public API of its
      containing module and can have unit tests.
      287ea62b
    • Robert Knight's avatar
      Merge pull request #435 from hypothesis/move-isBrowserExtension-into-own-file · e4cd67e8
      Robert Knight authored
      (config 1/n): Move isBrowserExtension() into own file
      e4cd67e8
    • Sean Hammond's avatar
      Merge pull request #441 from hypothesis/gulp-sass-upgrade · b3e9276c
      Sean Hammond authored
      Upgrade gulp-sass
      b3e9276c
    • Sean Hammond's avatar
      Merge pull request #431 from hypothesis/tags-decaf · 9051fefd
      Sean Hammond authored
      Convert tags service to JS
      9051fefd
  2. 13 Jun, 2017 5 commits
  3. 12 Jun, 2017 14 commits
  4. 08 Jun, 2017 10 commits
  5. 07 Jun, 2017 3 commits