User:Yamakiri on Firefox/quicknav.js

// See Talk page for instructions if (wgNamespaceNumber >= 0) addOnloadHook(function { var pCactions = document.getElementById('p-cactions'); var tabs = pCactions.getElementsByTagName('ul')[0]; var caMain = pCactions.getElementsByTagName('li')[0]; var menu2 = pCactions.getElementsByTagName('li')[1]; var caTalk = document.getElementById('ca-talk'); var caEdit = document.getElementById('ca-edit'); if (!caEdit) { caEdit = document.getElementById('ca-viewsource'); } var caHistory = document.getElementById('ca-history'); // Insert new menu after first entry na = document.createElement("a"); na.appendChild(document.createTextNode('pagenav')); na.href = "#"; var mn = document.createElement("ul"); li = document.createElement("li") li.appendChild(na); li.appendChild(mn); li.className = 'tabmenu'; li.id = 'ca-quicknav'; tabs.insertBefore(li,menu2); // Hide menus if (caEdit) caEdit.style.display = 'none'; if (caTalk) caTalk.style.display = 'none'; if (caHistory) caHistory.style.display = 'none'; // Retrieve URLs var hrefmain = caMain.firstChild.getAttribute('href', 2); var hreftalk = caTalk.firstChild.getAttribute('href', 2); // Add menu items addPortletLink('hrefmain, 'view'); addPortletLink('hrefmain + '?action=edit', 'edit'); addPortletLink('hrefmain + '?action=history', 'history'); addPortletLink('hreftalk, 'view discussion'); addPortletLink('hreftalk + '?action=edit', 'edit discussion'); addPortletLink('hreftalk + '?action=history', 'discussion history'); });