Post by boccy109 on Apr 15, 2006 9:19:04 GMT -8
This code will add a new section in the Info Center for a scrolling news ticker. You can have it named however you like.
From what I can tell, this code doesn't work with any code that re-models the Info Center (Ross's Info Center 101/102, Fusion Info Center etc..)
Preview here
Cross Browser
Main Footers
<script type="text/javascript">
<!--
/*News Ticker in Info Center
Copyright to Boccy109
Free to distribute as long as this header is intact */
//Enter the current news to be displayed. HTML is allowed.
var news="Welcome to my forum!";
//Enter the name of the News Ticker (will be displayed above the news)
var name="Recent News";
//Enter the speed at which the news is to scoll at. (1 to 4 is good enough)
var speed="3";
//Enter the image to be displayed to the left of the news (leave blank for no image)
var image="http://s2.images.proboards.com/info.gif";
//DO NOT EDIT BELOW THIS LINE
if(location.href.match(/\.com(\/|.+cgi(\?|#.+|\?\w+=home)?)?$/i)){
var table=document.getElementsByTagName('table');
for(s=0;s<table.length;s++)
{
if(table.className=="bordercolor" && table[s+1].cellPadding=="4" && table[s+2].cellPadding=="3")
{
itable=table[s+1].insertRow(1).insertCell(0); itable.colSpan="2"; itable.className="catbg";
itable.innerHTML=name;
if(image!="")
{
nRow=table[s+1].insertRow(2);
imagecell=nRow.insertCell(0); imagecell.className="windowbg"; imagecell.width="20"; imagecell.height="40"; imagecell.align="center";
imagecell.innerHTML="<img src='" +image+ "' />";
newscell=nRow.insertCell(1); newscell.className="windowbg2"; newscell.align="center";
newscell.innerHTML="<marquee scrollamount='" +speed+ "' scrolldelay='1' width='100%'>" +news+ "</marquee>";
}
else
{
newscell=table[s+1].insertRow(2).insertCell(0); newscell.className="windowbg2"; newscell.align="center"; newscell.colSpan="2"; newscell.height="40";
newscell.innerHTML="<marquee scrollamount='" +speed+ "' scrolldelay='1' width='100%'>" +news+ "</marquee>";
}
}
}
}
//-->
</script>
All you need to do is edit the bits in blue, and it's all done.
Edits:
May 18th: Decreased load time by making it execute only on the main page.
Thanks to Peter for the snippet in General Programming.
May 4th: Fixed the wrongly put class for the background of the news.
April 29th: Removed the HTML tags that change the text within the code, so the user can specify it themselves, if wanted.
April 24th: Fixed the small problem with blocky scrolling.
April 20th: Made it so you can have an image displayed to the left of the news.
From what I can tell, this code doesn't work with any code that re-models the Info Center (Ross's Info Center 101/102, Fusion Info Center etc..)
Preview here
Cross Browser
Main Footers
<script type="text/javascript">
<!--
/*News Ticker in Info Center
Copyright to Boccy109
Free to distribute as long as this header is intact */
//Enter the current news to be displayed. HTML is allowed.
var news="Welcome to my forum!";
//Enter the name of the News Ticker (will be displayed above the news)
var name="Recent News";
//Enter the speed at which the news is to scoll at. (1 to 4 is good enough)
var speed="3";
//Enter the image to be displayed to the left of the news (leave blank for no image)
var image="http://s2.images.proboards.com/info.gif";
//DO NOT EDIT BELOW THIS LINE
if(location.href.match(/\.com(\/|.+cgi(\?|#.+|\?\w+=home)?)?$/i)){
var table=document.getElementsByTagName('table');
for(s=0;s<table.length;s++)
{
if(table
{
itable=table[s+1].insertRow(1).insertCell(0); itable.colSpan="2"; itable.className="catbg";
itable.innerHTML=name;
if(image!="")
{
nRow=table[s+1].insertRow(2);
imagecell=nRow.insertCell(0); imagecell.className="windowbg"; imagecell.width="20"; imagecell.height="40"; imagecell.align="center";
imagecell.innerHTML="<img src='" +image+ "' />";
newscell=nRow.insertCell(1); newscell.className="windowbg2"; newscell.align="center";
newscell.innerHTML="<marquee scrollamount='" +speed+ "' scrolldelay='1' width='100%'>" +news+ "</marquee>";
}
else
{
newscell=table[s+1].insertRow(2).insertCell(0); newscell.className="windowbg2"; newscell.align="center"; newscell.colSpan="2"; newscell.height="40";
newscell.innerHTML="<marquee scrollamount='" +speed+ "' scrolldelay='1' width='100%'>" +news+ "</marquee>";
}
}
}
}
//-->
</script>
All you need to do is edit the bits in blue, and it's all done.
Edits:
May 18th: Decreased load time by making it execute only on the main page.
Thanks to Peter for the snippet in General Programming.
May 4th: Fixed the wrongly put class for the background of the news.
April 29th: Removed the HTML tags that change the text within the code, so the user can specify it themselves, if wanted.
April 24th: Fixed the small problem with blocky scrolling.
April 20th: Made it so you can have an image displayed to the left of the news.