From 61746d5540723d7463a0c1d666decb9c164c6678 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 9 Aug 2013 16:07:21 +0200 Subject: added a very simplistic lightbox --- lib/plugins/extension/script.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lib/plugins/extension/script.js (limited to 'lib/plugins/extension/script.js') diff --git a/lib/plugins/extension/script.js b/lib/plugins/extension/script.js new file mode 100644 index 000000000..f2a6aae50 --- /dev/null +++ b/lib/plugins/extension/script.js @@ -0,0 +1,34 @@ +jQuery(function(){ + + + /** + * very simple lightbox + * @link http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/super-simple-lightbox-with-css-and-jquery/ + */ + jQuery('a.extension_screenshot').click(function(e) { + e.preventDefault(); + + //Get clicked link href + var image_href = jQuery(this).attr("href"); + + // create lightbox if needed + var $lightbox = jQuery('#plugin__extensionlightbox'); + if(!$lightbox.length){ + $lightbox = jQuery('

Click to close

') + .appendTo(jQuery('body')) + .hide() + .click(function(){ + $lightbox.hide(); + }); + } + + // fill and show it + $lightbox + .show() + .find('div').html(''); + + + return false; + }); + +}); \ No newline at end of file -- cgit v1.2.3 From 72dda0b4378651b271f5fb516fb8e21a80ac3ebf Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 9 Aug 2013 23:55:39 +0200 Subject: added AJAX detail infos --- lib/plugins/extension/script.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'lib/plugins/extension/script.js') diff --git a/lib/plugins/extension/script.js b/lib/plugins/extension/script.js index f2a6aae50..7480801ac 100644 --- a/lib/plugins/extension/script.js +++ b/lib/plugins/extension/script.js @@ -5,7 +5,7 @@ jQuery(function(){ * very simple lightbox * @link http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/super-simple-lightbox-with-css-and-jquery/ */ - jQuery('a.extension_screenshot').click(function(e) { + jQuery('#extension__manager a.extension_screenshot').click(function(e) { e.preventDefault(); //Get clicked link href @@ -31,4 +31,31 @@ jQuery(function(){ return false; }); + /** + * AJAX detail infos + */ + jQuery('#extension__manager a.info').click(function(e){ + e.preventDefault(); + + var $link = jQuery(this); + var $details = $link.parent().find('dl.details'); + if($details.length){ + $link.toggleClass('close'); + $details.toggle(); + return; + } + + $link.addClass('close'); + jQuery.get( + DOKU_BASE + 'lib/exe/ajax.php', + { + call: 'plugin_extension', + ext: $link.data('extid') + }, + function(data){ + $link.parent().append(data); + } + ); + }); + }); \ No newline at end of file -- cgit v1.2.3 From 8ecc39810428baa07bb322c5f515f56bac533746 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 11 Aug 2013 12:14:17 +0200 Subject: confirm uninstalling of extensions --- lib/plugins/extension/script.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/plugins/extension/script.js') diff --git a/lib/plugins/extension/script.js b/lib/plugins/extension/script.js index 7480801ac..bd3c97758 100644 --- a/lib/plugins/extension/script.js +++ b/lib/plugins/extension/script.js @@ -1,5 +1,15 @@ jQuery(function(){ + /** + * Confirm uninstalling + */ + jQuery('#extension__manager input.uninstall').click(function(e){ + if(!window.confirm(LANG.plugins.extension.reallydel)){ + e.preventDefault(); + return false; + } + return true; + }); /** * very simple lightbox -- cgit v1.2.3 From fd51614b39b1320c5723e8195f0bf69c25baaeb7 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 15 Feb 2014 10:10:38 +0100 Subject: enable/disable extensions via AJAX FS#2927 --- lib/plugins/extension/script.js | 50 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'lib/plugins/extension/script.js') diff --git a/lib/plugins/extension/script.js b/lib/plugins/extension/script.js index bd3c97758..fab88162d 100644 --- a/lib/plugins/extension/script.js +++ b/lib/plugins/extension/script.js @@ -1,9 +1,11 @@ jQuery(function(){ + var $extmgr = jQuery('#extension__manager'); + /** * Confirm uninstalling */ - jQuery('#extension__manager input.uninstall').click(function(e){ + $extmgr.find('input.uninstall').click(function(e){ if(!window.confirm(LANG.plugins.extension.reallydel)){ e.preventDefault(); return false; @@ -15,7 +17,7 @@ jQuery(function(){ * very simple lightbox * @link http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/super-simple-lightbox-with-css-and-jquery/ */ - jQuery('#extension__manager a.extension_screenshot').click(function(e) { + $extmgr.find('a.extension_screenshot').click(function(e) { e.preventDefault(); //Get clicked link href @@ -41,10 +43,49 @@ jQuery(function(){ return false; }); + /** + * Enable/Disable extension via AJAX + */ + $extmgr.find('input.disable, input.enable').click(function (e) { + e.preventDefault(); + var $btn = jQuery(this); + + // get current state + var extension = $btn.attr('name').split('[')[2]; + extension = extension.substr(0, extension.length - 1); + var act = ($btn.hasClass('disable')) ? 'disable' : 'enable'; + + // disable while we wait + $btn.attr('disabled', 'disabled'); + $btn.css('cursor', 'wait'); + + // execute + jQuery.get( + DOKU_BASE + 'lib/exe/ajax.php', + { + call: 'plugin_extension', + ext: extension, + act: act + }, + function (data) { + $btn.css('cursor', '') + .removeAttr('disabled') + .removeClass('disable') + .removeClass('enable') + .val(data.label) + .addClass(data.reverse) + .parents('li') + .removeClass('disabled') + .removeClass('enabled') + .addClass(data.state); + } + ); + }); + /** * AJAX detail infos */ - jQuery('#extension__manager a.info').click(function(e){ + $extmgr.find('a.info').click(function(e){ e.preventDefault(); var $link = jQuery(this); @@ -60,7 +101,8 @@ jQuery(function(){ DOKU_BASE + 'lib/exe/ajax.php', { call: 'plugin_extension', - ext: $link.data('extid') + ext: $link.data('extid'), + act: 'info' }, function(data){ $link.parent().append(data); -- cgit v1.2.3