From 1647d3ea2e818505e7c5ae4055b276f19557dea4 Mon Sep 17 00:00:00 2001 From: Myron Turner Date: Sat, 22 Apr 2017 13:20:28 -0500 Subject: [PATCH] Added double-click funnction to open dw editor when in ckgedit mode --- Changes | 3 +++ script.js | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) mode change 100644 => 100755 script.js diff --git a/Changes b/Changes index 3330fa05..a7830e30 100755 --- a/Changes +++ b/Changes @@ -1037,3 +1037,6 @@ Apr 20 New setting htmlok gives option of allowing HTML_BLOCKs without setting DW's htmlok to true. Changed option to hmtlblock_ok and set default to false. + +Apr 22 +Added double-click funnction to open dw editor when in ckgedit mode diff --git a/script.js b/script.js old mode 100644 new mode 100755 index b018d796..0be7f2d8 --- a/script.js +++ b/script.js @@ -297,3 +297,27 @@ var dokuBase = location.host + DOKU_BASE; jQuery("div.error").hide(); } }); + + +jQuery(document).ready(function(){ + + $dokuWiki = jQuery('.dokuwiki'); + + /** + * If one or more edit section buttons exist? + * This makes sure this feature is enabled only on the edit page and for users with page edit rights. + */ + if (jQuery('.editbutton_section', $dokuWiki).length > 0) { + + // register double click event for all headings and section divs + jQuery('[class^="sectionedit"], div[class^="level"]', $dokuWiki).dblclick(function(){ + // find the closest edit button form to the element double clicked (downwards) and submit the form + var f = jQuery(this).nextAll('.editbutton_section:eq(0)').children('form:eq(0)'); + //alert(jQuery(f).hasClass('button')); + jQuery('').attr('type','hidden').attr('name','mode').attr('value','dwiki').appendTo(jQuery(f)); + jQuery('').attr('type','hidden').attr('name','fck_preview_mode').attr('value','nil').appendTo(jQuery(f)); + f.submit(); + }) + } + +});