====== DokuWiki: Hide the site tools from anonymous visitors ======
* This is a JavaScript tool to hide the selected items in site tools (**Recent Changes**, **Media Manager**, and **Sitemap**) from anonymous visitors (those who have not logged in).
* This code hides these site tools **after** they are loaded. The tools appear for an instant and then disappear.
* Works with DokuWiki default template.
===== Code =====
Add the following code to your ''conf/userscript.js''.
if(jQuery("#dokuwiki__usertools li.action.login").length) {
(function() {
let $ul = jQuery('#dokuwiki__sitetools > ul');
let $mobile = jQuery('#dokuwiki__sitetools > div.mobileTools');
/* Recent Changes */
$ul.find('li.action.recent').hide();
$mobile.find('option[value="recent"]').hide();
/* Media Manager */
$ul.find('li.action.media').hide();
$mobile.find('option[value="media"]').hide();
/* Sitemap */
$ul.find('li.action.index').hide();
$mobile.find('option[value="index"]').hide();
})();
}
This will hide all the site tools.
==== Customization ====
To make a part of the site tools show up, you can delete (or comment out) the target lines from the above code. For example, if you like to display **Recent Changes**, remove the following two lines.
$ul.find('li.action.recent').hide();
$mobile.find('option[value="recent"]').hide();