From a796dc237667eab9ff60915bbeb8a8223ce6b14f Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sun, 9 Sep 2012 16:45:37 +0100 Subject: [PATCH] Condensing & improving code Simplifying & condensing code in a number of areas Checking for changed content using indexOf showFileMenu function to handle continuing to show file menu (used when moving mouse over options to stop it dissapearing) Condensing multiple blocks File manager icons now using classes rather than inline styles Ternary if condition --- index.php | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/index.php b/index.php index 75164e7..8b567f4 100644 --- a/index.php +++ b/index.php @@ -6,7 +6,7 @@ if (!in_array($_SERVER["REMOTE_ADDR"], $_SESSION['allowedIPs']) && !in_array("*" header('Location: /'); }; -// Check for updates of ICEcoder & CodeMirror +// Check for updates if ($ICEcoder["checkUpdates"]) { $icv = json_encode(file_get_contents("http://icecoder.net/latest-version.txt")); $icv = rtrim(ltrim($icv,'"'),'"\\n'); @@ -34,14 +34,11 @@ theme = "; openLastFiles = ; tabWidth = ; - +iceRoot = ""; + window.onbeforeunload = function() { - for (var i=0; i<=top.ICEcoder.changedContent.length; i++) { - if (top.ICEcoder.changedContent[i]==1) { - return "You have some unsaved changes."; - } + if (top.ICEcoder.changedContent.indexOf(1)>-1) { + return "You have some unsaved changes."; } } @@ -51,11 +48,17 @@ previousFiles = []; +showFileMenu = function() { + document.getElementById('fileMenu').style.display='inline-block'; +} -)" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder', event);" onKeyUp="parent.ICEcoder.resetKeys(event);"> +" onResize="ICEcoder.setLayout()" onKeyDown="return ICEcoder.interceptKeys('coder',event);" onKeyUp="parent.ICEcoder.resetKeys(event);">
@@ -76,16 +79,16 @@ previousFiles = [ - New File - New Folder + New File + New Folder - Delete + Delete - Rename - View Webpage + Rename + View Webpage - Zip It! - Properties + Zip It! + Properties
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -126,7 +129,7 @@ previousFiles = [ '; + echo '
'; } ?>