panweitong há 4 anos atrás
pai
commit
4715858c0d
4 ficheiros alterados com 64 adições e 53 exclusões
  1. 1 1
      index.html
  2. 18 14
      index.js
  3. 7 7
      python/index.html
  4. 38 31
      python/index.js

+ 1 - 1
index.html

@@ -330,7 +330,7 @@
                                 <div style="border: none;"><a href="javaScript:(0)" style="color: #424242 !important;"
                                         class="translatable_iot_module">IoT Module
                                         Mode</a></div>
-                                <div style="border: none;"><a href="./python/" style="color: #424242 !important;"
+                                <div style="border: none;"><a id="python_full_screen" style="color: #424242 !important;"
                                         class="translatable_python_full_screen_mode">Cloud
                                         Mode</a></div>
                             </div>

+ 18 - 14
index.js

@@ -444,30 +444,34 @@ window.onload = function () {
   $('#sketch_name').focus(function () {
     if (window.location.href.indexOf("en") > -1) {
       this.setAttribute("placeholder", "Please enter the name of the work");
-      $('#sketch_name').css("width","330px");
+      $('#sketch_name').css("width", "330px");
     }
-    else if(window.location.href.indexOf("zh-hans") > -1){
+    else if (window.location.href.indexOf("zh-hans") > -1) {
       this.setAttribute("placeholder", "请输入作品名称");
-      $('#sketch_name').css("width","200px");
+      $('#sketch_name').css("width", "200px");
     }
-    else{
+    else {
       this.setAttribute("placeholder", "請輸入作品名稱");
-      $('#sketch_name').css("width","200px");
+      $('#sketch_name').css("width", "200px");
     }
   }).blur(function () {
     if (window.location.href.indexOf("en") > -1) {
       this.setAttribute("placeholder", "Please enter the name of the work");
-      $('#sketch_name').css("width","330px");
+      $('#sketch_name').css("width", "330px");
     }
-    else if(window.location.href.indexOf("zh-hans") > -1){
+    else if (window.location.href.indexOf("zh-hans") > -1) {
       this.setAttribute("placeholder", "请输入作品名称");
-      $('#sketch_name').css("width","200px");
+      $('#sketch_name').css("width", "200px");
     }
-    else{
+    else {
       this.setAttribute("placeholder", "請輸入作品名稱");
-      $('#sketch_name').css("width","200px");
+      $('#sketch_name').css("width", "200px");
     }
   });
+
+  $("#python_full_screen").click(() => {
+    window.location.href = "/python/?" + window.location.href.split("?")[1];
+  })
 }
 
 function styled() {
@@ -486,10 +490,10 @@ function styled() {
     $("#help_extends").css("left", "528px");
     // $("#Serial_Interaction").css("left","120px");
     // $("#Serial_Display").css("left","260px");
-    $("body").css("font-family","Arial");
-    $("input").css("font-family","Arial");
-    $("#workspace_screenshot").css("right","470px");
-    $("#downloadbutton-li").css("right","62px");
+    $("body").css("font-family", "Arial");
+    $("input").css("font-family", "Arial");
+    $("#workspace_screenshot").css("right", "470px");
+    $("#downloadbutton-li").css("right", "62px");
   }
 }
 

+ 7 - 7
python/index.html

@@ -321,7 +321,7 @@
                         <div style="margin: 0px 20px 0px 0px;">
                             <input type="text" value="A.I. Module" id="iot_modules" readonly
                                 class="selectMode_input browser-default"
-                                style="font-size: 0.9rem;border: none;width: 130px;">
+                                style="font-size: 0.9rem;border: none;width: 145px;">
                             <i class="down" style="position: relative;top: -20px;float: right;"></i>
                             <div class="downbox MouduleBox" id="downboxModule" style="top: 64px;">
                                 <div style="border: none;"><a href="javaScript:(0)" style="color: #424242 !important;"
@@ -329,7 +329,7 @@
                                 <div style="border: none;"><a href="javaScript:(0)" style="color: #424242 !important;"
                                         class="translatable_iot_module">IoT Module
                                         Mode</a></div>
-                                <div style="border: none;"><a href="/python/" style="color: #424242 !important;"
+                                <div style="border: none;"><a id="python_full_screen" style="color: #424242 !important;"
                                         class="translatable_python_full_screen_mode">Cloud
                                         Mode</a></div>
                             </div>
@@ -392,7 +392,7 @@
                                             </div>
                                         </div>
                                     </div>
-                                    <div style="display: none;">
+                                    <div style="display: block;">
                                         <div>IoT 模块基础案例</div>
                                         <i class="downboxdown"></i>
                                         <ul class="Hardware2 HarxA">
@@ -407,7 +407,7 @@
                                             <li> LED 显示光线强度值</li>
                                         </ul>
                                     </div>
-                                    <div style="display: none;">
+                                    <div style="display: block;">
                                         <div>IoT 模块扩展功能案例</div>
                                         <i class="downboxdown"></i>
                                         <ul class="Hardware2 HarxA">
@@ -423,7 +423,7 @@
                                             <li>计步器</li>
                                         </ul>
                                     </div>
-                                    <div style="display: none;">
+                                    <div style="display: block;">
                                         <div>IoT 模块联网案例</div>
                                         <i class="downboxdown"></i>
                                         <ul class="Hardware2 HarxA">
@@ -444,7 +444,7 @@
                                             <li>数字手表显示实时时间</li>
                                         </ul>
                                     </div>
-                                    <div style="display: none;">
+                                    <div style="display: block;">
                                         <div>IoT工作坊上</div>
                                         <i class="downboxdown"></i>
                                         <ul class="Hardware2 HarxA">
@@ -462,7 +462,7 @@
 
                                         </ul>
                                     </div>
-                                    <div style="display: none;">
+                                    <div style="display: block;">
                                         <div>IoT工作坊下</div>
                                         <i class="downboxdown"></i>
                                         <ul class="Hardware2 HarxA">

+ 38 - 31
python/index.js

@@ -185,20 +185,23 @@ var copyCodeClipboard;
 $(window).one("load", () => {
 
 
-  // 判断从python blcokly 跳转过来是ai或者iot
-  if (window.location.search.indexOf('name') > -1 || getLocalStorage("type") == 1) {
-    $("#mode")[0].selectedIndex = 1;
-    $("#mode")[0].onchange();
-    $('.selectMode_input')[0].value = Ardublockly.LOCALISED_TEXT.iot_module;
-    selectmode($("#mode")[0], true);
-    appearExample(1);
-  } else {
-    $("#mode")[0].selectedIndex = 0;
-    $("#mode")[0].onchange();
-    $('.selectMode_input')[0].value = Ardublockly.LOCALISED_TEXT.ai_module;
-    selectmode($("#mode")[0], true);
-    appearExample(0);
-  }
+  // // 判断从python blcokly 跳转过来是ai或者iot
+  // if (window.location.search.indexOf('name') > -1 || getLocalStorage("type") == 1) {
+  //   $("#mode")[0].selectedIndex = 1;
+  //   $("#mode")[0].onchange();
+  //   $('.selectMode_input')[0].value = Ardublockly.LOCALISED_TEXT.iot_module;
+  //   selectmode($("#mode")[0], true);
+  //   appearExample(1);
+  // } else {
+  //   $("#mode")[0].selectedIndex = 0;
+  //   $("#mode")[0].onchange();
+  //   $('.selectMode_input')[0].value = Ardublockly.LOCALISED_TEXT.ai_module;
+  //   selectmode($("#mode")[0], true);
+  //   appearExample(0);
+  // }
+
+  $('.selectMode_input')[0].value = Ardublockly.LOCALISED_TEXT.python_full_screen_mode;
+
 
   $('#white-box').css('display', 'none');
 
@@ -416,7 +419,7 @@ window.onload = function () {
   //   var _index = localStorage.getItem("ModeIndex") != "undefined" ? localStorage.getItem("ModeIndex") : 0;
   //   selectmode(parseInt(_index));
   //   $('#select_mode')[0].selectedIndex = parseInt(_index);
-  
+
   $('#toggle-button').click(() => {
     if ($('#toggle-button')[0].checked) {
       $('#edit')[0].style.display = 'none';
@@ -444,30 +447,34 @@ window.onload = function () {
   $('#sketch_name').focus(function () {
     if (window.location.href.indexOf("en") > -1) {
       this.setAttribute("placeholder", "Please enter the name of the work");
-      $('#sketch_name').css("width","330px");
+      $('#sketch_name').css("width", "330px");
     }
-    else if(window.location.href.indexOf("zh-hans") > -1){
+    else if (window.location.href.indexOf("zh-hans") > -1) {
       this.setAttribute("placeholder", "请输入作品名称");
-      $('#sketch_name').css("width","200px");
+      $('#sketch_name').css("width", "200px");
     }
-    else{
+    else {
       this.setAttribute("placeholder", "請輸入作品名稱");
-      $('#sketch_name').css("width","200px");
+      $('#sketch_name').css("width", "200px");
     }
   }).blur(function () {
     if (window.location.href.indexOf("en") > -1) {
       this.setAttribute("placeholder", "Please enter the name of the work");
-      $('#sketch_name').css("width","330px");
+      $('#sketch_name').css("width", "330px");
     }
-    else if(window.location.href.indexOf("zh-hans") > -1){
+    else if (window.location.href.indexOf("zh-hans") > -1) {
       this.setAttribute("placeholder", "请输入作品名称");
-      $('#sketch_name').css("width","200px");
+      $('#sketch_name').css("width", "200px");
     }
-    else{
+    else {
       this.setAttribute("placeholder", "請輸入作品名稱");
-      $('#sketch_name').css("width","200px");
+      $('#sketch_name').css("width", "200px");
     }
   });
+
+  $("#python_full_screen").click(() => {
+    window.location.href = "/python/?" + window.location.href.split("?")[1];
+  })
 }
 
 function styled() {
@@ -484,9 +491,9 @@ function styled() {
     $("#local_help").addClass("helpEnglish");
     $("#local_help_ai_kit").css("left", "528px");
     $("#help_extends").css("left", "528px");
-    $("body").css("font-family","Arial");
-    $("input").css("font-family","Arial");
-    $("#downloadbutton-li").css("right","62px");
+    $("body").css("font-family", "Arial");
+    $("input").css("font-family", "Arial");
+    $("#downloadbutton-li").css("right", "62px");
   }
 }
 
@@ -574,7 +581,7 @@ function fanyi() {
   $('.ModeBox ul')[7].children[13].innerHTML = Ardublockly.LOCALISED_TEXT.select_snt;
   $('.ModeBox ul')[7].children[14].innerHTML = Ardublockly.LOCALISED_TEXT.select_dwsdat;
 
-  
+
   $('.ModeBox')[0].children[4].children[0].innerHTML = Ardublockly.LOCALISED_TEXT.select_work_u;
   $('.ModeBox ul')[8].children[0].innerHTML = Ardublockly.LOCALISED_TEXT.select_middle_led;
   $('.ModeBox ul')[8].children[1].innerHTML = Ardublockly.LOCALISED_TEXT.select_all_led;
@@ -755,13 +762,13 @@ function selectOnload() {
           $("#mode")[0].selectedIndex = 1;
           $("#mode")[0].onchange();
           $('.selectMode_input')[0].value = Ardublockly.LOCALISED_TEXT.iot_module;
-          window.location.href = "/";
+          window.location.href = "/?" + window.location.href.split("?")[1];
         }
         else if (e.innerHTML == Ardublockly.LOCALISED_TEXT.ai_module) {
           $("#mode")[0].selectedIndex = 0;
           $("#mode")[0].onchange();
           $('.selectMode_input')[0].value = Ardublockly.LOCALISED_TEXT.ai_module;
-          window.location.href = "/";
+          window.location.href = "/?" + window.location.href.split("?")[1];
         }
         $('.MouduleBox')[0].style.display = 'none';
         $('.MouduleBox')[1].style.display = 'none';