Gebruiker:Willemo/editors.js
Opmerking: na het publiceren is het wellicht nodig uw browsercache te legen om de veranderingen te zien.
- Firefox / Safari: houd Shift ingedrukt terwijl u:je op Vernieuwen klikt of druk op Ctrl-F5 of Ctrl-R (⌘-Shift-R op een Mac)
- Google Chrome: druk op Ctrl-Shift-R (⌘-Shift-R op een Mac)
- Edge: houd Ctrl ingedrukt terwijl u:je op Vernieuwen klikt of druk op Ctrl-F5.
function CreateMenuItem(item, href)
{
// Create menu item
var menuitem = document.createElement("li");
// Create menu link
var menulink = document.createElement("a");
// Text
menulink.appendChild(document.createTextNode(item));
// Link
attr = document.createAttribute("href");
attr.value = href;
menulink.setAttributeNode(attr);
// Add link to item
menuitem.appendChild(menulink);
return menuitem;
}
function ChangePortlets()
{
var toolbox = document.getElementById("p-tb");
var toolboxdivs = toolbox.getElementsByTagName("div");
var toolboxdiv = toolboxdivs[0]; // there is only one div
var toolboxuls = toolboxdiv.getElementsByTagName("ul")
var toolboxul = toolboxuls[0]; // there is only one ul
toolboxul.appendChild(CreateMenuItem("Paginastatistieken", "http://toolserver.org/~willemo/cgi-bin/editors.py?page=" + wgArticleId));
}
function ModifyPortlets()
{
if (wgNamespaceNumber == 0 && wgArticleId != 0)
{
ChangePortlets()
}
}
window.addEventListener ('DOMContentLoaded', ModifyPortlets, false);