Post by Amanda on Apr 2, 2012 1:01:05 GMT
What this code allows you to do is reorder the proboards menu for admins, members and guests. Not only that, you can also remove items from the menu by leaving it out of the array. (from PBS)
Global Headers
You have 3 arrays...
var iStaffMenu = [1, 2, 3, 4, 5, 6, 7, 8];
var iMemberMenu = [1, 2, 3, 4, 5, 6, 7];
var iGuestMenu = [1, 2, 3, 4];
The variables tell you which is which. All you need to do is reorder the numbers or leave some out. So if I wanted to remove the help button from the menu for admins, then I would change it to this...
var iStaffMenu = [1, 3, 4, 5, 6, 7, 8];
Notice that number 2 is missing?
If I wanted to add the help button onto the end of the menu, I would change it to this...
var iStaffMenu = [1, 3, 4, 5, 6, 7, 8, 2];
Global Headers
<script type="text/javascript">
<!--
// Created by PopThosePringles
// Change the order here
var iStaffMenu = [1, 2, 3, 4, 5, 6, 7, 8];
var iMemberMenu = [1, 2, 3, 4, 5, 6, 7];
var iGuestMenu = [1, 2, 3, 4];
function reorderMenu(){
var menu = new Object();
var iCount = 0, admin = false;
var iCell = document.getElementsByTagName("td");
for(c = 0; c < iCell.length; c ++){
if(iCell.item(c).className == "menubg" && iCell.item(c).firstChild){
iCell.item(c).firstChild.id = "themenu";
var cNodes = iCell.item(c).firstChild.childNodes;
for(n = 0; n < cNodes.length; n ++){
if(cNodes.item(n).nodeType == 1){
menu[++ iCount] = {
mnode: cNodes.item(n)
};
if(cNodes.item(n).href.match(/=admin/)){
admin = true;
}
cNodes.item(n).parentNode.removeChild(cNodes.item(n));
n --;
} else {
cNodes.item(n).parentNode.removeChild(cNodes.item(n));
n --;
}
}
}
}
var nOrder = (admin)? iStaffMenu : (pb_username!="Guest" ? iMemberMenu : iGuestMenu);
var theMenu = document.getElementById("themenu");
for(o = 0; o < nOrder.length; o ++){
if(menu[nOrder[o]].mnode){
theMenu.appendChild(menu[nOrder[o]].mnode);
if(o != (nOrder.length - 1)){
theMenu.appendChild(document.createTextNode(" "));
}
}
}
}
reorderMenu();
//-->
</script>
You have 3 arrays...
var iStaffMenu = [1, 2, 3, 4, 5, 6, 7, 8];
var iMemberMenu = [1, 2, 3, 4, 5, 6, 7];
var iGuestMenu = [1, 2, 3, 4];
The variables tell you which is which. All you need to do is reorder the numbers or leave some out. So if I wanted to remove the help button from the menu for admins, then I would change it to this...
var iStaffMenu = [1, 3, 4, 5, 6, 7, 8];
Notice that number 2 is missing?
If I wanted to add the help button onto the end of the menu, I would change it to this...
var iStaffMenu = [1, 3, 4, 5, 6, 7, 8, 2];