Post by Scorpian on Jul 29, 2006 15:44:05 GMT -8
<script type='text/javascript'>
/* Ultimate PM Menu by Scorpian
http://roddyinnov.proboards75.com */
/*=== Edit These ===*/
var newPmImg = 'URL_OF_IMAGE'; // The url of image for new pm's
var noNewPmImg = 'URL_OF_IMAGE'; // The url of image for no new pm's
var guestImg = 'URL_OF_IMAGE'; // The url of image for guests
/*=== Do Not Edit ===*/
var riTable = document.getElementsByTagName('table');
var riTd = document.getElementsByTagName('td');
var tehCellHTML = "<table width='100%' cellspacing='0' cellpadding='4' border='0' id='pmtable' style='display:none;' align='center'><tr>";
if(riTd[2].innerHTML.match(/action=pm">(\d+)\smessag(e|es)<\/a>,\s(\d+)\s(is|are)\snew./i)){
tehCellHTML += "<td>Welcome back "+pb_displayname+"! [ <a href='index.cgi?action=recent'>View Recent Posts</a> ]</td>";
tehCellHTML += "<td align='right'>You have "+RegExp.$1+" private messages, "+RegExp.$3+" "+RegExp.$4+" new.</td></tr>";
tehCellHTML += "<tr><td align='center' colspan='2'><a href='index.cgi?action=pm'>Inbox</a> ~ ";
tehCellHTML += "<a href='index.cgi?action=pm&view=2'>Outbox</a> ~ <a href='index.cgi?action=pmprefs'>Preferences</a> ~ ";
tehCellHTML += "<a href='index.cgi?action=pmmarkasread'>Mark All PM's Read</a> ~ ";
tehCellHTML += "<a href='index.cgi?action=viewprofile'>View Profile</a> ~ ";
tehCellHTML += "<a href='index.cgi?action=modifyprofile&user="+ pb_username +"'>Modify Profile</a></td></tr></table>";
if(RegExp.$3 == 0){
var tehImgSrc = noNewPmImg;
}else{
var tehImgSrc = newPmImg;
}
}else{
tehCellHTML += "<td>Welcome Guest!</td><td align='right'>";
tehCellHTML += "Please <a href='index.cgi?action=login'>login</a> or <a href='index.cgi?action=register'>register</a>.";
tehCellHTML += "</td></tr></table>";
var tehImgSrc = guestImg;
}
var tehCell = riTable[0].insertRow(-1).insertCell(0);
tehCell.parentNode.id = 'pmoutertable';
tehCell.className = 'windowbg';
tehCell.innerHTML = tehCellHTML;
tehCell.height = '1';
tehCell.parentNode.style.display = 'none';
var pmLink = document.createElement('a');
pmLink.href = 'javascript:pmMenu();';
var pmImg = document.createElement('img');
pmImg.src = tehImgSrc;
pmImg.border = '0';
pmLink.appendChild(pmImg);
var allDiv = document.createElement('div');
allDiv.align = 'center';
allDiv.appendChild(pmLink);
var welTab = riTable[0];
welTab.parentNode.insertBefore(allDiv,welTab.nextSibling);
var pmOuterTable = document.getElementById('pmoutertable');
var pmTable = document.getElementById('pmtable');
var pmCell = pmOuterTable.firstChild;
function pmOpen(){
if(pmCell.height < 40){
pmCell.height = Math.floor(pmCell.height) + 3;
setTimeout('pmOpen()',10);
}else{
pmCell.height = 40;
pmTable.style.display = '';
}
}
function pmClose(){
if(pmCell.height > 5){
pmCell.height = pmCell.height - 3;
setTimeout('pmClose()',10);
}else{
pmOuterTable.style.display = 'none';
}
}
function pmMenu(){
if(pmOuterTable.style.display == 'none'){
pmOuterTable.style.display = '';
pmTable.style.display = 'none';
pmOpen();
}else{
pmTable.style.display = 'none';
pmClose();
}
}
</script>
This will add an image below the welcome table. Which image it adds depends on your pm status. It'll show one image if you have new pm's, another image if you have no new pm's, or another image if you're not logged in. When you click on that image, a menu slides down above it dynamically with information about your pm's and useful links. This code is perfect for premade templates
Global Headers ~ Cross-Browser
*UPDATE: Do NOT edit anything after the two slashes //. Change the part in the quotes that says URL_OF_IMAGE. The code will not work right if you fail to do this.