|
Post by Wormopolis on Nov 4, 2009 4:59:32 GMT -8
Browser Tested: IE and FF placement: Global Header
puts an alert bar at the top of your forum that floats above the content. Message can be customized, but basically tells Guests they should register. Icon can be customized as well.
code:
<style type="text/css"> #alrtDiv {top: expression( ( ignoreMe = document.body.scrollTop ) + 'px' );} </style> <script type="text/javascript"> <!-- // register alert - floating // by Wormopolis - www.wormocodes.com // keep header intact
var alerticon="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/alert.gif";
alrtDiv=document.createElement('div'); alrtDiv.id="alrtDiv"; alrtDiv.style.width="100%"; alrtDiv.style.backgroundColor="FFFFAA"; alrtDiv.style.color="000000"; alrtDiv.style.cursor="pointer"; alrtDiv.style.position=(document.all ? 'absolute' : 'fixed'); alrtDiv.style.zIndex="50"; alrtDiv.onclick=function (){location.href="/index.cgi?action=register";}; alrtDiv.innerHTML='<center><image src="'+alerticon+'" border="0" height="15" width="15"> It appears that you have not registered! Click Here to Register.</center>'; if (pb_username=='Guest' && !location.href.match(/action=(register|login)/)) document.body.insertBefore(alrtDiv,document.body.firstChild);
// --> </script>
Preview: if you are a guest on this site you should see it at the top
|
|
Richie
Not New Member
^ Yes, That's My Fugly Face!
Posts: 35
Richie said 2 great things
|
Post by Richie on Nov 9, 2009 12:29:10 GMT -8
Hi, iybv4.proboards.comfor some reason it doesn't want to center (in IE at least), any idea why? btw, this is just my test board, but i copied all my real forum's coding over so maybe you can figure out why it's doing that?
|
|
|
Post by Wormopolis on Nov 9, 2009 17:39:23 GMT -8
that IS weird. put into the CSS:
left: 0
|
|
Richie
Not New Member
^ Yes, That's My Fugly Face!
Posts: 35
Richie said 2 great things
|
Post by Richie on Nov 11, 2009 14:45:56 GMT -8
that IS weird. put into the CSS: left: 0 Thanks, Wormopolis! ;D
|
|
¢ØRTÄñÄ
Not New Member
Keep your head down, there's two of us in here now!
Posts: 10
¢ØRTÄñÄ said 0 great things
|
Post by ¢ØRTÄñÄ on Jan 9, 2010 0:38:25 GMT -8
hi,i have put this code on my site www.halo-cortana.proboards.com but nothing happens, there is no little bar at the top of the page. what am i doing wrong?
|
|
|
Post by Wormopolis on Jan 9, 2010 4:36:01 GMT -8
you have to escape single quotes:
alrtDiv.innerHTML='<center><image src="'+alerticon+'" border="0" height="15" width="15"> It appears that you have not registered! Click Here to Register, It\'s Free!</center>';
|
|
¢ØRTÄñÄ
Not New Member
Keep your head down, there's two of us in here now!
Posts: 10
¢ØRTÄñÄ said 0 great things
|
Post by ¢ØRTÄñÄ on Jan 9, 2010 19:56:58 GMT -8
it works, thank you
|
|
Reese
Junior Member
I've said one great thing!
Posts: 53
Reese said 0 great things
|
Post by Reese on May 23, 2010 15:43:19 GMT -8
Can you modify it so I could make it display messages to different users? Like so I could post a message they would see only and for sure see it?
|
|
|
Post by Wormopolis on May 23, 2010 20:50:40 GMT -8
<script type="text/javascript"> <!-- // register alert - floating // mod for user alerts // by Wormopolis - www.wormocodes.com// keep header intact var alerticon="http://i197.photobucket.com/albums/aa250/WORMOPOLIS/alert.gif"; var memberNotes=new Array(); memberNotes['Guest']='<center><image src="'+alerticon+'" border="0" height="15" width="15"> It appears that you have not registered! Click Here to Register.</center>'; memberNotes['admin']='<center>Testing this new function</center>'; memberNotes['username1']='<center>You have a library book due</center>'; memberNotes['username2']='<center>Get your template done or I will choke you.</center>'; //follow this pattern alrtDiv=document.createElement('div'); alrtDiv.id="alrtDiv"; alrtDiv.style.width="100%"; alrtDiv.style.backgroundColor="FFFFAA"; alrtDiv.style.color="000000"; alrtDiv.style.cursor="pointer"; alrtDiv.style.position=(document.all ? 'absolute' : 'fixed'); alrtDiv.style.zIndex="50"; alrtDiv.onclick=function (){location.href="/index.cgi?action=register";}; if (memberNotes[pb_username]) { alrtDiv.innerHTML=memberNotes[pb_username]; if (!location.href.match(/action=(register|login)/)) document.body.insertBefore(alrtDiv,document.body.firstChild); } // --> </script>
|
|
|
Post by Dragon on Apr 10, 2011 17:04:20 GMT -8
You have it set to post a single message to singular chosen users above as well as the regular message for everyone else. Is there anyway to make it per user group? 1 for guests 1 for members 1 for staff ?
|
|
|
Post by Wormopolis on Apr 10, 2011 17:35:12 GMT -8
user group isnt a posted variable, it has to be scanned from the page, and IF it doesnt appear on the page there wouldnt be a way to get it. the alert code is a global header code so it wouldnt be able to scan the page content in the first place. there is a mod above your post that will let you set a specific message for specific users, however, so you might get away with that.
though are you sure you want to annoy registered members with the alert? the point of it was to annoy guests into registering.
|
|
Lynne
Not New Member
Inaction is an Action.
Posts: 2
Lynne said 0 great things
|
Post by Lynne on Aug 26, 2012 15:00:57 GMT -8
Thank you so much for this code! I actually have members who think that if they post in the shout box that they have registered. This should save a lot of headaches! What a great idea!
|
|
|
Post by Wormopolis on Aug 27, 2012 16:01:58 GMT -8
Im glad you like it!
|
|