xref: /plugin/qc/script.js (revision 2e820792fb55a0f094ebe31770b4f6eb86cddd85)
1
2function plugin_qc_toggle(e){
3    var out = $('plugin__qc__out');
4    if(!out) return;
5
6    // extract needed params from the icon src URL
7    var param = e.target.src.split('?');
8
9    // it's shown currently -> disable
10    if(out.style.display != 'none'){
11        out.style.display = 'none';
12        return;
13    }
14
15    // it's not shown currently -> fetch
16    out.innerHTML = 'loading...';
17    out.style.display = '';
18
19    var ajax = new sack(DOKU_BASE + 'lib/plugins/qc/pageinfo.php');
20    ajax.AjaxFailedAlert = '';
21    ajax.encodeURIString = false;
22    ajax.elementObj = out;
23    ajax.runAJAX(param[1]);
24
25}
26
27addInitEvent(function(){
28    var icon = $('plugin__qc__icon');
29    if(!icon) return;
30    addEvent(icon,'click',plugin_qc_toggle);
31    icon.style.cursor = 'pointer';
32});
33