Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
e0020c33
Commit
e0020c33
authored
Jan 15, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert src/annotator/config to ES modules
parent
3f6381db
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
15 additions
and
22 deletions
+15
-22
config-func-settings-from.js
src/annotator/config/config-func-settings-from.js
+1
-3
index.js
src/annotator/config/index.js
+2
-4
is-browser-extension.js
src/annotator/config/is-browser-extension.js
+1
-3
settings.js
src/annotator/config/settings.js
+5
-6
config-func-settings-from-test.js
src/annotator/config/test/config-func-settings-from-test.js
+1
-1
index-test.js
src/annotator/config/test/index-test.js
+2
-2
is-browser-extension-test.js
src/annotator/config/test/is-browser-extension-test.js
+1
-1
settings-test.js
src/annotator/config/test/settings-test.js
+2
-2
No files found.
src/annotator/config/config-func-settings-from.js
View file @
e0020c33
...
...
@@ -16,7 +16,7 @@
* @return {Object} - Any config settings returned by hypothesisConfig()
*
*/
function
configFuncSettingsFrom
(
window_
)
{
export
default
function
configFuncSettingsFrom
(
window_
)
{
if
(
!
window_
.
hasOwnProperty
(
'hypothesisConfig'
))
{
return
{};
}
...
...
@@ -30,5 +30,3 @@ function configFuncSettingsFrom(window_) {
return
window_
.
hypothesisConfig
();
}
module
.
exports
=
configFuncSettingsFrom
;
src/annotator/config/index.js
View file @
e0020c33
const
settingsFrom
=
require
(
'./settings'
)
;
import
settingsFrom
from
'./settings'
;
/**
* Reads the Hypothesis configuration from the environment.
*
* @param {Window} window_ - The Window object to read config from.
*/
function
configFrom
(
window_
)
{
export
default
function
configFrom
(
window_
)
{
const
settings
=
settingsFrom
(
window_
);
return
{
annotations
:
settings
.
annotations
,
...
...
@@ -44,5 +44,3 @@ function configFrom(window_) {
),
};
}
module
.
exports
=
configFrom
;
src/annotator/config/is-browser-extension.js
View file @
e0020c33
...
...
@@ -6,8 +6,6 @@
* website.
*
*/
function
isBrowserExtension
(
app
)
{
export
default
function
isBrowserExtension
(
app
)
{
return
!
(
app
.
startsWith
(
'http://'
)
||
app
.
startsWith
(
'https://'
));
}
module
.
exports
=
isBrowserExtension
;
src/annotator/config/settings.js
View file @
e0020c33
const
configFuncSettingsFrom
=
require
(
'./config-func-settings-from'
);
const
isBrowserExtension
=
require
(
'./is-browser-extension'
);
const
sharedSettings
=
require
(
'../../shared/settings'
);
import
*
as
sharedSettings
from
'../../shared/settings'
;
function
settingsFrom
(
window_
)
{
import
configFuncSettingsFrom
from
'./config-func-settings-from'
;
import
isBrowserExtension
from
'./is-browser-extension'
;
export
default
function
settingsFrom
(
window_
)
{
const
jsonConfigs
=
sharedSettings
.
jsonConfigsFrom
(
window_
.
document
);
const
configFuncSettings
=
configFuncSettingsFrom
(
window_
);
...
...
@@ -214,5 +215,3 @@ function settingsFrom(window_) {
hostPageSetting
:
hostPageSetting
,
};
}
module
.
exports
=
settingsFrom
;
src/annotator/config/test/config-func-settings-from-test.js
View file @
e0020c33
const
configFuncSettingsFrom
=
require
(
'../config-func-settings-from'
)
;
import
configFuncSettingsFrom
from
'../config-func-settings-from'
;
describe
(
'annotator.config.configFuncSettingsFrom'
,
function
()
{
const
sandbox
=
sinon
.
createSandbox
();
...
...
src/annotator/config/test/index-test.js
View file @
e0020c33
const
configFrom
=
require
(
'../index'
)
;
const
{
$imports
}
=
require
(
'../index'
)
;
import
configFrom
from
'../index'
;
import
{
$imports
}
from
'../index'
;
describe
(
'annotator.config.index'
,
function
()
{
let
fakeSettingsFrom
;
...
...
src/annotator/config/test/is-browser-extension-test.js
View file @
e0020c33
const
isBrowserExtension
=
require
(
'../is-browser-extension'
)
;
import
isBrowserExtension
from
'../is-browser-extension'
;
describe
(
'annotator.config.isBrowserExtension'
,
function
()
{
[
...
...
src/annotator/config/test/settings-test.js
View file @
e0020c33
const
settingsFrom
=
require
(
'../settings'
)
;
const
{
$imports
}
=
require
(
'../settings'
)
;
import
settingsFrom
from
'../settings'
;
import
{
$imports
}
from
'../settings'
;
describe
(
'annotator.config.settingsFrom'
,
function
()
{
let
fakeConfigFuncSettingsFrom
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment