changeset 2423:8305ce6fba2b

Fixes #51, alert now displayed if navigating away from history
author sharky93 <rishabhr123@gmail.com>
date Sun, 25 Aug 2013 15:35:09 +0530
parents c0c71d854ff5
children 8bf6121e6366
files MoinMoin/templates/basic.js
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/basic.js	Sun Aug 25 15:06:01 2013 +0530
+++ b/MoinMoin/templates/basic.js	Sun Aug 25 15:35:09 2013 +0530
@@ -3,13 +3,11 @@
     var edit = false;
     $('#meta, #help').removeClass('active');
     $('textarea').autosize();
-    $('textarea').change(function() {
-    	edit = true;
-    })
     window.onbeforeunload = function(e) {
-    	if (edit) {
-    		edit = false;
-    		return "You have unsaved changes!";
+        // checks if the URL is of the form http://host/+modify/page
+        var index = $.inArray("+modify", window.location.pathname.split('/'));
+        if (index == 1) {
+    		return "Data you may have entered will be discarded!";
     	}
     }
     $('div.dropup').removeClass('menu');