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