Browse Source

improve browser compability

moononournation 7 years ago
parent
commit
0a4bd95492
4 changed files with 18 additions and 12 deletions
  1. BIN
      bin/index.html.gz
  2. BIN
      bin/index.js.gz
  3. 8 8
      src/index.html
  4. 10 4
      src/index.js

BIN
bin/index.html.gz


BIN
bin/index.js.gz


+ 8 - 8
src/index.html

@@ -16,26 +16,26 @@
       top: 0;
       left: 0;
       right: 0;
-      height: 18px;
+      height: 24px;
       padding: 0;
       background-color: #2B4988;
     }
     #localStatus {
       display: inline;
       margin: 0;
-      height: 18px;
+      height: 24px;
       background-color: #7B7;
     }
 
     #remoteStatus {
       display: inline;
       margin: 0;
-      height: 18px;
+      height: 24px;
       background-color: #B7B;
     }
     #toolbar {
       position: absolute;
-      top: 18px;
+      top: 24px;
       left: 0;
       right: 0;
       height: 30px;
@@ -44,17 +44,17 @@
 
     #filetoolbar {
       position: absolute;
-      top: 48px;
+      top: 54px;
       left: 0;
       width: 120px;
-      height: 20px;
+      height: 24px;
       text-align: right;
       background-color: #4B69A8;
     }
 
     #filelist {
       position: absolute;
-      top: 68px;
+      top: 78px;
       bottom: 0;
       left: 0;
       width: 120px;
@@ -62,7 +62,7 @@
 
     #editor {
       position: absolute;
-      top: 48px;
+      top: 54px;
       bottom: 0;
       left: 120px;
       right: 0;

+ 10 - 4
src/index.js

@@ -131,7 +131,7 @@ function handleCompileCallback() {
   setRemoteStatus(xhr.responseText);
 }
 
-function handleFileCallback() {
+function handleFileCallback(xhr) {
   setRemoteStatus(xhr.responseText);
   if (isXhrSuccess(xhr)) {
     loadFilelist();
@@ -211,7 +211,9 @@ function preview() {
 function new_file() {
   var xhr = new XMLHttpRequest();
   xhr.open("POST", "file-api.lc", true);
-  xhr.onreadystatechange = handleFileCallback;
+  xhr.onreadystatechange = function() {
+    handleFileCallback(xhr);
+  };
   xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   setLocalStatus("<span class=\"icon icon-loading\"></span> Creating new file");
   xhr.send("action=new");
@@ -224,7 +226,9 @@ function rename_file() {
     if (newfilename != null) {
       var xhr = new XMLHttpRequest();
       xhr.open("POST", "file-api.lc", true);
-      xhr.onreadystatechange = handleFileCallback;
+      xhr.onreadystatechange = function() {
+        handleFileCallback(xhr);
+      };
       xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
       setLocalStatus("<span class=\"icon icon-loading\"></span> Renaming file from \""+filename+"\" to \""+newfilename+"\"");
       xhr.send("action=rename&filename="+escape(filename)+"&newfilename="+escape(newfilename));
@@ -237,7 +241,9 @@ function delete_file() {
     var filename = curFileItem.id;
     var xhr = new XMLHttpRequest();
     xhr.open("POST", "file-api.lc", true);
-    xhr.onreadystatechange = handleFileCallback;
+    xhr.onreadystatechange = function() {
+      handleFileCallback(xhr);
+    };
     xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     setLocalStatus("<span class=\"icon icon-loading\"></span> Deleting file: \""+filename+"\"");
     xhr.send("action=delete&filename="+escape(filename));