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
23578e8f
Commit
23578e8f
authored
Oct 19, 2015
by
Robert Knight
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2633 from hypothesis/csp-friendly-settings
Make settings loader CSP-compatible
parents
f00cd272
3a89d3ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
settings.js
h/static/scripts/settings.js
+9
-7
No files found.
h/static/scripts/settings.js
View file @
23578e8f
...
...
@@ -7,18 +7,20 @@ var angular = require('angular');
* @name settings
*
* @description
* The 'settings' factory exposes shared application settings, read from the
* global variable 'hypothesis.settings' in the app page.
* The 'settings' factory exposes shared application settings, read from a
* script tag with type "application/json" and id "hypothesis-settings" in the
* app page.
*/
// @ngInject
function
settings
(
$window
)
{
var
data
=
{};
function
settings
(
$document
)
{
var
settingsElement
=
$document
[
0
].
querySelector
(
'script[type="application/json"]#hypothesis-settings'
);
if
(
$window
.
hypothesis
&&
$window
.
hypothesis
.
settings
)
{
angular
.
copy
(
$window
.
hypothesis
.
settings
,
data
);
if
(
settingsElement
)
{
return
angular
.
fromJson
(
settingsElement
.
textContent
);
}
return
data
;
return
{}
;
}
module
.
exports
=
settings
;
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