Post by SubDevo on Jun 23, 2010 1:34:49 GMT -8
New PM Alert Addon by SubDevo
Tested in IE, FF, Opera, Safari and Chrome.
Now compatible for users that have multiple accounts on a single forum!
This code displays a cancelable alert to your members if they have a new PM.
If canceled, the code "remembers" your decision (with a cookie) and you will not be alerted again while browsing your forum. If you get ANOTHER new PM (even if you canceled) you will get another alert. The cookie is deleted when you exit your browser window (not tab). So when you come back to your forum, you will get the alert again if you have any unread PMs. Nice...
Preview: New PM Alert
If you would also like a "New PM" link (or button) added to your menu bar, try this code instead:
Add PM Link or Button to Menu with Alert by SubDevo
Enjoy!!!
SubDevo
Location: Global Header or Footer
<script type="text/javascript">
/* New PM Alert Addon by SubDevo */
/* Global Header or Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.com or lsdp.proboards.com */
(function(){ var n=document.links,a,m=pb_username+"_PMs=",x=-1;
if(pb_username!="Guest"){
while(n[++x]){ a=n[x];
if(/n=pm$/.test(a.href)&&a.innerHTML.indexOf("message")!=-1){break;}
} n=a.nextSibling.data.split(" ")[1];
a=((new RegExp(m+"(\\d+)","i")).test(document.cookie))?n-RegExp.$1:n;
if(a>0&&confirm('You have '+n+' new message(s).\nClick "OK" to go to your inbox.')){
location.href="/index.cgi?action=pm";
} document.cookie=m+n+"; path=/";
}})();
</script>
EDIT: (8/17/2011)
Modified code to be compatible for users that have multiple accounts on a single forum.
EDIT: (8/29/2011)
Modified code to allow placement in either the Header or Footer.
If placed in the footer, the alert shows up later, allowing more of your forum to load first.
Tested in IE, FF, Opera, Safari and Chrome.
Now compatible for users that have multiple accounts on a single forum!
This code displays a cancelable alert to your members if they have a new PM.
If canceled, the code "remembers" your decision (with a cookie) and you will not be alerted again while browsing your forum. If you get ANOTHER new PM (even if you canceled) you will get another alert. The cookie is deleted when you exit your browser window (not tab). So when you come back to your forum, you will get the alert again if you have any unread PMs. Nice...
Preview: New PM Alert
If you would also like a "New PM" link (or button) added to your menu bar, try this code instead:
Add PM Link or Button to Menu with Alert by SubDevo
Enjoy!!!
SubDevo
Location: Global Header or Footer
<script type="text/javascript">
/* New PM Alert Addon by SubDevo */
/* Global Header or Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.com or lsdp.proboards.com */
(function(){ var n=document.links,a,m=pb_username+"_PMs=",x=-1;
if(pb_username!="Guest"){
while(n[++x]){ a=n[x];
if(/n=pm$/.test(a.href)&&a.innerHTML.indexOf("message")!=-1){break;}
} n=a.nextSibling.data.split(" ")[1];
a=((new RegExp(m+"(\\d+)","i")).test(document.cookie))?n-RegExp.$1:n;
if(a>0&&confirm('You have '+n+' new message(s).\nClick "OK" to go to your inbox.')){
location.href="/index.cgi?action=pm";
} document.cookie=m+n+"; path=/";
}})();
</script>
EDIT: (8/17/2011)
Modified code to be compatible for users that have multiple accounts on a single forum.
EDIT: (8/29/2011)
Modified code to allow placement in either the Header or Footer.
If placed in the footer, the alert shows up later, allowing more of your forum to load first.