diff --git a/public/javascripts/jupyter.js b/public/javascripts/jupyter.js index 7f5e97b0f..6610bfdca 100644 --- a/public/javascripts/jupyter.js +++ b/public/javascripts/jupyter.js @@ -23,23 +23,27 @@ function runEvery10Sec() { } $(function(){ - document.addEventListener('keydown', (e) => { - if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){ - e.preventDefault(); - console.log("点击了ctrl+s"); - console.log("开始发送消息了ctrl+s"); - window.parent.postMessage('jupytermessage','*'); - } - }); - +document.addEventListener('keydown', (e) => { + if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){ + e.preventDefault(); + console.log("点击了ctrl+s"); + console.log("开始发送消息了ctrl+s"); + window.parent.postMessage('jupytermessage','*'); + } +}); +}) +$(function(){ window.addEventListener('message', (e) => { - + console.log("触发了Parentwindow"); + console.log(e); if(e){ if(e.data){ - if(e.data==="stopParent"){ + if(e.data==="Parentwindow"){ //重置停止 timebool=false; - }else if(e.data==="clonsParent"){ + console.log("父窗口调我了重置停止"); + }else if(e.data==="cancelwindow"){ + console.log("父窗口调我了取消启动"); //取消启动 timebool=true; this.runEvery10Sec(); @@ -49,6 +53,5 @@ $(function(){ } }); - })