1/* global JSINFO, DOKU_BASE */
2
3jQuery(function () {
4    var $wrap = jQuery('#plugin__qc__wrapper');
5    if (!$wrap.length) return;
6    var $summary = $wrap.find('.summary');
7    var $output = $wrap.find('.qc-output').hide();
8
9    // autoload the summary
10    jQuery.post(
11        DOKU_BASE + 'lib/exe/ajax.php',
12        {
13            call: 'plugin_qc_short',
14            id: JSINFO['id']
15        },
16        function (data) {
17            $summary.append(data);
18        }
19    );
20
21    // load the full info on click
22    $summary.click(function () {
23        if ($output.html() == '') {
24            $output.html('loading...');
25
26            jQuery.post(
27                DOKU_BASE + 'lib/exe/ajax.php',
28                {
29                    call: 'plugin_qc_long',
30                    id: JSINFO['id']
31                },
32                function (data) {
33                    $output.html(data);
34                }
35            );
36        }
37        $output.dw_toggle();
38    })
39        .css('cursor', 'pointer')
40    ;
41});
42