Post by iAlex on Dec 8, 2007 19:57:31 GMT -5
This is just my take on a code, which will allow members to individually select a banner from their profile, which will be displayed while they browse the forum.
Place this in your Global Header.
Cross Browser.
Open Source.
<script type="text/javascript">
<!--
/*Logo Selectable in Profile - By iAlex - Global Header - Open Source*/
var iVengaBoys=[
["Banner Name", "Banner URL"],
["Banner Name 2", "Banner URL 2"],
["Banner Name 3", "Banner URL 3"] //No comma on last line
];
for(x=0;x<iVengaBoys.length;x++){
if(document.cookie.match('iMrSquiggle='+iVengaBoys[x][0])){
document.getElementsByTagName('img').item(0).src=iVengaBoys[x][1];
}
}
//-->
</script>
And place this section in your Main Footer (No editing required).
<script type="text/javascript">
<!--
/*Logo Selectable in Profile - By iAlex - Main Footer - Open Source*/
if(location.href.match('action=modifyprofile&user='+pb_username+'$') && document.modifyForm||document.modifyForm && location.href.match(/index.cgi$/)){
var iVengaBus=document.getElementsByTagName('table');
for(i=0;i<iVengaBus.length;i++){
if(iVengaBus.item(i).width=="650" && iVengaBus.item(i).cellSpacing=="2" && iVengaBus.item(i).rows[0].cells[0].firstChild.innerHTML.match(/^Show Age:$/)){
var iBoomBoom=iVengaBus.item(i).insertRow(7);
var iWantYou=document.createElement('td');
var iInMyRoom=document.createElement('td');
var iLetsSpend=document.createElement('td');
var iTheNight=document.createElement('select');
iTheNight.id='iRedIsMyFavPowerRangerBTW';
iWantYou.width='160';
iWantYou.vAlign='top';
iWantYou.innerHTML='<font size="-1">Select Logo:</font><b'+'r/><b'+'r/>';
iInMyRoom.width='245';
iInMyRoom.vAlign='top';
iLetsSpend.width='245';
iLetsSpend.vAlign='top';
iLetsSpend.innerHTML='<font size="-2">Select which logo you would like to have displayed while browsing this forum.</font>';
iInMyRoom.appendChild(iTheNight);
iBoomBoom.appendChild(iWantYou);
iBoomBoom.appendChild(iInMyRoom);
iBoomBoom.appendChild(iLetsSpend);
for(a=0;a<iVengaBoys.length;a++){
iTheNight.options[iTheNight.length]=new Option(iVengaBoys[0],iVengaBoys[1]);
}
iInMyRoom.innerHTML+=' - <a href="javascript: iGoGoPowerRangers()">Preview</a>';
function iGoGoPowerRangers(){
window.open(document.getElementById('iRedIsMyFavPowerRangerBTW').value);
}
if(document.cookie.match(/iMrSquiggle=(\w+)/)){
iQucik=RegExp.$1
var iDumm=document.getElementById('iRedIsMyFavPowerRangerBTW');
for(a=0;a<iDumm.options.length;a++){
if(iDumm.options.innerHTML==iQucik){
iDumm.options.selected=true;
}
}
}
}
}
var iPowerRanger=document.getElementsByTagName('input');
for(i=0;i<iPowerRanger.length;i++){
if(iPowerRanger.item(i).value.match(/^Modify Profile$/) && iPowerRanger.item(i).name.match(/profileaction/)){
iPowerRanger.item(i).onclick=function(){
var iCaptainPlanet=document.getElementById('iRedIsMyFavPowerRangerBTW');
document.cookie = 'iMrSquiggle='+iCaptainPlanet.options[iCaptainPlanet.selectedIndex].innerHTML+';expires=Sat, 20 Jan 2050 12:12:12 UTC; path=/;';
}
}
}
}
//-->
</script>
If you wish to have more random banners, then you can add more of this line:
["Banner Name", "Banner URL"],
Just make sure that the comma on the end is not there for the last line.
Place this in your Global Header.
Cross Browser.
Open Source.
<script type="text/javascript">
<!--
/*Logo Selectable in Profile - By iAlex - Global Header - Open Source*/
var iVengaBoys=[
["Banner Name", "Banner URL"],
["Banner Name 2", "Banner URL 2"],
["Banner Name 3", "Banner URL 3"] //No comma on last line
];
for(x=0;x<iVengaBoys.length;x++){
if(document.cookie.match('iMrSquiggle='+iVengaBoys[x][0])){
document.getElementsByTagName('img').item(0).src=iVengaBoys[x][1];
}
}
//-->
</script>
And place this section in your Main Footer (No editing required).
<script type="text/javascript">
<!--
/*Logo Selectable in Profile - By iAlex - Main Footer - Open Source*/
if(location.href.match('action=modifyprofile&user='+pb_username+'$') && document.modifyForm||document.modifyForm && location.href.match(/index.cgi$/)){
var iVengaBus=document.getElementsByTagName('table');
for(i=0;i<iVengaBus.length;i++){
if(iVengaBus.item(i).width=="650" && iVengaBus.item(i).cellSpacing=="2" && iVengaBus.item(i).rows[0].cells[0].firstChild.innerHTML.match(/^Show Age:$/)){
var iBoomBoom=iVengaBus.item(i).insertRow(7);
var iWantYou=document.createElement('td');
var iInMyRoom=document.createElement('td');
var iLetsSpend=document.createElement('td');
var iTheNight=document.createElement('select');
iTheNight.id='iRedIsMyFavPowerRangerBTW';
iWantYou.width='160';
iWantYou.vAlign='top';
iWantYou.innerHTML='<font size="-1">Select Logo:</font><b'+'r/><b'+'r/>';
iInMyRoom.width='245';
iInMyRoom.vAlign='top';
iLetsSpend.width='245';
iLetsSpend.vAlign='top';
iLetsSpend.innerHTML='<font size="-2">Select which logo you would like to have displayed while browsing this forum.</font>';
iInMyRoom.appendChild(iTheNight);
iBoomBoom.appendChild(iWantYou);
iBoomBoom.appendChild(iInMyRoom);
iBoomBoom.appendChild(iLetsSpend);
for(a=0;a<iVengaBoys.length;a++){
iTheNight.options[iTheNight.length]=new Option(iVengaBoys[0],iVengaBoys[1]);
}
iInMyRoom.innerHTML+=' - <a href="javascript: iGoGoPowerRangers()">Preview</a>';
function iGoGoPowerRangers(){
window.open(document.getElementById('iRedIsMyFavPowerRangerBTW').value);
}
if(document.cookie.match(/iMrSquiggle=(\w+)/)){
iQucik=RegExp.$1
var iDumm=document.getElementById('iRedIsMyFavPowerRangerBTW');
for(a=0;a<iDumm.options.length;a++){
if(iDumm.options.innerHTML==iQucik){
iDumm.options.selected=true;
}
}
}
}
}
var iPowerRanger=document.getElementsByTagName('input');
for(i=0;i<iPowerRanger.length;i++){
if(iPowerRanger.item(i).value.match(/^Modify Profile$/) && iPowerRanger.item(i).name.match(/profileaction/)){
iPowerRanger.item(i).onclick=function(){
var iCaptainPlanet=document.getElementById('iRedIsMyFavPowerRangerBTW');
document.cookie = 'iMrSquiggle='+iCaptainPlanet.options[iCaptainPlanet.selectedIndex].innerHTML+';expires=Sat, 20 Jan 2050 12:12:12 UTC; path=/;';
}
}
}
}
//-->
</script>
If you wish to have more random banners, then you can add more of this line:
["Banner Name", "Banner URL"],
Just make sure that the comma on the end is not there for the last line.