Add script nonce when loading js for globe in sidebar
This commit is contained in:
parent
e0756a56a4
commit
46e694a5c8
2 changed files with 11 additions and 2 deletions
|
@ -564,7 +564,11 @@ class Sidebar extends Class
|
|||
if @tag.find(".globe").hasClass("loading")
|
||||
setTimeout (=>
|
||||
if typeof(DAT) == "undefined" # Globe script not loaded, do it first
|
||||
$.getScript("/uimedia/globe/all.js", @displayGlobe)
|
||||
script_tag = $("<script>")
|
||||
script_tag.attr("nonce", @wrapper.script_nonce)
|
||||
script_tag.attr("src", "/uimedia/globe/all.js")
|
||||
script_tag.on("load", @displayGlobe)
|
||||
document.head.appendChild(script_tag[0])
|
||||
else
|
||||
@displayGlobe()
|
||||
), 600
|
||||
|
|
|
@ -1075,8 +1075,13 @@ window.initScrollable = function () {
|
|||
if (this.tag.find(".globe").hasClass("loading")) {
|
||||
return setTimeout(((function(_this) {
|
||||
return function() {
|
||||
var script_tag;
|
||||
if (typeof DAT === "undefined") {
|
||||
return $.getScript("/uimedia/globe/all.js", _this.displayGlobe);
|
||||
script_tag = $("<script>");
|
||||
script_tag.attr("nonce", _this.wrapper.script_nonce);
|
||||
script_tag.attr("src", "/uimedia/globe/all.js");
|
||||
script_tag.on("load", _this.displayGlobe);
|
||||
return document.head.appendChild(script_tag[0]);
|
||||
} else {
|
||||
return _this.displayGlobe();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue