|
Post by Wormopolis on Dec 19, 2008 14:44:18 GMT -8
Browser tested: IE and FF location: global footer NOTE: if you have side tables or "border around forum" codes, portkey should go BELOW them in order to work. Also make sure to escape any quotes you have in your rules or it causes a runtime error. creates a customizable splash page that has a "accept" and "decline" button at the bottom. Useful for displaying rules of your site. Also has build in "absent" and "unbanned" variables in case you want someone to re-read your rules. NEW: admin will now see a link at the bottom of the board to test the portkey display <script type="text/javascript"> <!-- /* PortKey v1.21 By Wormopolis Keep Header intact, Do not repost without permission */
//EDIT THESE var portKeyActive = true; //true if you want it on, false if you dont
var exemptUsers=/(user1|user2|user3)/;
var absenceMessage="You been away a long time, here are the basic rules of the site in case you forgot:" var absenceTime = 30; //number of days someone can be absent before they see portal again var absenceMonitor = "yes" // yes if you want portal reshown to members who havent been on in a while // no if you dont.
var bannedMessage="You were recently banned. Perhaps you should look over the site rules again:" var bannedMonitor = "yes" // yes if you want someone who was recently unbanned to see portal again // no if you dont
var portalMessage="<font size='4'>Welcome to WormoCodes!</font><br><br><br>"; portalMessage+="<table align='center'><tr><td>Site rules:<br><br>"; //just keep adding to portalMessage portalMessage+="1. keep spam to a minimum.<br>"; portalMessage+="2. no porn.<br>"; portalMessage+="3. no talk about using/selling illegal substances.<br>"; portalMessage+="4. no advertising of sites relating to rules 2 and 3.<br>"; portalMessage+="5. no one likes a racist.<br>"; portalMessage+="6. All codes are done by volunteer basis, and for free. You get what you pay for.<br></td></tr></table>"; portalMessage+="<br><p align='right'>If you are ok with these rules, click \"I accept\" below.<br>If you think these are ridiculous and constrictive and totally fascist, please click \"I decline\"<br>"; portalMessage+="I hope to see you on my board!</p><br>";
var declineURL="http://www.smart-central.com/worms.htm"; //URL of where to send them if they decline
var defaultBG = "000000"; var defaultTxt= "FFFFFF"; var portKeyWidth="800";
//NO FURTHER EDITS SHOULD BE NECESSARY
function declineFnc() { window.location=declineURL; }
function acceptFnc() { todDate=new Date(); todDate2=todDate.getFullYear()+"-"+todDate.getMonth()+"-"+todDate.getDate(); todDate.setYear(todDate.getFullYear()+1); document.cookie="portkey="+escape(todDate2)+"; expires="+todDate; window.location="\index.cgi?"; }
function makePortKey() { tbs=document.getElementsByTagName('table'); for (a=0;a<tbs.length; a++) { tbs[a].style.display="none"; } divs=document.getElementsByTagName('div'); for (a=0;a<divs.length; a++) { divs[a].style.display="none"; }
pkmessage="<table align='center' height='400' width='"+portKeyWidth+"' cellpadding='5' class='bordercolor' cellspacing='5'><tr><td>"; pkmessage+="<table align='center' width='100%' height='100%' style='background-color:"+defaultBG+"' cellpadding='0' class='windowbg'><tr><td>"; if (banMsg) pkmessage+=bannedMessage; if (expMsg) pkmessage+=absenceMessage;
pkmessage+="</td></tr><tr><td><font color="+defaultTxt+">"; pkmessage+=portalMessage; pkmessage+="</font></td></tr>";
pkmessage+="<tr><td height='10%'><table width='100%' valign='bottom'><tr>"; pkmessage+="<td align='center' width='50%'><input id='acc' type='button'onclick='acceptFnc()'>I ACCEPT</input></td>"; pkmessage+="<td align='center' width='50%'><input id='dec' type='button' onclick='declineFnc()'>I DECLINE</input></td>"; pkmessage+="</tr></table></td></tr>"; pkmessage+="</table>"; pkmessage+="</td></tr></table>";
document.getElementById('pk').innerHTML=pkmessage; document.getElementById('pk').style.display=''; }
tds=document.getElementsByTagName('td'); for (w=tds.length-1; w>0; w--) { if (tds[w].width=="100%" && tds[w].className=="windowbg" && !tds[w].getElementsByTagName('form').length) { fnts=tds[w].getElementsByTagName('font'); if (fnts[0] && fnts[0].size=="2" && fnts[0].innerHTML.match(/Sorry, but you have been banned from this forum./i)) { todDate=new Date(); todDate.setYear(todDate.getFullYear()+10); document.cookie="portkey="+escape("banned")+"; expires="+todDate; portKeyActive=false; } } } document.write("<div id='pk' width='100%' style='display:none'></div>"); if (pb_username!="Guest" && portKeyActive && !location.href.match(/headersfooters/i)) { var showPortKey=true; var banMsg=false; var expMsg=false; var noobMsg=false; if (document.cookie.match(/portkey=([^;]*)/)) { res=RegExp.$1; if (res!="banned") { res=unescape(res); res=res.split('-'); lastDate=new Date(res[0],res[1],res[2]); todDate=new Date(); diff=todDate.getTime()-lastDate.getTime(); diff/=(1000*60*60*24); if (diff>absenceTime) expMsg=true; } else { banMsg=true; } } else { noobMsg=true; } if ((absenceMonitor=="yes" && expMsg)||(bannedMonitor=="yes" && banMsg)||noobMsg) {
if (!pb_username.match(exemptUsers)) makePortKey();
} } if (pb_username=='admin') { adLink=document.createElement('a'); adLink.align='center'; adLink.href='javascript:void(0);'; adLink.onclick= function() {makePortKey()}; adLink.style.backgroundColor='000000'; adLink.style.color='FFFFFF'; adLink.innerHTML='PORTKEY TEST'; document.write('<div width="100%" id="linkspace" align="center"></div>'); document.getElementById('linkspace').appendChild(adLink); } // --> </script>
Preview:
|
|
silent
Not New Member
Posts: 5
silent said 0 great things
|
Post by silent on Dec 26, 2008 22:01:31 GMT -8
Worm,i love this code ty for making it,and also can we edit some parts? such change where it says "WELCOME TO SERIAL KILLERS"to something else?
|
|
|
Post by Wormopolis on Dec 27, 2008 2:49:02 GMT -8
Yep. You can edit all the PortalMessage variables. You can even add in Images with HTML. just keep editing/adding in more lines like:
portalMessage+="1. keep spam to a minimum.<br>";
|
|
Mr. Moon
Code Helper
Posts: 16
Mr. Moon said 0 great things
|
Post by Mr. Moon on Dec 27, 2008 6:01:15 GMT -8
Nobody likes me, everybody hates me, I think I'll go eat some worms.
|
|
bunny
Not New Member
Posts: 4
bunny said 0 great things
|
Post by bunny on Jan 26, 2009 4:30:36 GMT -8
click no on my site and you get rick rolled <.<
|
|
|
Post by Wormopolis on Jan 26, 2009 19:42:57 GMT -8
Hilarious!
remember the the message it displays is totally customizable. You can add in HTML to your hearts delight.
|
|
|
Post by Wormopolis on Mar 17, 2009 11:13:45 GMT -8
updated to include default background color of black and text color of white. Variables can be changed at top of code to fit your site.
|
|
|
Post by Wormopolis on Apr 9, 2009 4:39:00 GMT -8
Im going to add something to this later when I get home. Im going to add a button at the bottom of the page shown only to the main admin that will load the portkey so you can see what it looks like whenever you want.
I guess I should have had that all along, but I was just setting the absence monitor to 0 in order to see it.
I will post again after the code had been updated.
|
|
hcfwesker
Not New Member
Posts: 37
hcfwesker said 0 great things
|
Post by hcfwesker on Jun 19, 2009 4:51:20 GMT -8
Wait a minute! So, this is kinda like a "portal" page? Like, if i added this code to a specific board; this would show up first, then they would click to proceed to the actual board & topic listings?
I use Opera, so if i add it, it can get a test run there, from me.
|
|
|
Post by Wormopolis on Jun 19, 2009 7:23:41 GMT -8
Typically this is used for entire boards.. kinda like an "agree to my rules or get out" kind of thing. But I guess Yah it could be used in a single board's footer. You wouldnt be able to use multiple versions of it however since it writes to the cookie file.
Try it out and let me know how it goes...
|
|
hcfwesker
Not New Member
Posts: 37
hcfwesker said 0 great things
|
Post by hcfwesker on Jun 20, 2009 1:37:43 GMT -8
Yeah, it does work for a single board. Kinda what i needed, too. I gotta edit some things, of course .. and, LMAO at the page that comes up when you Decline ;D That was pretty funny.
|
|
|
Post by Wormopolis on Jun 21, 2009 10:59:28 GMT -8
you can customize that. That was just the default URL...
change the variable declineURL
|
|
|
Post by Wormopolis on Nov 27, 2009 2:41:09 GMT -8
version upgrade:
added a link at the bottom of the board to test portkey display. I also changed it from a document.write message to a DIV innerHTML to help prevent board lockups from people who dont close their tables correctly
|
|
pluqui
Not New Member
Posts: 10
pluqui said 0 great things
|
Post by pluqui on Dec 2, 2009 2:50:28 GMT -8
Does this screen appear every time a member logs in or is it only for new members registering and guests?
|
|
|
Post by Wormopolis on Dec 2, 2009 3:41:36 GMT -8
does not show for guests. will show for members who havent seen it yet, mebers who were recently banned (if variable is yes), and members who havent logged in for a certain number of days (variables at top of code).
if a member keeps seeing it everytime they log in, then they are clearing their cookies. if you want to make it where it doesnt show for a certain user, I just need to add something in.
|
|