aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/scripts/edit.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/edit.js')
-rw-r--r--lib/scripts/edit.js126
1 files changed, 0 insertions, 126 deletions
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js
index 2253d05cf..d8a4165fd 100644
--- a/lib/scripts/edit.js
+++ b/lib/scripts/edit.js
@@ -181,129 +181,3 @@ function currentHeadlineLevel(textboxId){
}
return 7 - s.match(/^={2,6}/)[0].length;
}
-
-
-/**
- * global var used for not saved yet warning
- */
-window.textChanged = false;
-
-/**
- * global var which stores original editor content
- */
-window.doku_edit_text_content = '';
-/**
- * Delete the draft before leaving the page
- */
-function deleteDraft() {
- if (is_opera || window.keepDraft) {
- return;
- }
-
- var $dwform = jQuery('#dw__editform');
-
- if($dwform.length === 0) {
- return;
- }
-
- // remove a possibly saved draft using ajax
- jQuery.post(DOKU_BASE + 'lib/exe/ajax.php',
- {
- call: 'draftdel',
- id: $dwform.find('input[name=id]').val(),
- sectok: $dwform.find('input[name=sectok]').val()
- }
- );
-}
-
-/**
- * Activate "not saved" dialog, add draft deletion to page unload,
- * add handlers to monitor changes
- * Note: textChanged could be set by e.g. html_edit() as well
- *
- * Sets focus to the editbox as well
- */
-jQuery(function () {
- var $editform = jQuery('#dw__editform');
- if ($editform.length == 0) {
- return;
- }
-
- var $edit_text = jQuery('#wiki__text');
- if ($edit_text.length > 0) {
- if($edit_text.attr('readOnly')) {
- return;
- }
-
- // set focus and place cursor at the start
- var sel = DWgetSelection($edit_text[0]);
- sel.start = 0;
- sel.end = 0;
- DWsetSelection(sel);
- $edit_text.trigger('focus');
-
- doku_edit_text_content = $edit_text.val();
- }
-
- var changeHandler = function() {
- doku_hasTextBeenModified();
-
- doku_summaryCheck();
- };
-
- $editform.change(changeHandler);
- $editform.keydown(changeHandler);
-
- window.onbeforeunload = function(){
- if(window.textChanged) {
- return LANG.notsavedyet;
- }
- };
- window.onunload = deleteDraft;
-
- // reset change memory var on submit
- jQuery('#edbtn__save').on('click',
- function() {
- window.onbeforeunload = '';
- textChanged = false;
- }
- );
- jQuery('#edbtn__preview').on('click',
- function() {
- window.onbeforeunload = '';
- textChanged = false;
- window.keepDraft = true; // needed to keep draft on page unload
- }
- );
-
- var $summary = jQuery('#edit__summary');
- $summary.on('change keyup', doku_summaryCheck);
-
- if (textChanged) doku_summaryCheck();
-});
-
-/**
- * Updates textChanged variable if content of the editor has been modified
- */
-function doku_hasTextBeenModified() {
- if (!textChanged) {
- var $edit_text = jQuery('#wiki__text');
-
- if ($edit_text.length > 0) {
- textChanged = doku_edit_text_content != $edit_text.val();
- } else {
- textChanged = true;
- }
- }
-}
-
-/**
- * Checks if a summary was entered - if not the style is changed
- *
- * @author Andreas Gohr <andi@splitbrain.org>
- */
-function doku_summaryCheck(){
- var $sum = jQuery('#edit__summary'),
- missing = $sum.val() === '';
- $sum.toggleClass('missing', missing).toggleClass('edit', !missing);
-}