nitdoc: Add a secure when the user reload the page
authorStefan Lage <lagestfan@gmail.com>
Thu, 23 May 2013 23:48:18 +0000 (19:48 -0400)
committerStefan Lage <lagestfan@gmail.com>
Fri, 24 May 2013 02:26:50 +0000 (22:26 -0400)
If a the page is reloaded or quit when a comment is being edit,
we ask if the customer really want to continue.

signed-off by: Stefan Lage <lagestfan@gmail.com>

share/nitdoc/scripts/js-facilities.js

index 58cbddf..ccbfbb5 100644 (file)
@@ -53,6 +53,12 @@ var currentTable = null;
 //Hightlighted index in search result preview table\r
 var currentIndex = -1;\r
 \r
+// Check if a comment is editing\r
+window.onbeforeunload = function() {\r
+       if(editComment > 0){\r
+       return 'Are you sure you want to leave this page?';\r
+       }\r
+};\r
 \r
 /*\r
 * Add folding and filtering facilities to class description page.\r