Merge wrapper js
This commit is contained in:
parent
233e161327
commit
cbefc5b81e
1 changed files with 11 additions and 1 deletions
|
@ -908,7 +908,7 @@ $.extend( $.easing,
|
|||
};
|
||||
|
||||
Wrapper.prototype.onMessageWebsocket = function(e) {
|
||||
var cmd, id, message, ref, type;
|
||||
var cmd, id, message, ref, script_tag, type;
|
||||
message = JSON.parse(e.data);
|
||||
cmd = message.cmd;
|
||||
if (cmd === "response") {
|
||||
|
@ -955,8 +955,15 @@ $.extend( $.easing,
|
|||
} else if (cmd === "updating") {
|
||||
this.ws.ws.close();
|
||||
return this.ws.onCloseWebsocket(null, 4000);
|
||||
} else if (cmd === "redirect") {
|
||||
return window.top.location = message.params;
|
||||
} else if (cmd === "injectHtml") {
|
||||
return $("body").append(message.params);
|
||||
} else if (cmd === "injectScript") {
|
||||
script_tag = $("<script>");
|
||||
script_tag.attr("nonce", this.script_nonce);
|
||||
script_tag.html(message.params);
|
||||
return document.head.appendChild(script_tag[0]);
|
||||
} else {
|
||||
return this.sendInner(message);
|
||||
}
|
||||
|
@ -1475,8 +1482,11 @@ $.extend( $.easing,
|
|||
};
|
||||
|
||||
Wrapper.prototype.onWrapperLoad = function() {
|
||||
this.script_nonce = window.script_nonce;
|
||||
this.wrapper_key = window.wrapper_key;
|
||||
delete window.wrapper;
|
||||
delete window.wrapper_key;
|
||||
delete window.script_nonce;
|
||||
return $("#script_init").remove();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue