/** * javascript functionality for the arctic template * copies the mothod for dokuwikis TOC functionality * in order to keep the template XHTML valid */ /** * Adds the toggle switch to the TOC */ function addSbLeftTocToggle() { if(!document.getElementById) return; var header = jQuery('sb__left__toc__header'); var header = ""; if(!header) return; var obj = document.createElement('span'); obj.id = 'sb__left__toc__toggle'; obj.innerHTML = ''; obj.className = 'toc_close'; obj.style.cursor = 'pointer'; jQuery.prepend(header,obj); obj.parentNode.onclick = toggleSbLeftToc; try { obj.parentNode.style.cursor = 'pointer'; obj.parentNode.style.cursor = 'hand'; }catch(e){} } /** * This toggles the visibility of the Table of Contents */ function toggleSbLeftToc() { var toc = jQuery('sb__left__toc__inside'); var obj = jQuery('sb__left__toc__toggle'); if(toc.style.display == 'none') { toc.style.display = ''; obj.innerHTML = ''; obj.className = 'toc_close'; } else { toc.style.display = 'none'; obj.innerHTML = '+'; obj.className = 'toc_open'; } } /** * Adds the toggle switch to the TOC */ function addSbRightTocToggle() { if(!document.getElementById) return; var header = jQuery('sb__right__toc__header'); if(!header) return; var obj = document.createElement('span'); obj.id = 'sb__right__toc__toggle'; obj.innerHTML = ''; obj.className = 'toc_close'; obj.style.cursor = 'pointer'; jQuery.prepend(header,obj); obj.parentNode.onclick = toggleSbRightToc; try { obj.parentNode.style.cursor = 'pointer'; obj.parentNode.style.cursor = 'hand'; }catch(e){} } /** * This toggles the visibility of the Table of Contents */ function toggleSbRightToc() { var toc = jQuery('sb__right__toc__inside'); var obj = jQuery('sb__right__toc__toggle'); if(toc.style.display == 'none') { toc.style.display = ''; obj.innerHTML = ''; obj.className = 'toc_close'; } else { toc.style.display = 'none'; obj.innerHTML = '+'; obj.className = 'toc_open'; } } // add TOC events jQuery(addSbLeftTocToggle); jQuery(addSbRightTocToggle); // add AJAX index events jQuery(function(){ index.treeattach($('left__index__tree')); index.treeattach($('right__index__tree')); }); // vim:ts=4:sw=4:et:enc=utf-8: