Merge remote-tracking branch 'origin/dev_jupyter' into dev_jupyter

chromesetting
杨树明 5 years ago
commit 637eea7def

@ -1,18 +1,57 @@
//用于嵌入到jupyter pod中的js
//guange 2019.12.18
var timebool=false;
window.onload=function(){
console.log("开始发送消息了");
timebool=true;
runEvery10Sec();
}
function runEvery10Sec() {
// 1000 * 10 = 10 秒钟
console.log("每隔10秒中一次");
require(["base/js/namespace"],function(Jupyter) {
Jupyter.notebook.save_checkpoint();
});
window.parent.postMessage('jupytermessage','*');
setTimeout( runEvery10Sec, 1000 * 10 );
if(timebool===true){
setTimeout( runEvery10Sec, 1000 * 10 );
}
}
$(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','*');
}
});
})
$(function(){
window.addEventListener('message', (e) => {
console.log("触发了Parentwindow");
console.log(e);
if(e){
if(e.data){
if(e.data==="Parentwindow"){
//重置停止
timebool=false;
console.log("父窗口调我了");
}else if(e.data==="Parentwindow"){
console.log("父窗口调我了");
//取消启动
timebool=true;
this.runEvery10Sec();
}
}
}
});
})

@ -243,6 +243,15 @@ class Challengesjupyter extends Component {
enlarge:bool
})
}
daoruzhon=()=>{
var _iframe = document.getElementById("frame");
if(_iframe == null || _iframe == undefined || _iframe == ""){
console.log("framenull");
return;
}
console.log("framego");
_iframe.contentWindow.postMessage("Parentwindow", "*");
}
render() {
let{ChallengesDataList,booljupyterurls,enlarge}=this.state;
@ -404,9 +413,9 @@ class Challengesjupyter extends Component {
marginLeft: '30px',
}} onClick={()=>this.onclki(true)}></i>
}
{/*<div className="challenbaocun" ><p*/}
{/* className="challenbaocuntest">导入</p>*/}
{/*</div>*/}
<div className="challenbaocun" ><p
className="challenbaocuntest" onClick={()=>this.daoruzhon()}>导入</p>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save