Hi,
I finally figured out that NO EventListener()
is needed, but moreso, a rather complicated for-loop to make the querySelector()
work on the sitemap tree elements. Here is, what works WITHOUT the above described tweak in the /dokuwiki/inc/html.php
, so Dokuwiki code can remain untouched! 😀
The following code is to be placed into /dokuwiki/conf/userscript.js (Create if it does not exist!)
jQuery(function() {
var container = document.querySelectorAll("li.closed");
var i=0;
for( i=0; i<container.length; i++ ) {
(container[i]).querySelector("a.idx_dir").click();
}
});
According to lpaulsen93 a simple jQuery(function(){}];
in userscript.js is executed on page load by default.
And it works! (tested in IE11 and Mozilla Firefox) All toggles in the sitemap (namespaces) are opened and the pages are shown (unfolded sitemap).
And, as always, save your file, don't forget to clear the cache in your dokuwiki\data\cache and refresh your browser!
This should be update save now. Enjoy!