1 2/** 3 * extend index object function to add quality icons to all pages 4 */ 5index.saved_treeattach = index.treeattach; 6index.treeattach = function(obj){ 7 if (!obj) return; 8 index.saved_treeattach(obj); 9 10 var items = getElementsByClass('wikilink1',obj,'a'); 11 for(var i=0; i<items.length; i++){ 12 var elem = items[i]; 13 14 var img = document.createElement('img'); 15 img.src = DOKU_BASE+'lib/plugins/qc/icon.php?id='+elem.title+'&type=small'; 16 img.alt = ''; 17 img.className = 'qc_smallicon'; 18 elem.parentNode.appendChild(img); 19 } 20}; 21 22 23function plugin_qc_toggle(e){ 24 var out = $('plugin__qc__out'); 25 if(!out) return; 26 27 // extract needed params from the icon src URL 28 var param = e.target.src.split('?'); 29 30 // it's shown currently -> disable 31 if(out.style.display != 'none'){ 32 out.style.display = 'none'; 33 return; 34 } 35 36 // it's not shown currently -> fetch 37 out.innerHTML = 'loading...'; 38 out.style.display = ''; 39 40 var ajax = new sack(DOKU_BASE + 'lib/plugins/qc/pageinfo.php'); 41 ajax.AjaxFailedAlert = ''; 42 ajax.encodeURIString = false; 43 ajax.elementObj = out; 44 ajax.runAJAX(param[1]); 45 46} 47 48addInitEvent(function(){ 49 var icon = $('plugin__qc__icon'); 50 if(!icon) return; 51 addEvent(icon,'click',plugin_qc_toggle); 52 icon.style.cursor = 'pointer'; 53}); 54