Post by *Dan! on Apr 27, 2006 17:54:49 GMT -8
Name: Simple Pm Script v2
Placement: Global Headers
Cross-browser: Yes
Description: This script allows you you to choose between two different pm bars. You can type in "menu" and you get a pm bar in your menu, or "bar" and you get a pm bar that hangs of the menu.
Preview: Menu Pm Box | Bar pm Box
<script type="text/javascript">
//Simple Pm Script v2 - Menu and Separate Bar Style
//(c) *Dan! (aka: Stardnl) G101 Designs and stardnl.com
//\\//\\//\\//\\//\\Edit Below//\\//\\//\\//\\//\\
var pmbartype ='menu'; //Choices are: menu or bar
var classtype = 'windowbg'; // Only change this if you plan on using the bar feture
//\\//\\//\\//\\//\\Do notEdit Below//\\//\\//\\//\\//\\
var td = document.getElementsByTagName("td");
var td2 = document.getElementsByTagName("td")[2];
if(pmbartype == 'menu'){
var username = (td2.innerHTML.match(/Hey, (.+?),/i)) ? RegExp.$1:invalid
var pmnumber = (td2.innerHTML.match(/(\d+) (are|is) new/i)) ? RegExp.$1:invalid
var menu = td[5].innerHTML;
td[5].innerHTML = "<table cellspacing='0' cellspacing='0' border='0' width='100%'><td align='left'>Welcome, " + username + "! <a href='?action=pm'><b>" + pmnumber + "</b></a> new messages</td><td align='right'>" + menu + "</td></tr></table>";
}
if(pmbartype == 'bar'){
var date = new Date( );
var year = date.getFullYear( )
var day = date.getDate( );
var month = date.getMonth( ) + 1;
username = (td2.innerHTML.match(/Hey, (.+?),/i)) ? RegExp.$1:invalid
pmnumber = (td2.innerHTML.match(/(\d+) (are|is) new/i)) ? RegExp.$1:invalid
var menu = td[5];
var menuRow = menu.parentNode;
var wholeTable = menuRow.parentNode;
var newRow = document.createElement("tr");
var newCell = document.createElement("td");
newCell.innerHTML = " <table width=100%><tr><td width=33%>Welcome " + username +"! </td><td width=33% align=center>You have <a href='?action=pm'><b>" + pmnumber + "</b></a> new messages.</td><td align=right width=33%>" + month + "/" + day + "/" + year + "</td></tr></table> ";
newCell.className = " " + classtype + " ";
newCell.style.borderTop = "1px solid " + document.getElementsByTagName("table")[0].bgColor;
newRow.appendChild(newCell);
wholeTable.insertBefore(newRow, menuRow.nextSibling);
}
</script>
Please Read All of Below
Ok, this code is very easy to edit. If you want you pm bar in you menu simply do this:
You can also edit the class you want behind the bar pm box. Simply change it to what you want like so:
Also, the menu pm bar aligns you pm bar right. I will make some updates soon so you can choose you menu alignment for both bar and menu. Also both pm boxs will not show up for guests, i will also make a updated version of this that will show a message to guests saying they must be logged in to view.
If you have any suggestions or ideas for me, please let me know
~dan
Placement: Global Headers
Cross-browser: Yes
Description: This script allows you you to choose between two different pm bars. You can type in "menu" and you get a pm bar in your menu, or "bar" and you get a pm bar that hangs of the menu.
Preview: Menu Pm Box | Bar pm Box
<script type="text/javascript">
//Simple Pm Script v2 - Menu and Separate Bar Style
//(c) *Dan! (aka: Stardnl) G101 Designs and stardnl.com
//\\//\\//\\//\\//\\Edit Below//\\//\\//\\//\\//\\
var pmbartype ='menu'; //Choices are: menu or bar
var classtype = 'windowbg'; // Only change this if you plan on using the bar feture
//\\//\\//\\//\\//\\Do notEdit Below//\\//\\//\\//\\//\\
var td = document.getElementsByTagName("td");
var td2 = document.getElementsByTagName("td")[2];
if(pmbartype == 'menu'){
var username = (td2.innerHTML.match(/Hey, (.+?),/i)) ? RegExp.$1:invalid
var pmnumber = (td2.innerHTML.match(/(\d+) (are|is) new/i)) ? RegExp.$1:invalid
var menu = td[5].innerHTML;
td[5].innerHTML = "<table cellspacing='0' cellspacing='0' border='0' width='100%'><td align='left'>Welcome, " + username + "! <a href='?action=pm'><b>" + pmnumber + "</b></a> new messages</td><td align='right'>" + menu + "</td></tr></table>";
}
if(pmbartype == 'bar'){
var date = new Date( );
var year = date.getFullYear( )
var day = date.getDate( );
var month = date.getMonth( ) + 1;
username = (td2.innerHTML.match(/Hey, (.+?),/i)) ? RegExp.$1:invalid
pmnumber = (td2.innerHTML.match(/(\d+) (are|is) new/i)) ? RegExp.$1:invalid
var menu = td[5];
var menuRow = menu.parentNode;
var wholeTable = menuRow.parentNode;
var newRow = document.createElement("tr");
var newCell = document.createElement("td");
newCell.innerHTML = " <table width=100%><tr><td width=33%>Welcome " + username +"! </td><td width=33% align=center>You have <a href='?action=pm'><b>" + pmnumber + "</b></a> new messages.</td><td align=right width=33%>" + month + "/" + day + "/" + year + "</td></tr></table> ";
newCell.className = " " + classtype + " ";
newCell.style.borderTop = "1px solid " + document.getElementsByTagName("table")[0].bgColor;
newRow.appendChild(newCell);
wholeTable.insertBefore(newRow, menuRow.nextSibling);
}
</script>
Please Read All of Below
Ok, this code is very easy to edit. If you want you pm bar in you menu simply do this:
var pmbartype ='menu'; //Choices are: menu or bar
And if you want a bar pm bar do this: var pmbartype ='bar'; //Choices are: menu or bar
Just edit the var to what you want. You can also edit the class you want behind the bar pm box. Simply change it to what you want like so:
var classtype = 'menubg'; // Only change this if you plan on using the bar feture
Also, the menu pm bar aligns you pm bar right. I will make some updates soon so you can choose you menu alignment for both bar and menu. Also both pm boxs will not show up for guests, i will also make a updated version of this that will show a message to guests saying they must be logged in to view.
If you have any suggestions or ideas for me, please let me know
~dan