Post by Todge on Jun 13, 2009 8:50:40 GMT -8
This code will rotate the skins of your forum on a daily basis. See the directions at the end for all the info you need to use it.
The code comes in 2 parts... Put this in the TOP of your GLOBAL HEADER...
and put this at the top of your Global or Main Footer...
No editing is required to the codes themselves, there should be an option appear in the profile page where the user can select whether to have the skins rotate or not.
When you create a skin, and you wish to include it in the skin rotation, make sure you have the skin selected, and in the Admin Panel, go to 'Skins / Forum Colors' and you should see an extra link saying 'Skin Information', click it and follow the instructions...
The code comes in 2 parts... Put this in the TOP of your GLOBAL HEADER...
<a name="skin" id="skin0" style="display: none;"></a>
<script type="text/javascript">
<!--
/*
Rotating Skins (TOP of Global Header)
by Todge
Copyright © 2009
Please keep this header intact
*/
function setSkinIDCookie(skinId,skin)
{
var expireDate = new Date();
expireDate.setMonth(expireDate.getMonth()+6);
document.cookie = skinId+'='+skin+'; expires='+expireDate.toGMTString()+'; path=/';
return;
}
if(!document.cookie.match(/skinrotation=yes/))
{
setSkinIDCookie('skinrotation','no');
}
else
{
setSkinIDCookie('skinrotation','yes');
var theSkin = document.getElementsByName('skin');
var today = new Date().getDate();
if(document.cookie.length >1 && !document.cookie.match('skinId'))
{
setSkinIDCookie('skinId',today+'|'+0);
}
else if(!document.referrer.match(document.location.href.split(/\.com/)[0]))
{
var skinID = parseInt(document.cookie.split('skinId=')[1].split('|')[1]) +1;
if(skinID > theSkin.length-1)
{
skinID = 0;
}
setSkinIDCookie('skinId',today+'|'+skinID);
}
var skin = parseInt(document.cookie.split('skinId=')[1].split('|')[1]);
document.write('<style>'+theSkin[skin].innerHTML+'</style>');
pb_skinid = theSkin[skin].id.split('skin')[1];
}
// -->
</script>
and put this at the top of your Global or Main Footer...
<script type="text/javascript">
<!--
/*
Get Skin Info for Rotating Skins (Top of Global or Main Footer)
by Todge
Copyright © 2009
Please keep this header intact
*/
if(location.href.match(/tion=skins$/))
{
var skinLinks = document.links;
for(s=0; s<skinLinks.length; s++)
{
if(skinLinks[s].href.match(/tion=skinscreate/))
{
skinLinks[s].parentNode.innerHTML += ' - <a href="/index.cgi?action=skininfo" id="skinInfo">Skin Information</a>';
break;
}}}
if(location.href.match(/tion=skininfo/))
{
document.title = 'Message Board - Skin Information';
document.getElementsByTagName('font')[1].innerHTML = '« Skin Information »';
var click = document.links;
for(c=0; c<click.length; c++)
{
if(click[c].className == 'nav' && click[c].nextSibling.nodeName == '#text')
{
click[c].nextSibling.nodeValue = ' :: Skin Information';
break;
}}
var Title = document.getElementsByTagName('font');
for(t=0; t<Title.length; t++)
{
if(Title[t].innerHTML.match(/An Error Has Occurred/))
{
Title[t].innerHTML = '<b>Please copy and paste this into the top of your Global Header..</b>';
Title[t+1].innerHTML = '&l'+'t;a name="skin" id="skin'+pb_skinid+'" style="display: none;"&g'+'t;<br>';
Title[t+1].innerHTML += document.getElementsByTagName('style')[0].innerHTML.split('<!--')[1].split('-->')[0];
Title[t+1].innerHTML += '<br>&l'+'t;/a&g'+'t';
break;
}}}
if(document.modifyForm)
{
function setSkin()
{
setSkinIDCookie('skinrotation',document.modifyForm.skin.children[document.modifyForm.skin.selectedIndex].value);
return;
}
var skins = document.modifyForm.skin;
var newOption = document.createElement('option');
with(newOption){ value='yes'; innerHTML='Rotate';}
skins.appendChild(newOption);
if(document.cookie.match('skinrotation=yes'))
{
skins.selectedIndex = document.modifyForm.skin.children.length-1;
}
document.modifyForm.skin.onSubmit = function(){testing()};
if(window.addEventListener)
{
document.modifyForm.skin.addEventListener('change', setSkin, false);
}
else{
document.modifyForm.skin.attachEvent('onchange', setSkin);
}}
// -->
</script>
No editing is required to the codes themselves, there should be an option appear in the profile page where the user can select whether to have the skins rotate or not.
When you create a skin, and you wish to include it in the skin rotation, make sure you have the skin selected, and in the Admin Panel, go to 'Skins / Forum Colors' and you should see an extra link saying 'Skin Information', click it and follow the instructions...