Browse Source

Update index.php

Since @TC used keyword as variable, some feature not working lol
yeungalan 5 years ago
parent
commit
5285e446c0
1 changed files with 23 additions and 23 deletions
  1. 23 23
      WriterA/index.php

+ 23 - 23
WriterA/index.php

@@ -256,9 +256,9 @@ body{
     <div id="createError" style="display:none;" class="ts inverted mini negative segment">
     <div id="createError" style="display:none;" class="ts inverted mini negative segment">
         <p id="createErrorMessage">Loading...</p>
         <p id="createErrorMessage">Loading...</p>
     </div>
     </div>
-    <button class="ts tiny primary button" onClick="$(this).parent().hide(); saveAs=false;">Cancel</button>
+    <button class="ts tiny primary button" onClick="$(this).parent().hide(); savingAs=false;">Cancel</button>
     <button class="ts tiny primary button" onClick="confirmCreateNewDocument();">Confirm</button>
     <button class="ts tiny primary button" onClick="confirmCreateNewDocument();">Confirm</button>
-    <button class="closebtn button"  onClick="$(this).parent().hide(); saveAs=false;">X</button>
+    <button class="closebtn button"  onClick="$(this).parent().hide(); savingAs=false;">X</button>
 </div>
 </div>
 <div id="information" style="display:none;" class="centered">
 <div id="information" style="display:none;" class="centered">
     <div style="overflow-y:auto;height:300px">
     <div style="overflow-y:auto;height:300px">
@@ -324,7 +324,7 @@ echo $_GET['filepath'];
     var enableExternalInput = false;
     var enableExternalInput = false;
     var shiftHolding = false;
     var shiftHolding = false;
     var controlHolding = false;
     var controlHolding = false;
-    var saveAs = false; //If saveAs = false, after creating the new document, the current page will be updated to that new document. If set to true, new window will pop out for the new document (aka save As)
+    var savingAs = false; //If savingAs = false, after creating the new document, the current page will be updated to that new document. If set to true, new window will pop out for the new document (aka save As)
     var lastCursorPosition;
     var lastCursorPosition;
     
     
     //Run when the document is ready
     //Run when the document is ready
@@ -473,7 +473,7 @@ echo $_GET['filepath'];
                 console.log("[WriterA] Created File: " + data);
                 console.log("[WriterA] Created File: " + data);
                 if (data.includes("ERROR") == false){
                 if (data.includes("ERROR") == false){
                     //Create and save success.
                     //Create and save success.
-                    if (saveAs){
+                    if (savingAs){
                         //save as new document. Open a new document for that.
                         //save as new document. Open a new document for that.
                         var moduleName = $("#data_modulename").text().trim().split("/").pop();
                         var moduleName = $("#data_modulename").text().trim().split("/").pop();
                 	    var uid = ao_module_utils.getRandomUID();
                 	    var uid = ao_module_utils.getRandomUID();
@@ -623,8 +623,8 @@ echo $_GET['filepath'];
 	    }
 	    }
 	}
 	}
 	
 	
-	//New SaveAs Handler
-    function saveAsHandler(fileData){
+	//New savingAs Handler
+    function savingAsHandler(fileData){
         result = JSON.parse(fileData);
         result = JSON.parse(fileData);
         for (var i=0; i < result.length; i++){
         for (var i=0; i < result.length; i++){
             //var filename = result[i].filename;
             //var filename = result[i].filename;
@@ -646,7 +646,7 @@ echo $_GET['filepath'];
                     console.log("[WriterA] Created File: " + data);
                     console.log("[WriterA] Created File: " + data);
                     if (data.includes("ERROR") == false){
                     if (data.includes("ERROR") == false){
                         //Create and save success.
                         //Create and save success.
-                        if (saveAs){
+                        if (savingAs){
                             //save as new document. Open a new document for that.
                             //save as new document. Open a new document for that.
                             var moduleName = $("#data_modulename").text().trim().split("/").pop();
                             var moduleName = $("#data_modulename").text().trim().split("/").pop();
                     	    var uid = ao_module_utils.getRandomUID();
                     	    var uid = ao_module_utils.getRandomUID();
@@ -690,12 +690,12 @@ echo $_GET['filepath'];
                 hideContextMenu();
                 hideContextMenu();
                 break
                 break
             case "Save As":
             case "Save As":
-                saveAs = true;
+                savingAs = true;
                 var uid = ao_module_utils.getRandomUID();
                 var uid = ao_module_utils.getRandomUID();
                 if (ao_module_virtualDesktop){
                 if (ao_module_virtualDesktop){
-                    ao_module_openFileSelector(uid,"saveAsHandler",undefined,undefined,false,"new","newdoc.md",true);
+                    ao_module_openFileSelector(uid,"savingAsHandler",undefined,undefined,false,"new","newdoc.md",true);
                 }else{
                 }else{
-                    ao_module_openFileSelectorTab(uid,"../",true,"new",saveAsHandler,"newdoc.md",true);
+                    ao_module_openFileSelectorTab(uid,"../",true,"new",savingAsHandler,"newdoc.md",true);
                 }
                 }
                 //$("#saveNewDocument").fadeIn("fast");
                 //$("#saveNewDocument").fadeIn("fast");
                 hideContextMenu();
                 hideContextMenu();
@@ -785,11 +785,11 @@ echo $_GET['filepath'];
                     .done(function( data ) {
                     .done(function( data ) {
 						printPDF(data,false);
 						printPDF(data,false);
 						if(ao_module_virtualDesktop){
 						if(ao_module_virtualDesktop){
-							ao_module_openFileSelector(Math.round(Math.random()*10000),"saveasPDFHTML",undefined,undefined,false,"new","Untitled.pdf",false);
-							//ao_module_openFileSelector(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "folder",callBack=saveasPDF);
+							ao_module_openFileSelector(Math.round(Math.random()*10000),"savingAsPDFHTML",undefined,undefined,false,"new","Untitled.pdf",false);
+							//ao_module_openFileSelector(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "folder",callBack=savingAsPDF);
 						}else{
 						}else{
-							ao_module_openFileSelectorTab(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "new",callBack=saveasPDFHTML,newfwname="Untited.pdf");
-							//ao_module_openFileSelectorTab(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "folder",callBack=saveasPDF);
+							ao_module_openFileSelectorTab(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "new",callBack=savingAsPDFHTML,newfwname="Untited.pdf");
+							//ao_module_openFileSelectorTab(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "folder",callBack=savingAsPDF);
                         }
                         }
                     });
                     });
                 hideContextMenu();
                 hideContextMenu();
@@ -801,11 +801,11 @@ echo $_GET['filepath'];
                     .done(function( data ) {
                     .done(function( data ) {
 						datauri = data;
 						datauri = data;
 						if(ao_module_virtualDesktop){
 						if(ao_module_virtualDesktop){
-							ao_module_openFileSelector(Math.round(Math.random()*10000),"saveasPDFHTML",undefined,undefined,false,"new","Untitled.html",false);
-							//ao_module_openFileSelector(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "folder",callBack=saveasHTML);
+							ao_module_openFileSelector(Math.round(Math.random()*10000),"savingAsPDFHTML",undefined,undefined,false,"new","Untitled.html",false);
+							//ao_module_openFileSelector(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "folder",callBack=savingAsHTML);
 						}else{
 						}else{
-							ao_module_openFileSelectorTab(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "new",callBack=saveasPDFHTML,newfwname="Untited.html");
-							//ao_module_openFileSelectorTab(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "folder",callBack=saveasHTML);
+							ao_module_openFileSelectorTab(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "new",callBack=savingAsPDFHTML,newfwname="Untited.html");
+							//ao_module_openFileSelectorTab(Math.round(Math.random()*10000), "../",allowMultiple = false, selectMode = "folder",callBack=savingAsHTML);
                         }
                         }
                         
                         
                     });
                     });
@@ -869,7 +869,7 @@ echo $_GET['filepath'];
 	    }
 	    }
 	}
 	}
 	
 	
-	function printPDF(htmlContent,saveAsFile = true) {
+	function printPDF(htmlContent,savingAsFile = true) {
         var pdf = new jsPDF('p', 'pt', 'letter');
         var pdf = new jsPDF('p', 'pt', 'letter');
         // source can be HTML-formatted string, or a reference
         // source can be HTML-formatted string, or a reference
         // to an actual DOM element from which the text will be scraped.
         // to an actual DOM element from which the text will be scraped.
@@ -911,7 +911,7 @@ echo $_GET['filepath'];
                 }else{
                 }else{
                     filename = "Untitled"
                     filename = "Untitled"
                 }
                 }
-				if(saveAsFile){
+				if(savingAsFile){
 					pdf.save(filename + '.pdf');
 					pdf.save(filename + '.pdf');
 				}else{
 				}else{
 					datauri = pdf.output("datauristring");
 					datauri = pdf.output("datauristring");
@@ -920,7 +920,7 @@ echo $_GET['filepath'];
         );
         );
     }
     }
     
     
-	function saveasPDFHTML(path){
+	function savingAsPDFHTML(path){
 		try{
 		try{
 			console.log(path);
 			console.log(path);
 			var filepath = JSON.parse(path)[0]["filepath"];
 			var filepath = JSON.parse(path)[0]["filepath"];
@@ -984,9 +984,9 @@ echo $_GET['filepath'];
 	        //This is a new file. Let the user choose where to save this file first and use create function call to save
 	        //This is a new file. Let the user choose where to save this file first and use create function call to save
 	        var uid = ao_module_utils.getRandomUID();
 	        var uid = ao_module_utils.getRandomUID();
             if (ao_module_virtualDesktop){
             if (ao_module_virtualDesktop){
-                ao_module_openFileSelector(uid,"saveAsHandler",undefined,undefined,false,"new","newdoc.md",true);
+                ao_module_openFileSelector(uid,"savingAsHandler",undefined,undefined,false,"new","newdoc.md",true);
             }else{
             }else{
-                ao_module_openFileSelectorTab(uid,"../",true,"new",saveAsHandler,"newdoc.md",true);
+                ao_module_openFileSelectorTab(uid,"../",true,"new",savingAsHandler,"newdoc.md",true);
             }
             }
 	    }
 	    }