|
@@ -1,9 +1,3 @@
|
|
-<?php
|
|
|
|
-include_once '../auth.php';
|
|
|
|
-if (!file_exists("tmp")){
|
|
|
|
- mkdir("tmp",0777,true);
|
|
|
|
-}
|
|
|
|
-?>
|
|
|
|
<!DOCTYPE html>
|
|
<!DOCTYPE html>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
<html lang="en">
|
|
<html lang="en">
|
|
@@ -71,7 +65,7 @@ if (!file_exists("tmp")){
|
|
display:inline;
|
|
display:inline;
|
|
padding-left: 8px;
|
|
padding-left: 8px;
|
|
padding-right: 1px;
|
|
padding-right: 1px;
|
|
- marign-left:1px;
|
|
|
|
|
|
+ margin-left:1px;
|
|
height:25px;
|
|
height:25px;
|
|
border-bottom: 3px solid #878787;
|
|
border-bottom: 3px solid #878787;
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
@@ -189,7 +183,6 @@ if (!file_exists("tmp")){
|
|
<button onClick="startTooggleMenu(this);">File</button>
|
|
<button onClick="startTooggleMenu(this);">File</button>
|
|
<button onClick="startTooggleMenu(this);">Edit</button>
|
|
<button onClick="startTooggleMenu(this);">Edit</button>
|
|
<button onClick="startTooggleMenu(this);">Search</button>
|
|
<button onClick="startTooggleMenu(this);">Search</button>
|
|
- <button onClick="startTooggleMenu(this);">Utils</button>
|
|
|
|
<button onClick="startTooggleMenu(this);">Theme</button>
|
|
<button onClick="startTooggleMenu(this);">Theme</button>
|
|
<button onClick="startTooggleMenu(this);">Font_Size</button>
|
|
<button onClick="startTooggleMenu(this);">Font_Size</button>
|
|
<button onClick="startTooggleMenu(this);">About</button>
|
|
<button onClick="startTooggleMenu(this);">About</button>
|
|
@@ -285,21 +278,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
|
|
<hr>
|
|
<hr>
|
|
<button style="background-color:white;border: 1px solid #707070;" onClick="$('#specialCharInsert').hide();">Close</button><p style="font-size:50%;display:inline-block;padding-left:20px;" id="scid">N/A</p>
|
|
<button style="background-color:white;border: 1px solid #707070;" onClick="$('#specialCharInsert').hide();">Close</button><p style="font-size:50%;display:inline-block;padding-left:20px;" id="scid">N/A</p>
|
|
</div>
|
|
</div>
|
|
-<?php
|
|
|
|
- $draginFilePath = "";
|
|
|
|
- if (isset($_GET['filepath'])){
|
|
|
|
- $rootRealPath = str_replace("\\","/",realpath("../")). "/";
|
|
|
|
- if (file_exists($_GET['filepath']) == false){
|
|
|
|
- $_GET['filepath'] = "../" . $_GET['filepath'];
|
|
|
|
- }
|
|
|
|
- $fileRealPath = str_replace("\\","/",realpath($_GET['filepath']));
|
|
|
|
- $draginFilePath = str_replace($rootRealPath,"",$fileRealPath);
|
|
|
|
- echo $_GET['filepath'];
|
|
|
|
- }
|
|
|
|
-?>
|
|
|
|
<script>
|
|
<script>
|
|
//Global variables
|
|
//Global variables
|
|
-var dragIn = "<?php echo $draginFilePath;?>";
|
|
|
|
|
|
+var dragIn = "";
|
|
var theme = 'github';
|
|
var theme = 'github';
|
|
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
|
var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
|
var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
@@ -307,7 +288,7 @@ var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox')
|
|
var lastSelectedMenuItem = "";
|
|
var lastSelectedMenuItem = "";
|
|
var username = loadStorage("ArOZusername");
|
|
var username = loadStorage("ArOZusername");
|
|
var fontsize = 12;
|
|
var fontsize = 12;
|
|
-var VDI = !(!parent.isFunctionBar);
|
|
|
|
|
|
+var VDI = ao_module_virtualDesktop;
|
|
var openedFilePath = [];
|
|
var openedFilePath = [];
|
|
var previousSavedState = true;
|
|
var previousSavedState = true;
|
|
var currentSaveAsPath = "";
|
|
var currentSaveAsPath = "";
|
|
@@ -318,7 +299,6 @@ var functionList = {
|
|
File: ["📄 New","📂 Open File","Run in FloatWindow","Open current directory","Reload","💾 Save","💾 Save As","Close All Tabs","🖨 Print","Exit"],
|
|
File: ["📄 New","📂 Open File","Run in FloatWindow","Open current directory","Reload","💾 Save","💾 Save As","Close All Tabs","🖨 Print","Exit"],
|
|
Edit: ["⤺ Undo","⤻ Redo","Open in New Tab","Insert Special Characters"],
|
|
Edit: ["⤺ Undo","⤻ Redo","Open in New Tab","Insert Special Characters"],
|
|
Search:["Find / Replace"],
|
|
Search:["Find / Replace"],
|
|
- Utils:["🗃 Open Cache folder","🎨 Color Picker","📱 Mobile Preview","📔 CSS Document","📘 System Icons","🏗 gcc Builder"],
|
|
|
|
Theme:["ambiance","chaos","chrome","clouds","clouds_midnight","cobalt","crimson_editor","dawn","dracula","dreamweaver","eclipse","github","gob","gruvbox","idle_fingers","iplastic","katzenmilch","kr_theme","kuroir","merbivore","merbivore_soft","mono_industrial","monokai","pastel_on_dark","solarized_dark","solarized_light","sqlserver","terminal","textmate","tomorrow","tomorrow_night","tomorrow_night_blue","tomorrow_night_bright","tomorrow_night_eighties","twilight","vibrant_ink","xcode"],
|
|
Theme:["ambiance","chaos","chrome","clouds","clouds_midnight","cobalt","crimson_editor","dawn","dracula","dreamweaver","eclipse","github","gob","gruvbox","idle_fingers","iplastic","katzenmilch","kr_theme","kuroir","merbivore","merbivore_soft","mono_industrial","monokai","pastel_on_dark","solarized_dark","solarized_light","sqlserver","terminal","textmate","tomorrow","tomorrow_night","tomorrow_night_blue","tomorrow_night_bright","tomorrow_night_eighties","twilight","vibrant_ink","xcode"],
|
|
Font_Size:["8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25"],
|
|
Font_Size:["8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25"],
|
|
About:["About NotepadA"]
|
|
About:["About NotepadA"]
|
|
@@ -340,8 +320,6 @@ function initNotepadA(){
|
|
$(".topbar").css("padding-left","0px");
|
|
$(".topbar").css("padding-left","0px");
|
|
}
|
|
}
|
|
|
|
|
|
- ao_module_setGlassEffectMode()
|
|
|
|
- ao_module_setWindowIcon("code");
|
|
|
|
//ao_module_setWindowSize(1080,600);
|
|
//ao_module_setWindowSize(1080,600);
|
|
if (loadStorage("NotepadA_" + username + "_sessionFiles") != ""){
|
|
if (loadStorage("NotepadA_" + username + "_sessionFiles") != ""){
|
|
var pages = JSON.parse(loadStorage("NotepadA_" + username + "_sessionFiles"));
|
|
var pages = JSON.parse(loadStorage("NotepadA_" + username + "_sessionFiles"));
|
|
@@ -405,27 +383,18 @@ function newEditor(filepath){
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
let tabid = Math.round((new Date()).getTime());
|
|
let tabid = Math.round((new Date()).getTime());
|
|
- var fileInternalIdentifier = "../../";
|
|
|
|
- var external = false;
|
|
|
|
- if (filepath.substring(0,14) == "/media/storage"){
|
|
|
|
- //This file is stored in external stoarge path. Use real path instead.
|
|
|
|
- fileInternalIdentifier = "";
|
|
|
|
- external = true;
|
|
|
|
- }else if (filepath.includes("SystemAOB/functions/extDiskAccess.php?file=")){
|
|
|
|
-
|
|
|
|
- //This file is opened using file explorer and it has attached an opener with the file.
|
|
|
|
- filepath = filepath.replace("SystemAOB/functions/extDiskAccess.php?file=","");
|
|
|
|
- external = true;
|
|
|
|
|
|
+ let payload = {
|
|
|
|
+ "theme": theme,
|
|
|
|
+ "filename": filepath,
|
|
|
|
+ "fontsize": fontsize,
|
|
|
|
+ "timestamp": Date.now() //Add this to make sure browser dont cache resp
|
|
}
|
|
}
|
|
- var tab = '<div class="fileTab" tabid="'+tabid+'" framematch="ca'+tabid+'" filename="' + fileInternalIdentifier + filepath +'">\
|
|
|
|
- loading... <div class="closeBtn">⨯</div>\
|
|
|
|
- </div>';
|
|
|
|
-
|
|
|
|
- var editorRelative = "../../";
|
|
|
|
- if (external){
|
|
|
|
- editorRelative = "";
|
|
|
|
- }
|
|
|
|
- var frame = '<div style="position:fixed;width:100%;"><iframe id="ca'+tabid+'" class="editor" src="ace/editor.php?theme='+theme+'&filename=' + editorRelative +filepath+'&fontsize=' + fontsize + '" width="100%" frameBorder="0"></iframe></div>';
|
|
|
|
|
|
+
|
|
|
|
+ let encodedPayload = encodeURIComponent(JSON.stringify(payload))
|
|
|
|
+ var tab = `<div class="fileTab" tabid="${tabid}" framematch="ca${tabid}" filename="${filepath}">
|
|
|
|
+ loading... <div class="closeBtn">⨯</div>
|
|
|
|
+ </div>`;
|
|
|
|
+ var frame = `<div style="position:fixed;width:100%;"><iframe id="ca${tabid}" class="editor" src="ace/editor.html#${encodedPayload}" width="100%" frameBorder="0"></iframe></div>`;
|
|
$("#tabs").append(tab);
|
|
$("#tabs").append(tab);
|
|
$("#codeArea").append(frame);
|
|
$("#codeArea").append(frame);
|
|
updateFrameAttr('ca' + tabid);
|
|
updateFrameAttr('ca' + tabid);
|
|
@@ -665,9 +634,6 @@ function bindListener(){
|
|
}else if (lastSelectedMenuItem == "Edit"){
|
|
}else if (lastSelectedMenuItem == "Edit"){
|
|
handleEditMenu($(this).text());
|
|
handleEditMenu($(this).text());
|
|
$("#topbarMenu").hide();
|
|
$("#topbarMenu").hide();
|
|
- }else if (lastSelectedMenuItem == "Utils"){
|
|
|
|
- handleCacheMenu($(this).text());
|
|
|
|
- $("#topbarMenu").hide();
|
|
|
|
}else{
|
|
}else{
|
|
alert(lastSelectedMenuItem);
|
|
alert(lastSelectedMenuItem);
|
|
}
|
|
}
|
|
@@ -676,65 +642,6 @@ function bindListener(){
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-function handleCacheMenu(itemText){
|
|
|
|
- var indexvalue = functionList.Utils.indexOf(itemText);
|
|
|
|
- switch (indexvalue){
|
|
|
|
- case 0:
|
|
|
|
- var url = "SystemAOB/functions/file_system/index.php?controlLv=2&finishing=embedded&subdir=NotepadA/tmp";
|
|
|
|
- if (!VDI){
|
|
|
|
- window.open("../" + url);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- var uid = Math.round((new Date()).getTime() / 1000);
|
|
|
|
- var title = "NotepadA" + " - Cache View";
|
|
|
|
- var icon = "folder open";
|
|
|
|
- newfw(url,title,icon,uid,1080,580);
|
|
|
|
- break;
|
|
|
|
- case 1:
|
|
|
|
- var url = "NotepadA/utils/colorpicker/";
|
|
|
|
- var uid = "colorpicker";
|
|
|
|
- var title = "NotepadA" + " - Color Picker";
|
|
|
|
- var icon = "tint";
|
|
|
|
- newfw(url,title,icon,uid,360,196,undefined,undefined,false,true);
|
|
|
|
- break;
|
|
|
|
- case 2:
|
|
|
|
- var id = getFocusedTab()[0];
|
|
|
|
- var filepath = $("#" + id)[0].contentWindow.getFilepath().replace("../","");
|
|
|
|
- //Change the filepath relative from AOR to the preview script's relative path
|
|
|
|
- filepath = "../../../" + filepath;
|
|
|
|
- var url = "NotepadA/utils/mobipreview/index.php?preview=" + filepath;
|
|
|
|
- var uid = Math.round((new Date()).getTime() / 1000);
|
|
|
|
- var title = "NotepadA" + " - Mobile Preview";
|
|
|
|
- var icon = "mobile";
|
|
|
|
- newfw(url,title,icon,uid,335,550,undefined,undefined,true,true);
|
|
|
|
- break;
|
|
|
|
- case 3:
|
|
|
|
- //Open the CSS document in a new float window
|
|
|
|
- var url = "NotepadA/utils/tocasdoc/index.php";
|
|
|
|
- var uid = Math.round((new Date()).getTime() / 1000);
|
|
|
|
- var title = "NotepadA" + " - CSS LookUp";
|
|
|
|
- var icon = "css3";
|
|
|
|
- newfw(url,title,icon,uid,450,565,undefined,undefined,true,true);
|
|
|
|
- break;
|
|
|
|
- case 4:
|
|
|
|
- //Open the CSS document in a new float window
|
|
|
|
- var url = "NotepadA/utils/tocasdoc/icons.php";
|
|
|
|
- var uid = Math.round((new Date()).getTime() / 1000);
|
|
|
|
- var title = "NotepadA" + " - System Icon List";
|
|
|
|
- var icon = "bookmark";
|
|
|
|
- newfw(url,title,icon,uid,335,550,undefined,undefined,false,true);
|
|
|
|
- break;
|
|
|
|
- case 5:
|
|
|
|
- //Open gcc builder
|
|
|
|
- var url = "NotepadA/utils/gcci/index.php";
|
|
|
|
- var uid = Math.round((new Date()).getTime() / 1000);
|
|
|
|
- var title = "NotepadA" + " - GCCI";
|
|
|
|
- var icon = "code";
|
|
|
|
- newfw(url,title,icon,uid,420,550,undefined,undefined,false,true,ao_module_windowID);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
function handleEditMenu(itemText){
|
|
function handleEditMenu(itemText){
|
|
var indexvalue = functionList.Edit.indexOf(itemText);
|
|
var indexvalue = functionList.Edit.indexOf(itemText);
|
|
switch (indexvalue){
|
|
switch (indexvalue){
|
|
@@ -811,10 +718,13 @@ function launchFocusedTabSearchBox(){
|
|
}
|
|
}
|
|
|
|
|
|
function handleOpenFileFunctionCall(fileData){
|
|
function handleOpenFileFunctionCall(fileData){
|
|
- result = JSON.parse(fileData);
|
|
|
|
- result = result[0]; //As only one file will be selected each time
|
|
|
|
- var filepath = result.filepath;
|
|
|
|
- var filename = result.filename;
|
|
|
|
|
|
+ if (fileData.length == 0){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ fileData = fileData[0];
|
|
|
|
+ var filepath = fileData.filepath;
|
|
|
|
+ var filename = fileData.filename;
|
|
var match = false;
|
|
var match = false;
|
|
var tabid = "";
|
|
var tabid = "";
|
|
$(".fileTab").each(function(){
|
|
$(".fileTab").each(function(){
|
|
@@ -842,12 +752,7 @@ function handleFileMenu(itemText){
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
//Open a file by fileSelector
|
|
//Open a file by fileSelector
|
|
- var uid = new Date().getTime();
|
|
|
|
- if (VDI){
|
|
|
|
- ao_module_openFileSelector(uid,"handleOpenFileFunctionCall");
|
|
|
|
- }else{
|
|
|
|
- ao_module_openFileSelectorTab(uid,"../",true,"file",handleOpenFileFunctionCall);
|
|
|
|
- }
|
|
|
|
|
|
+ ao_module_openFileSelector(handleOpenFileFunctionCall, "user:/Desktop", "file", false);
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
//Run this script in floatWindow
|
|
//Run this script in floatWindow
|
|
@@ -1027,6 +932,7 @@ function initFontSize(){
|
|
|
|
|
|
function setStorage(configName,configValue){
|
|
function setStorage(configName,configValue){
|
|
//localStorage.setItem(name, value);
|
|
//localStorage.setItem(name, value);
|
|
|
|
+ /*
|
|
$.ajax({
|
|
$.ajax({
|
|
type: 'POST',
|
|
type: 'POST',
|
|
url: "../SystemAOB/functions/user/userGlobalConfig.php",
|
|
url: "../SystemAOB/functions/user/userGlobalConfig.php",
|
|
@@ -1034,25 +940,14 @@ function setStorage(configName,configValue){
|
|
success: function(data){},
|
|
success: function(data){},
|
|
async:true
|
|
async:true
|
|
});
|
|
});
|
|
|
|
+ */
|
|
|
|
+ ao_module_storage.setStorage("NotepadA", configName, configValue);
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
function loadStorage(configName){
|
|
function loadStorage(configName){
|
|
- /* if (localStorage.getItem(name) == null){
|
|
|
|
- return "";
|
|
|
|
- }else{
|
|
|
|
- return localStorage.getItem(name);
|
|
|
|
- } */
|
|
|
|
var result = "";
|
|
var result = "";
|
|
- $.ajax({
|
|
|
|
- type: 'POST',
|
|
|
|
- url: "../SystemAOB/functions/user/userGlobalConfig.php",
|
|
|
|
- data: {module: "NotepadA",name:configName},
|
|
|
|
- success: function(data){result = data;},
|
|
|
|
- error: function(data){result = "";},
|
|
|
|
- async:false,
|
|
|
|
- timeout: 3000
|
|
|
|
- });
|
|
|
|
|
|
+ ao_module_storage.loadStorage("NotepadA", configName);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|