diff --git a/.gitignore b/.gitignore index bd8e90e..ef348ce 100755 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ config.php data/ workspace/ +.project diff --git a/components/editor/dialog.php b/components/editor/dialog.php index 193409d..842ced7 100755 --- a/components/editor/dialog.php +++ b/components/editor/dialog.php @@ -164,6 +164,19 @@ switch($_GET['action']){ + + + + + + + + + + @@ -206,6 +219,9 @@ var editor_settings = { case 'wrap-mode': $(this).children('option[value="'+codiad.editor.settings.wrapMode+'"]').prop('selected',true); break; + case 'right-sidebar-trigger': + $(this).children('option[value="'+codiad.editor.settings.rightSidebarTrigger+'"]').prop('selected',true); + break; } }); }, @@ -241,6 +257,10 @@ var editor_settings = { var bool_val = (val == "true"); codiad.editor.setWrapMode(bool_val); break; + case 'right-sidebar-trigger': + var bool_val = (val == "true"); + codiad.editor.setRightSidebarTrigger(bool_val); + break; } } }); diff --git a/components/editor/init.js b/components/editor/init.js index 0872489..85aed15 100755 --- a/components/editor/init.js +++ b/components/editor/init.js @@ -324,7 +324,7 @@ } }); - $.each(['printMargin', 'highlightLine', 'indentGuides', 'wrapMode'], + $.each(['printMargin', 'highlightLine', 'indentGuides', 'wrapMode', 'rightSidebarTrigger'], function(idx, key) { var localValue = localStorage.getItem('codiad.editor.' + key); @@ -937,6 +937,22 @@ localStorage.setItem('codiad.editor.wrapMode', w); }, + ////////////////////////////////////////////////////////////////// + // + // Set trigger for opening the right sidebar + // + // Parameters: + // t - {Boolean} (false for Hover, true for Click) + // i - {Editor} (If omitted, Defaults to all editors) + // + ////////////////////////////////////////////////////////////////// + + setRightSidebarTrigger: function(t, i) { + this.settings.rightSidebarTrigger = t; + // LocalStorage + localStorage.setItem('codiad.editor.rightSidebarTrigger', t); + }, + ////////////////////////////////////////////////////////////////// // // Get content from editor diff --git a/js/sidebars.js b/js/sidebars.js index cb3e629..a27ac47 100755 --- a/js/sidebars.js +++ b/js/sidebars.js @@ -87,22 +87,43 @@ // Right Column Slider $("#sb-right") - .hoverIntent(function() { - var timeout_r = $(this) - .data("timeout_r"); - if (timeout_r) { - clearTimeout(timeout_r); + .click(function() { + if (codiad.editor.settings.rightSidebarTrigger) { // if trigger set to Click + var timeout_r = $(this) + .data("timeout_r"); + if (timeout_r) { + clearTimeout(timeout_r); + } + $('#editor-region') + .animate({ + 'margin-right': '200px' + }, 300, 'easeOutQuart', function(){ + _this.isRigthSidebarOpen = true; + }); + $(this) + .animate({ + 'right': '0px' + }, 300, 'easeOutQuart'); + } + }) + .hoverIntent(function() { + if (!codiad.editor.settings.rightSidebarTrigger) { // if trigger set to Hover + var timeout_r = $(this) + .data("timeout_r"); + if (timeout_r) { + clearTimeout(timeout_r); + } + $('#editor-region') + .animate({ + 'margin-right': '200px' + }, 300, 'easeOutQuart', function(){ + _this.isRigthSidebarOpen = true; + }); + $(this) + .animate({ + 'right': '0px' + }, 300, 'easeOutQuart'); } - $('#editor-region') - .animate({ - 'margin-right': '200px' - }, 300, 'easeOutQuart', function(){ - _this.isRigthSidebarOpen = true; - }); - $(this) - .animate({ - 'right': '0px' - }, 300, 'easeOutQuart'); }, function() { $(this) .data("timeout_r", setTimeout($.proxy(function() { diff --git a/languages/en.php b/languages/en.php index f145ccc..22d8549 100644 --- a/languages/en.php +++ b/languages/en.php @@ -22,6 +22,9 @@ $lang = array( "Wrap Lines" => "Wrap Lines", "No wrap" => "No wrap", "Wrap Lines" => "Wrap Lines", + "Right Sidebar Trigger" => "Right Sidebar Trigger", + "Hover" => "Hover", + "Click" => "Click", "Close" => "Close", "Yes" => "Yes", "No" => "No",