Forráskód Böngészése

Merge branch 'master' of https://git.cocorobo.hk/jack/cocorobolx

root 4 éve
szülő
commit
6091ac10d2
2 módosított fájl, 13 hozzáadás és 1 törlés
  1. 1 1
      index.html
  2. 12 0
      index.js

+ 1 - 1
index.html

@@ -211,7 +211,7 @@
                             <li id="button_load">
                                 <span class="translatable_import_local_file">导入本地文件</span>
                             </li>
-                            <li id="button_import_cloud">
+                            <li id="button_import_cloud" href="#cloud_storage_modal">
                                 <span class="translatable_import_cloud_file">导入云端文件</span>
                             </li>
                             <li id="button_save">

+ 12 - 0
index.js

@@ -472,6 +472,12 @@ window.onload = function () {
   $("#python_full_screen").click(() => {
     window.location.href = "./python/?" + window.location.href.split("?")[1];
   })
+
+  $("#button_save_cloud").click(() => {
+    var code = Ardublockly.generateXml();
+    var title = $("#sketch_name").val() != ''?$("#sketch_name").val() :'未命名';
+    savelxfile(code,title,showSaveToast);
+  })
 }
 
 function styled() {
@@ -1479,4 +1485,10 @@ function getlxfilebyid(id) {
       }
     });
   }
+}
+
+function showSaveToast(data){
+  setTimeout(function () {
+    Materialize.toast(data.success?'保存成功':'保存失败', 3000, "shareUrl")
+  }, getCurrentDate())
 }