Bladeren bron

Update index.php

Since @TC used keyword as variable, some feature not working lol
yeungalan 5 jaren geleden
bovenliggende
commit
5285e446c0
1 gewijzigde bestanden met toevoegingen van 23 en 23 verwijderingen
  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">
         <p id="createErrorMessage">Loading...</p>
     </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="closebtn button"  onClick="$(this).parent().hide(); saveAs=false;">X</button>
+    <button class="closebtn button"  onClick="$(this).parent().hide(); savingAs=false;">X</button>
 </div>
 <div id="information" style="display:none;" class="centered">
     <div style="overflow-y:auto;height:300px">
@@ -324,7 +324,7 @@ echo $_GET['filepath'];
     var enableExternalInput = false;
     var shiftHolding = 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;
     
     //Run when the document is ready
@@ -473,7 +473,7 @@ echo $_GET['filepath'];
                 console.log("[WriterA] Created File: " + data);
                 if (data.includes("ERROR") == false){
                     //Create and save success.
-                    if (saveAs){
+                    if (savingAs){
                         //save as new document. Open a new document for that.
                         var moduleName = $("#data_modulename").text().trim().split("/").pop();
                 	    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);
         for (var i=0; i < result.length; i++){
             //var filename = result[i].filename;
@@ -646,7 +646,7 @@ echo $_GET['filepath'];
                     console.log("[WriterA] Created File: " + data);
                     if (data.includes("ERROR") == false){
                         //Create and save success.
-                        if (saveAs){
+                        if (savingAs){
                             //save as new document. Open a new document for that.
                             var moduleName = $("#data_modulename").text().trim().split("/").pop();
                     	    var uid = ao_module_utils.getRandomUID();
@@ -690,12 +690,12 @@ echo $_GET['filepath'];
                 hideContextMenu();
                 break
             case "Save As":
-                saveAs = true;
+                savingAs = true;
                 var uid = ao_module_utils.getRandomUID();
                 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{
-                    ao_module_openFileSelectorTab(uid,"../",true,"new",saveAsHandler,"newdoc.md",true);
+                    ao_module_openFileSelectorTab(uid,"../",true,"new",savingAsHandler,"newdoc.md",true);
                 }
                 //$("#saveNewDocument").fadeIn("fast");
                 hideContextMenu();
@@ -785,11 +785,11 @@ echo $_GET['filepath'];
                     .done(function( data ) {
 						printPDF(data,false);
 						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{
-							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();
@@ -801,11 +801,11 @@ echo $_GET['filepath'];
                     .done(function( data ) {
 						datauri = data;
 						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{
-							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');
         // source can be HTML-formatted string, or a reference
         // to an actual DOM element from which the text will be scraped.
@@ -911,7 +911,7 @@ echo $_GET['filepath'];
                 }else{
                     filename = "Untitled"
                 }
-				if(saveAsFile){
+				if(savingAsFile){
 					pdf.save(filename + '.pdf');
 				}else{
 					datauri = pdf.output("datauristring");
@@ -920,7 +920,7 @@ echo $_GET['filepath'];
         );
     }
     
-	function saveasPDFHTML(path){
+	function savingAsPDFHTML(path){
 		try{
 			console.log(path);
 			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
 	        var uid = ao_module_utils.getRandomUID();
             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{
-                ao_module_openFileSelectorTab(uid,"../",true,"new",saveAsHandler,"newdoc.md",true);
+                ao_module_openFileSelectorTab(uid,"../",true,"new",savingAsHandler,"newdoc.md",true);
             }
 	    }