xref: /dokuwiki/lib/plugins/extension/script.js (revision 975e2a1982518e206667387f0540ce46e5c482ca)
1jQuery(function(){
2
3    /**
4     * Confirm uninstalling
5     */
6    jQuery('#extension__manager input.uninstall').click(function(e){
7        if(!window.confirm(LANG.plugins.extension.reallydel)){
8            e.preventDefault();
9            return false;
10        }
11        return true;
12    });
13
14    /**
15     * very simple lightbox
16     * @link http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/super-simple-lightbox-with-css-and-jquery/
17     */
18    jQuery('#extension__manager a.extension_screenshot').click(function(e) {
19        e.preventDefault();
20
21        //Get clicked link href
22        var image_href = jQuery(this).attr("href");
23
24        // create lightbox if needed
25        var $lightbox = jQuery('#plugin__extensionlightbox');
26        if(!$lightbox.length){
27            $lightbox = jQuery('<div id="plugin__extensionlightbox"><p>Click to close</p><div></div></div>')
28                .appendTo(jQuery('body'))
29                .hide()
30                .click(function(){
31                    $lightbox.hide();
32                });
33        }
34
35        // fill and show it
36        $lightbox
37            .show()
38            .find('div').html('<img src="' + image_href + '" />');
39
40
41        return false;
42    });
43
44    /**
45     * AJAX detail infos
46     */
47    jQuery('#extension__manager a.info').click(function(e){
48        e.preventDefault();
49
50        var $link = jQuery(this);
51        var $details = $link.parent().find('dl.details');
52        if($details.length){
53            $link.toggleClass('close');
54            $details.toggle();
55            return;
56        }
57
58        $link.addClass('close');
59        jQuery.get(
60            DOKU_BASE + 'lib/exe/ajax.php',
61            {
62                call: 'plugin_extension',
63                ext: $link.data('extid')
64            },
65            function(data){
66                $link.parent().append(data);
67            }
68        );
69    });
70
71});