Peter
Junior Member
Coding God
Posts: 50
|
Post by Peter on Apr 29, 2006 13:18:16 GMT
Simple code. Will show a button in the menu which will change depending on if you have new privates messages. Just follow the instructions in the top of the script.
Add this to your global header.
<script type="text/javascript"> <!--
// New/No new PM button in menu
// Image to show there are new private messages var newPM = "URL HERE";
// Image to show there are no new private messages var noPM = "URL HERE";
var pmLink = document.createElement("a"); var pmImg = document.createElement("img"); var pmCell = document.getElementsByTagName("td").item(2).innerHTML;
pmLink.href = "index.cgi?action=pm"; pmImg.border = "0";
if(pmCell.match(/you have <.+?>, (\d+) /i)){ switch(RegExp.$1){ case "0" : pmImg.src = noPM; pmImg.title = "You have no new private messages."; break; case "1" : pmImg.src = newPM; pmImg.title = "You have 1 new private message."; break; default : pmImg.src = newPM; pmImg.title = "You have " + RegExp.$1 + " new private messages."; } pmLink.appendChild(pmImg); document.getElementsByTagName("td").item(5).appendChild(pmLink); }
//--> </script>
|
|