index.prod.js 23 KB

1
  1. "use strict";function initLanguage(e){var l=e||"en";"en"!==l&&injectLanguageJsSources(l)}function logout(){$.ajax("".concat(CCB.base_url,"api/logout"),{type:"GET",xhrFields:{withCredentials:!0},success:function(){appendIframe("TM_login"),$("#TM_login").children().css("height","820px"),appendIframe("before_login"),appendIframe("cloud_askLogin"),Materialize.toast(CCB.str_group.success_userLogout,4e3),CCB.userState=!1,$("#cloud_fileListArea").html(""),loginModalStatus(),$("#modal_logout_btn").addClass("blue"),$(".svgImg").css("display","none"),$(".translate-signout").css("opacity","1")}})}function getUrlLanguage(){var e=location.search.match(new RegExp("[?&]lang=([^&]+)")),l=e?decodeURIComponent(e[1].replace(/\+/g,"%20")):"";return["en","zh-hant","zh-hans"].indexOf(l)<0?"zh-hant":l}function injectLanguageJsSources(e){var l=document.getElementsByTagName("head")[0],o=document.createElement("script"),n=createAjaxRequest(),c="msg/".concat(e,".js");try{n.open("GET",c,!1),n.send(""),o.text=n.responseText}catch(e){o.src=c}l.appendChild(o);var t=document.createElement("script");t.src="blockly/msg/js/".concat(e,".js"),l.appendChild(t)}function createAjaxRequest(){var l=!1;try{l=new XMLHttpRequest}catch(e){try{l=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{l=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){throw"Your browser does not support AJAX. You will not be able touse all of Ardublockly features."}}}return l}function updateLanguageText(){for(var e in LOCALISED_TEXT)for(var l=document.getElementsByClassName("translate-".concat(e)),o=0;o<l.length;o++)l[o].innerHTML=LOCALISED_TEXT[e]}function clearBlocks(){var l=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){},e=Blockly.mainWorkspace.getAllBlocks(!0).length;e<2?(Blockly.mainWorkspace.clear(),l()):Blockly.confirm(Blockly.Msg.DELETE_ALL_BLOCKS.replace("%1",e),function(e){e&&(Blockly.mainWorkspace.clear(),l())})}function addLibButton(e){}var copyCodeClipboard;function styled(){-1<window.location.search.indexOf("en")&&$(".downbox-style").css({width:"280px",marginLeft:"-100px"})}function fanyi(){$(".ModeSelect")[0].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_Example,$(".ModeBox")[0].children[0].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_Basics,$(".ModeBox ul")[0].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_sbcb,$(".ModeBox ul")[0].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.select_sbcsl,$(".ModeBox ul")[0].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.select_tacl,$(".ModeBox ul")[0].children[3].innerHTML=Ardublockly.LOCALISED_TEXT.select_ba,$(".ModeBox ul")[0].children[4].innerHTML=Ardublockly.LOCALISED_TEXT.select_desl,$(".ModeBox ul")[0].children[5].innerHTML=Ardublockly.LOCALISED_TEXT.select_tdsl,$(".ModeBox ul")[0].children[6].innerHTML=Ardublockly.LOCALISED_TEXT.select_ha,$(".ModeBox ul")[0].children[7].innerHTML=Ardublockly.LOCALISED_TEXT.select_ssl,$(".ModeBox ul")[0].children[8].innerHTML=Ardublockly.LOCALISED_TEXT.select_ldliv,$('.ModeBox ul')[0].children[9].innerHTML = Ardublockly.LOCALISED_TEXT.select_line,$('.ModeBox ul')[0].children[10].innerHTML = Ardublockly.LOCALISED_TEXT.select_bccs,$(".ModeBox")[0].children[1].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_imefc,$(".ModeBox ul")[1].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_uls,$(".ModeBox ul")[1].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.select_umdm,$(".ModeBox ul")[1].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.select_uoglls,$('.ModeBox ul')[1].children[3].innerHTML = Ardublockly.LOCALISED_TEXT.select_auogsm,$('.ModeBox ul')[1].children[4].innerHTML = Ardublockly.LOCALISED_TEXT.select_ctsotem,$('.ModeBox ul')[1].children[5].innerHTML = Ardublockly.LOCALISED_TEXT.select_thwos,$('.ModeBox ul')[1].children[6].innerHTML = Ardublockly.LOCALISED_TEXT.select_sdla,$(".ModeBox")[0].children[2].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_ionc,$(".ModeBox ul")[2].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_btsldtc,$(".ModeBox ul")[2].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.select_ktsedti,$(".ModeBox ul")[2].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.select_btoldalua,$(".ModeBox ul")[2].children[3].innerHTML=Ardublockly.LOCALISED_TEXT.select_tsedtc,$(".ModeBox ul")[2].children[4].innerHTML=Ardublockly.LOCALISED_TEXT.select_ewhadtnocd,$(".ModeBox ul")[2].children[5].innerHTML=Ardublockly.LOCALISED_TEXT.select_ledss,$(".ModeBox ul")[2].children[6].innerHTML=Ardublockly.LOCALISED_TEXT.select_ledac,$(".ModeBox ul")[2].children[7].innerHTML=Ardublockly.LOCALISED_TEXT.select_ctwn,$(".ModeBox ul")[2].children[8].innerHTML=Ardublockly.LOCALISED_TEXT.select_bssbms,$(".ModeBox ul")[2].children[9].innerHTML=Ardublockly.LOCALISED_TEXT.select_bsrbmc,$(".ModeBox ul")[2].children[10].innerHTML=Ardublockly.LOCALISED_TEXT.select_wrcbms,$(".ModeBox ul")[2].children[11].innerHTML=Ardublockly.LOCALISED_TEXT.select_wrcbmr,$(".ModeBox ul")[2].children[12].innerHTML=Ardublockly.LOCALISED_TEXT.select_snt,$(".ModeBox")[0].children[3].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_smmlc,$(".ModeBox ul")[3].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_gcaerhk,$(".ModeBox ul")[3].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.select_fr,$(".ModeBox ul")[3].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.select_or,$(".ModeBox ul")[3].children[3].innerHTML=Ardublockly.LOCALISED_TEXT.select_mhdr,$(".ModeBox")[0].children[4].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_ambc,$(".ModeBox ul")[4].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_bcsc,$(".ModeBox ul")[4].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.select_kcpccs,$(".ModeBox ul")[4].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.select_kcpficc,$(".ModeBox ul")[4].children[3].innerHTML=Ardublockly.LOCALISED_TEXT.select_bccs,$(".ModeBox ul")[4].children[4].innerHTML=Ardublockly.LOCALISED_TEXT.select_mc,$(".ModeBox ul")[4].children[5].innerHTML=Ardublockly.LOCALISED_TEXT.select_sor,$(".ModeBox ul")[4].children[6].innerHTML=Ardublockly.LOCALISED_TEXT.select_sdla,$(".ModeBox")[0].children[5].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_amefc,$(".ModeBox ul")[5].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_auls,$(".ModeBox ul")[5].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.select_aumdm,$(".ModeBox ul")[5].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.select_auogsm,$(".ModeBox ul")[5].children[3].innerHTML=Ardublockly.LOCALISED_TEXT.select_actsotem,$(".ModeBox")[0].children[6].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_amvc,$(".ModeBox ul")[6].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.select_bctbotci,$(".ModeBox ul")[6].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.select_aca,$(".ModeBox ul")[6].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.select_rqc,$(".ModeBox ul")[6].children[3].innerHTML=Ardublockly.LOCALISED_TEXT.select_lhbl,$(".ModeBox ul")[6].children[4].innerHTML=Ardublockly.LOCALISED_TEXT.select_fgr,$(".ModeBox ul")[6].children[5].innerHTML=Ardublockly.LOCALISED_TEXT.select_fgaat,$(".ModeBox")[0].children[7].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.ai_modules_av,$(".ModeBox ul")[7].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.paly_video,$(".ModeBox ul")[7].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.paly_music,$(".ModeBox ul")[7].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.recording_camera,$(".ModeBox ul")[7].children[3].innerHTML=Ardublockly.LOCALISED_TEXT.microphone_sound_analysis,$(".ModeBox")[0].children[8].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.ai_modules_teacher,$(".ModeBox ul")[8].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.ai_modules_thw,$(".ModeBox ul")[8].children[1].innerHTML=Ardublockly.LOCALISED_TEXT.ai_modules_thwos,$(".ModeBox ul")[8].children[2].innerHTML=Ardublockly.LOCALISED_TEXT.ai_modules_uoc,$(".ModeBox ul")[8].children[3].innerHTML=Ardublockly.LOCALISED_TEXT.ai_modules_mc,$(".ModeBox ul")[8].children[4].innerHTML=Ardublockly.LOCALISED_TEXT.ai_modules_sor,$("#sketch_name")[0].value=Ardublockly.LOCALISED_TEXT.sketch_name,$("#resetDevice")[0].innerHTML=Ardublockly.LOCALISED_TEXT.resetDevice,$("#select_dropdown")[0].value=Ardublockly.LOCALISED_TEXT.select_dropdown,$("#iot_modules")[0].value=Ardublockly.LOCALISED_TEXT.iot_module,$(".qiehuanbtn")[0].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.a_csm,$("#localsssssaveOrOpen")[0].children[0].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.a_butvmi,$("#localsssssaveOrOpen")[0].children[1].children[0].innerHTML=Ardublockly.LOCALISED_TEXT.a_buartlp,$("#Serial_Interaction")[0].innerHTML=Ardublockly.LOCALISED_TEXT.Serial_Interaction}function selectOnload(){$(".select-connected")[0].onchange=function(){var e=$(".select-connected")[0].selectedIndex;if($("#runCode")[0].innerHTML==CCB.str_group.uploading)return $(".select-connected")[0].selectedIndex=0==e?1:0,null;0==e?($(".btn-network")[0].className="row btn-network",$(".btn-network")[1].className="row btn-network hidden"):($(".btn-network")[1].className="row btn-network",$(".btn-network")[0].className="row btn-network hidden")},$(".selectMode_input")[0].onclick=function(e){$(".MouduleBox")[0].style.cssText="display:block"},$(".ModeSelectBox")[0].onclick=function(e){U.UF.EV.stopBubble(),$(".ModeSelect")[0].className="ModeSelect active"},likeclose($(".selectMode_input")[0],$(".MouduleBox")[0],"",""),likeclose($(".ModeSelect")[0].children[0],$(".ModeSelect")[0],1,"ModeSelect"),likeclose($("#bar_ai img")[0],$(".MouduleBox")[1],"",""),likeclose($("#bar_t img")[0],$("#ai_tt")[0],"","");for(var e=$(".MouduleBox")[0].children,l=$(".MouduleBox")[1].children,o=0;o<e.length;o++)l[o].onclick=e[o].onclick=function(e){window.event?window.event.cancelBubble=!0:e.stopPropagation(),(e=e.target).parentElement.children[2]&&0<e.parentElement.children[2].children.length||(e.innerHTML==Ardublockly.LOCALISED_TEXT.iot_module?($("#mode")[0].selectedIndex=0,$("#mode")[0].onchange(),$(".selectMode_input")[0].value=Ardublockly.LOCALISED_TEXT.iot_module):e.innerHTML==Ardublockly.LOCALISED_TEXT.ai_module&&($("#mode")[0].selectedIndex=1,$("#mode")[0].onchange(),$(".selectMode_input")[0].value=Ardublockly.LOCALISED_TEXT.ai_module),$(".MouduleBox")[0].style.display="none",$(".MouduleBox")[1].style.display="none",$("#ai_tt")[0].style.display="none")};for(o=0;o<$(".ModeBox")[0].children.length;o++)$(".ModeBox")[0].children[o].onclick=function(e){window.event?window.event.cancelBubble=!0:e.stopPropagation()};var c=[["Main/IoT 模块基础案例/侧边按键控制蜂鸣器.xml","Main/IoT 模块基础案例/侧边按键控制开关 LED.xml","Main/IoT 模块基础案例/触摸区域控制 LED.xml","Main/IoT 模块基础案例/蜂鸣器警报.xml","Main/IoT 模块基础案例/黑暗环境感应光照灯.xml","Main/IoT 模块基础案例/倾斜方向感应 LED.xml","Main/IoT 模块基础案例/湿度报警器.xml","Main/IoT 模块基础案例/摇晃感应 LED.xml","Main/IoT 模块基础案例/LED 显示光线强度值.xml","Main/IoT 模块基础案例/屏幕显示Hello_World.xml","Main/IoT 模块基础案例/按键控制屏幕直线转动.xml","Main/IoT 模块基础案例/按键控制颜色切换.xml","Main/IoT 模块基础案例/屏幕绘制线条动画.xml"],["Main/IoT 模块扩展功能案例/使用 LED 灯屏.xml","Main/IoT 模块扩展功能案例/使用电机驱动模块.xml","Main/IoT 模块扩展功能案例/使用游戏手柄LED 灯屏.xml","Main/IoT 模块扩展功能案例/使用游戏手柄屏幕.xml","Main/IoT 模块扩展功能案例/在扩展模块上控制舵机.xml"],["Main/IoT 模块联网案例/按键发送光照数据至 CocoCloud.xml","Main/IoT 模块联网案例/按键发送环境数据至 IFTTT.xml","Main/IoT 模块联网案例/按键获取光照数据并根据条件亮灯.xml","Main/IoT 模块联网案例/定时发送环境数据至 CocoCloud.xml","Main/IoT 模块联网案例/建立 WiFi 热点并显示连接设备数量.xml","Main/IoT 模块联网案例/局域网环境数据存储 - 服务器端.xml","Main/IoT 模块联网案例/局域网环境数据获取 - 客户端.xml","Main/IoT 模块联网案例/连接 WiFi 网络.xml","Main/IoT 模块联网案例/模块间按钮状态存储 - 服务端.xml","Main/IoT 模块联网案例/模块间按钮状态接收 - 客户端.xml","Main/IoT 模块联网案例/模块间进行 WebSocket 实时通信 - 发送端.xml","Main/IoT 模块联网案例/模块间进行 WebSocket 实时通信 - 接收端.xml","Main/IoT 模块联网案例/同步网络时间.xml"],["AI/AI 模块机器学习案例/垃圾分类识别(香港版).xml","AI/AI 模块机器学习案例/人脸检测.xml","AI/AI 模块机器学习案例/物体识别.xml","AI/AI 模块机器学习案例/MNIST 手写数字识别.xml"],["AI/AI 模块基础案例/按键控制屏幕时针转动.xml","AI/AI 模块基础案例/按键控制图片改变颜色制式.xml","AI/AI 模块基础案例/按键控制图片进行反色变化.xml","AI/AI 模块基础案例/按键控制颜色切换.xml","AI/AI 模块基础案例/迷你相机.xml","AI/AI 模块基础案例/屏幕方向旋转.xml","AI/AI 模块基础案例/屏幕绘制线条动画.xml"],["AI/AI 模块扩展功能案例/使用 LED 灯屏.xml","AI/AI 模块扩展功能案例/使用电机驱动模块.xml","AI/AI 模块扩展功能案例/使用游戏手柄 + 屏幕模块.xml","AI/AI 模块扩展功能案例/在扩展模块上控制舵机.xml"],["AI/AI 模块视觉案例/按键改变相机图像的亮度.xml","AI/AI 模块视觉案例/区域颜色分析.xml","AI/AI 模块视觉案例/识别 QR 二维码.xml","AI/AI 模块视觉案例/寻线(黑线).xml","AI/AI 模块视觉案例/寻找绿色的圆形.xml","AI/AI 模块视觉案例/寻找绿色区域并进行追踪.xml"],["AI/AI 模块影音案例/播放录制的视频档案.xml","AI/AI 模块影音案例/播放音乐.xml","AI/AI 模块影音案例/录制摄像头画面并保存.xml","AI/AI 模块影音案例/麦克风声音频谱分析.xml"],["AI/AI 教学/AI_Workshop_ex1.xml","AI/AI 教学/AI_Workshop_ex2.xml","AI/AI 教学/AI_Workshop_ex3.xml","AI/AI 教学/AI_Workshop_ex4.xml","AI/AI 教学/AI_Workshop_ex5.xml"]];for(o=0;o<$(".HarxA").length;o++)for(var n=0;n<$(".HarxA")[o].children.length;n++)$(".HarxA").length-1==o&&(ai_tt.children[n].innerHTML=("xml"==c[o][n].split(".")[1]?"<span style='color:#00FF7F'>[xml] &nbsp</span>":"<span style='color:#FF7F00'>[py] &nbsp</span>")+$(".HarxA")[o].children[n].innerHTML,ai_tt.children[n].onclick=function(o,n){return function(){"Main"==c[o][n].split("/")[0]?($("#mode")[0].selectedIndex=0,$("#mode")[0].onchange(),$(".selectMode_input")[0].value=Ardublockly.LOCALISED_TEXT.iot_module):($("#mode")[0].selectedIndex=1,$("#mode")[0].onchange(),$(".selectMode_input")[0].value=Ardublockly.LOCALISED_TEXT.ai_module),$(".ModeSelect")[0].className="ModeSelect",readTxt("/src/python/"+c[o][n],function(e){if("xml"==c[o][n].split(".")[1]){var l=Blockly.Xml.textToDom(e);blockpy.components.editor.setBlocksFromXml(l)}else blockpy.components.editor.codeMirror.setValue(e)})}}(o,n)),$(".HarxA")[o].children[n].innerHTML=("xml"==c[o][n].split(".")[1]?"<span style='color:#00FF7F'>[xml] &nbsp</span>":"<span style='color:#FF7F00'>[py] &nbsp</span>")+$(".HarxA")[o].children[n].innerHTML,$(".HarxA")[o].children[n].onclick=function(o,n){return function(){"Main"==c[o][n].split("/")[0]?($("#mode")[0].selectedIndex=0,$("#mode")[0].onchange(),$(".selectMode_input")[0].value=Ardublockly.LOCALISED_TEXT.iot_module):($("#mode")[0].selectedIndex=1,$("#mode")[0].onchange(),$(".selectMode_input")[0].value=Ardublockly.LOCALISED_TEXT.ai_module),$(".ModeSelect")[0].className="ModeSelect",readTxt("/src/python/"+c[o][n],function(e){if("xml"==c[o][n].split(".")[1]){var l=Blockly.Xml.textToDom(e);blockpy.components.editor.setBlocksFromXml(l)}else blockpy.components.editor.codeMirror.setValue(e)})}}(o,n);$(".qiehuanbtn")[0].onclick=function(e){CCB.socket&&CCB.socket.id&&(U.UF.EV.stopBubble(),"en"==Ardublockly.LANG?$("#localsssssaveOrOpen")[0].className="dropdown-content qiehuan qiehuanposi":$("#localsssssaveOrOpen")[0].className="dropdown-content qiehuan")};var t=$("#localsssssaveOrOpen")[0].children;for(o=0;o<t.length;o++)$("#localsssssaveOrOpen")[0].children[o].addEventListener("click",function(){window.event?window.event.cancelBubble=!1:e.stopPropagation();var e=this;$("#runCuploadFilesode")[0].innerHTML=e.children[0].innerHTML});qiehuanjjj($(".qiehuanbtn")[0],$("#localsssssaveOrOpen")[0]),$(".switch_box1")[0].onclick=switchCC,$(".switch_box")[0].onclick=switchCC,$("#repl_delete")[0].onclick=function(){$("#repl_box_content")[0].innerHTML=""}}function switchCC(e){e=e.target||e;var l=$("#python_box")[0],o=$("#repl_box")[0],n=$("#repl_delete")[0];if(-1==e.className.indexOf("switch_select")){var c=$(".switch_select")[0];c.className=c.className.replace(" switch_select",""),e.className+=" switch_select",-1!=e.className.indexOf("switch_box1")?(l.className="card-content hidden",o.className="card-content",n.style.display="block"):(l.className="card-content",o.className="card-content hidden",n.style.display="none")}}function readTxt(e,l){var o=new XMLHttpRequest;o.open("get",e,!0),o.send(),o.onreadystatechange=function(){4==o.readyState&&200==o.status&&l(o.responseText)}}function qiehuanjjj(l,o){$("body")[0].addEventListener("click",function(e){l!=e.target&&(o.className="dropdown-content")})}function likeclose(l,o,n,c){$("body")[0].addEventListener("click",function(e){l!=e.target&&(1==n?o.className=c:o.style.display="none")})}function export_data(e,l,o){var n=new Blob([e],{type:"text/plain"}),c=URL.createObjectURL(n),t=document.createElement("a");t.style="display:none",t.href=c,t.download=($(".sketch_name").val()||"cocorobo")+l,o?(document.body.appendChild(t),t.click(),setTimeout(function(){return document.body.removeChild(t)},100)):t.click(),setTimeout(function(){return URL.revokeObjectURL(c)},100)}function selectmode(e,l){var o=getLocalStorage("type");0!=e.selectedIndex||0==o&&!0!==l?1!=e.selectedIndex||1==o&&!0!==l||(saveLocalStorageBlocks("pythonmc-mode-blocks-xml"),saveLocalStorage("type",1),blockpy.setAssignment({},{modules:{added:["Decisions","Iteration","Calculation","Variables","Values","Lists","Functions","Logic","Loops","Math","Text","Dictionary","Tuples","Set","Functionsa","Output","Files","Time","Serial Comm.","A.I.Board","ExtendedFunctions","Third_party_Sensor"],removed:["MainBoard"]}},{__main__:""}),loadLocalStorageBlocks("pythonai-mode-blocks-xml")):(saveLocalStorageBlocks("pythonai-mode-blocks-xml"),saveLocalStorage("type",0),blockpy.setAssignment({},{modules:{added:["Decisions","Iteration","Calculation","Variables","Values","Lists","Functions","Logic","Loops","Math","Text","Dictionary","Tuples","Set","Functionsa","Output","Files","Time","Serial Comm.","MainBoard","ExtendedFunction","Third_party_Sensor"],removed:["A.I.Board"]}},{__main__:""}),loadLocalStorageBlocks("pythonmc-mode-blocks-xml"))}function getQueryParams(){try{for(i in url=window.location.href,query_str=url.substr(url.indexOf("?")+1,url.length-1),r_params=query_str.split("&"),params={},r_params)param=r_params[i].split("="),params[param[0]]=param[1];return params}catch(e){return{}}}$("#modal_logout_btn").on("click",function(){}),$(window).one("load",function(){-1<window.location.search.indexOf("name")||1==getLocalStorage("type")?($("#mode")[0].selectedIndex=1,$("#mode")[0].onchange(),$(".selectMode_input")[0].value=Ardublockly.LOCALISED_TEXT.ai_module):($("#mode")[0].selectedIndex=0,$("#mode")[0].onchange(),$(".selectMode_input")[0].value=Ardublockly.LOCALISED_TEXT.iot_module),selectmode($("#mode")[0],!0),$("#white-box").css("display","none");var e=getUrlLanguage();new ClipboardJS(".copy_code",{text:function(){return blockpy.components.editor.codeMirror.getValue()}}).on("success",function(){return c(2e3)});var l,o,n,c=(o=l=null,n="zh-hans"===e?"复制成功":"zh-hant"===e?"複製成功":"Copy Successfully",function(e){l&&(l.dismiss(),clearTimeout(o)),l=Materialize.toast(n,e),o=setTimeout(function(){return l=o=null},e)});$("#delete-all").click(function(){return clearBlocks()}),$("#screenshot").click(function(){return Blockly.captureDialog_()}),$("#clearOutput").click(function(){return $(".blockpy-printer").html("")}),$("#resetAll").click(function(){return clearBlocks(function(){return $(".blockpy-printer").html("")})}),$("#lang-tool").click(function(){return $("#side-lang-trigger > a").dropdown("open")}),$("#file-tool").click(function(){return $("#side-file-trigger > a").dropdown("open")}),$("#blockpy-content > .blockpy-editor img.fullscreenIcon").click(function(e){$(e.currentTarget.parentNode).toggleClass("fullscreen"),$("#blockpy-content > .blockpy-editor img.fullscreenIcon").toggleClass("hidden"),$("html").toggleClass("fullscreenMode"),setTimeout(function(){Blockly.svgResize(blockpy.components.editor.blockly),Blockly.svgResize(Blockly.mainWorkspace)},100)}),$("#blockpy-content .card-header > img.fullscreenIcon").click(function(e){$(e.currentTarget.parentNode.parentNode).toggleClass("fullscreen"),$("#blockpy-content .card-header > img.fullscreenIcon").toggleClass("hidden"),$("html").toggleClass("fullscreenMode"),setTimeout(function(){return $(".blockpy-toolbar > .blockpy-text").css("height","90%").css("height","100%")},0)}),setTimeout(function(){document.body.clientWidth<1265&&alert(CCB.str_group.alert)},1e3)}),window.onbeforeunload=window.onunload=function(){0==$("#mode")[0].selectedIndex?(saveLocalStorage("type",0),saveLocalStorageBlocks("pythonmc-mode-blocks-xml")):(saveLocalStorage("type",1),saveLocalStorageBlocks("pythonai-mode-blocks-xml"))},window.onload=function(){window.location.hash.substring(1);$(".dropdown-trigger").dropdown(),setTimeout(function(){return $(".modal").modal()},0),blockpy=new BlockPy({blocklyPath:"blockly/",attachmentPoint:document.getElementById("blockpy-div"),instructor:!getQueryParams().instructor||"true"==getQueryParams().instructor,developer:!0,editor:getQueryParams().mode||"Split",urls:{}});var e=calculate_size($("#term")[0]);term=new Terminal({cols:e[0],rows:e[1],useStyle:!0,screenKeys:!0,cursorBlink:!1}),term.open(document.getElementById("term")),$(".filled-in")[0].onclick=function(){var e=$(".filled-in")[0],l=$(".filled-in")[0].parentNode;e.checked?(l.children[1].className="translatable_Adapter_connected",l.children[1].innerHTML=CCB.str_group.Adapter_connected):(l.children[1].className="filled-in_nocheked translatable_Adapter_fill_connected",l.children[1].innerHTML=CCB.str_group.Adapter_fill_connected)},setTimeout(function(){cocoblockly()},0),$(".blockpy-toolbar-download").on("click",function(){return export_data(pythonnewcode||Blockly.Python.workspaceToCode(blockpy.components.editor.blockly)||blockpy.components.editor.codeMirror.getValue(),".py",0)});var o=$("#pyFileImport > input");o.change(function(){var e=new FileReader,l=o[0].files[0];e.onload=function(e){var l=e.target.result;blockpy.components.editor.codeMirror.setValue(l)},e.readAsText(l),o.val("")}),$(".blockpy-toolbar-upload").click(function(e){return $("#pyFileImport > input").click()}),fanyi(),selectOnload(),styled();var l=document.createElement("iframe");l.src="//project-x.cocorobo.cn/",l.style.width="100%",l.style.height="50vh",document.getElementById("iframe").appendChild(l),$("#toggle-button").click(function(){$("#toggle-button")[0].checked?$("#edit")[0].style.display="none":$("#edit")[0].style.display="block"})};var debounce=function(o,n,c){var t;return function(){var e=this,l=arguments;t?clearTimeout(t):c&&o.apply(e,l),t=setTimeout(function(){c||o.apply(e,l),t=null},n||100)}};window.onresize=debounce(function(){document.body.clientWidth<1265&&alert(CCB.str_group.alert)},100,!0);