From 82fd2a5b5da9729d60a61e7c7a5972aa1f5bfbe2 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Sat, 14 Apr 2012 17:44:02 +0100 Subject: [PATCH] Handling of unsaved changes & loading of previous files Closing or reloading the window now checks for unsaved files and alerts user Filenames opened in previous session loaded into array on start If we have the setting on to open these files, they are opened sequentially on load --- index.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index c8cacc2..09fe4c9 100644 --- a/index.php +++ b/index.php @@ -32,6 +32,23 @@ $docRoot = str_replace("\\","/",$_SERVER['DOCUMENT_ROOT']); if (strrpos($docRoot,"/")==strlen($docRoot)-1) {$docRoot = substr($docRoot,0,strlen($docRoot)-1);}; echo 'fullPath = "'.$docRoot.'";'.PHP_EOL; ?> +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."; + } + } +} + +lastOpenFiles = []; @@ -62,7 +82,7 @@ echo 'fullPath = "'.$docRoot.'";'.PHP_EOL; -
+