diff --git a/lib/tpl/dokuwiki/script.js b/lib/tpl/dokuwiki/script.js index d32cf5cffab8d9a7e5bfbf73534bc5de550f8361..5badb58599baa41dc834733a26a0e88e9687aee5 100644 --- a/lib/tpl/dokuwiki/script.js +++ b/lib/tpl/dokuwiki/script.js @@ -4,17 +4,23 @@ function tpl_dokuwiki_mobile(){ var $handle = jQuery('#dokuwiki__aside h3.toggle'); var $toc = jQuery('#dw__toc h3'); if(document.body.clientWidth > 979) { - console.log('desktop'); // reset for desktop mode - $handle[0].setState(1); - $handle.hide(); - $toc[0].setState(1); + if($handle.length) { + $handle[0].setState(1); + $handle.hide(); + } + if($toc.length) { + $toc[0].setState(1); + } } else { - console.log('mobile'); // toc and sidebar hiding - $handle.show(); - $handle[0].setState(-1); - $toc[0].setState(-1); + if($handle.length) { + $handle.show(); + $handle[0].setState(-1); + } + if($toc.length) { + $toc[0].setState(-1); + } } }