lib/gollum/frontend/public/gollum/javascript/gollum.js in gollum-2.3.7 vs lib/gollum/frontend/public/gollum/javascript/gollum.js in gollum-2.3.8
- old
+ new
@@ -210,6 +210,22 @@
$('a.gollum-revert-button').click(function(e) {
e.preventDefault();
$('#gollum-revert-form').submit();
});
}
+
+ if( $('#wiki-wrapper.edit').length ){
+ $("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
+ $("#gollum-editor-body").one('change', function(){
+ window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
+ });
+ $.GollumEditor();
+ }
+
+ if( $('#wiki-wrapper.create').length ){
+ $("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
+ $("#gollum-editor-body").one('change', function(){
+ window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
+ )};
+ $.GollumEditor({ NewFile: true, MarkupType: '{{default_markup}}' });
+ }
});