Skip to content

Commit e42f89d

Browse files
authored
Merge pull request #453 from hypothesis/rename-app-to-sidebarAppUrl
Rename config.app to sidebarAppUrl
2 parents 46ea097 + 1fcb15c commit e42f89d

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/annotator/config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var settingsFrom = require('./settings');
1010
function configFrom(window_) {
1111
var settings = settingsFrom(window_);
1212
return {
13-
app: settings.app,
13+
sidebarAppUrl: settings.sidebarAppUrl,
1414
query: settings.query,
1515
annotations: settings.annotations,
1616
showHighlights: settings.showHighlights,

src/annotator/config/settings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function settingsFrom(window_) {
2323
* no href.
2424
*
2525
*/
26-
function app() {
26+
function sidebarAppUrl() {
2727
var link = window_.document.querySelector('link[type="application/annotator+html"]');
2828

2929
if (!link) {
@@ -110,7 +110,7 @@ function settingsFrom(window_) {
110110
function hostPageSetting(name, options = {}) {
111111
var allowInBrowserExt = options.allowInBrowserExt || false;
112112

113-
if (!allowInBrowserExt && isBrowserExtension(app())) {
113+
if (!allowInBrowserExt && isBrowserExtension(sidebarAppUrl())) {
114114
return null;
115115
}
116116

@@ -126,7 +126,7 @@ function settingsFrom(window_) {
126126
}
127127

128128
return {
129-
get app() { return app(); },
129+
get sidebarAppUrl() { return sidebarAppUrl(); },
130130
get annotations() { return annotations(); },
131131
get showHighlights() { return showHighlights(); },
132132
get query() { return query(); },

src/annotator/config/test/index-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('annotator.config.index', function() {
2626
});
2727

2828
[
29-
'app',
29+
'sidebarAppUrl',
3030
'query',
3131
'annotations',
3232
'showHighlights',
@@ -44,7 +44,7 @@ describe('annotator.config.index', function() {
4444
beforeEach('remove the application/annotator+html <link>', function() {
4545
Object.defineProperty(
4646
fakeSettingsFrom(),
47-
'app',
47+
'sidebarAppUrl',
4848
{
4949
get: sinon.stub().throws(new Error("there's no link")),
5050
}

src/annotator/config/test/settings-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('annotator.config.settingsFrom', function() {
2929
fakeSharedSettings.jsonConfigsFrom = sinon.stub().returns({});
3030
});
3131

32-
describe('#app', function() {
32+
describe('#sidebarAppUrl', function() {
3333
function appendLinkToDocument(href) {
3434
var link = document.createElement('link');
3535
link.type = 'application/annotator+html';
@@ -52,7 +52,7 @@ describe('annotator.config.settingsFrom', function() {
5252
});
5353

5454
it('returns the href from the link', function() {
55-
assert.equal(settingsFrom(window).app, 'http://example.com/app.html');
55+
assert.equal(settingsFrom(window).sidebarAppUrl, 'http://example.com/app.html');
5656
});
5757
});
5858

@@ -71,7 +71,7 @@ describe('annotator.config.settingsFrom', function() {
7171
});
7272

7373
it('returns the href from the first one', function() {
74-
assert.equal(settingsFrom(window).app, 'http://example.com/app1');
74+
assert.equal(settingsFrom(window).sidebarAppUrl, 'http://example.com/app1');
7575
});
7676
});
7777

@@ -89,7 +89,7 @@ describe('annotator.config.settingsFrom', function() {
8989
it('throws an error', function() {
9090
assert.throws(
9191
function() {
92-
settingsFrom(window).app; // eslint-disable-line no-unused-expressions
92+
settingsFrom(window).sidebarAppUrl; // eslint-disable-line no-unused-expressions
9393
},
9494
'application/annotator+html link has no href'
9595
);
@@ -100,7 +100,7 @@ describe('annotator.config.settingsFrom', function() {
100100
it('throws an error', function() {
101101
assert.throws(
102102
function() {
103-
settingsFrom(window).app; // eslint-disable-line no-unused-expressions
103+
settingsFrom(window).sidebarAppUrl; // eslint-disable-line no-unused-expressions
104104
},
105105
'No application/annotator+html link in the document'
106106
);

src/annotator/host.coffee

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ module.exports = class Host extends Guest
2222
if service.onHelpRequest
2323
service.onHelpRequestProvided = true
2424

25-
# Make a copy of all config settings except `config.app`, the app base URL,
25+
# Make a copy of all config settings except `config.sidebarAppUrl`, the app base URL,
2626
# and `config.pluginClasses`
2727
configParam = 'config=' + encodeURIComponent(
28-
JSON.stringify(Object.assign({}, config, {app:undefined, pluginClasses: undefined }))
28+
JSON.stringify(Object.assign({}, config, {sidebarAppUrl: undefined, pluginClasses: undefined }))
2929
)
30-
if config.app and '?' in config.app
31-
config.app += '&' + configParam
30+
if config.sidebarAppUrl and '?' in config.sidebarAppUrl
31+
config.sidebarAppUrl += '&' + configParam
3232
else
33-
config.app += '?' + configParam
33+
config.sidebarAppUrl += '?' + configParam
3434

3535
# Create the iframe
3636
app = $('<iframe></iframe>')
3737
.attr('name', 'hyp_sidebar_frame')
3838
# enable media in annotations to be shown fullscreen
3939
.attr('allowfullscreen', '')
4040
.attr('seamless', '')
41-
.attr('src', config.app)
41+
.attr('src', config.sidebarAppUrl)
4242
.addClass('h-sidebar-iframe')
4343

4444
@frame = $('<div></div>')

src/annotator/test/host-test.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe 'Host', ->
88
hostConfig = {pluginClasses: {}}
99

1010
createHost = (config={}, element=null) ->
11-
config = Object.assign({app: '/base/annotator/test/empty.html'}, hostConfig, config)
11+
config = Object.assign({sidebarAppUrl: '/base/annotator/test/empty.html'}, hostConfig, config)
1212
if !element
1313
element = document.createElement('div')
1414
return new Host(element, config)

0 commit comments

Comments
 (0)