Post by iAlex on Apr 6, 2008 18:19:56 GMT -5
This code will create a line of text above the navigation bar on the main page, which will provide a link to the latest post in your news board.
Edit the red text at the top of the code with the ID of the board where you want the news to be obtained from.
Preview: Click
Cross Browser.
Main Footer.
Open Source.
<script type="text/javascript">
<!--
/*Latest News above Navigation - Open Source*/
var iNewsBoard="Board ID"; //Board ID where news comes from
if(location.href.match(/action=home/) || !location.href.match(/action/) && !document.postForm && !document.modifyForm && !document.title.match(/\s-\sLogin/)){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).className=="windowbg2" && iTd.item(i).align=="left" && iTd.item(i).width=="66%" && iTd.item(i).vAlign=="top" && iTd.item(i).firstChild && iTd.item(i).firstChild.firstChild && iTd.item(i).firstChild.firstChild.nodeName.match(/^a$/i) && iTd.item(i).firstChild.firstChild.href.match('board='+iNewsBoard+'$')){
var iParent=iTd.item(i).parentNode.parentNode.parentNode.parentNode;
var iGrandParent=iParent.parentNode.parentNode.parentNode.parentNode;
var iSpanNews=document.createElement('span');
iSpanNews.innerHTML='<font size="1"><b>'+((document.title.match(/^(.+?)\s-\sHome/))? ((document.title.match(/^(.+?)s\s-\sHome/))? RegExp.$1+'s\'' : RegExp.$1+'\'s') : '')+' latest news: '+((iTd.item(i+3).firstChild.innerHTML.match(/<br\s?\/?>in (.+?)$/i))? RegExp.$1 : 'None')+'</b></font>';
iGrandParent.insertBefore(iSpanNews, iGrandParent.firstChild);
break;
}
}
}
//-->
</script>
Edit the red text at the top of the code with the ID of the board where you want the news to be obtained from.
Preview: Click
Cross Browser.
Main Footer.
Open Source.
<script type="text/javascript">
<!--
/*Latest News above Navigation - Open Source*/
var iNewsBoard="Board ID"; //Board ID where news comes from
if(location.href.match(/action=home/) || !location.href.match(/action/) && !document.postForm && !document.modifyForm && !document.title.match(/\s-\sLogin/)){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).className=="windowbg2" && iTd.item(i).align=="left" && iTd.item(i).width=="66%" && iTd.item(i).vAlign=="top" && iTd.item(i).firstChild && iTd.item(i).firstChild.firstChild && iTd.item(i).firstChild.firstChild.nodeName.match(/^a$/i) && iTd.item(i).firstChild.firstChild.href.match('board='+iNewsBoard+'$')){
var iParent=iTd.item(i).parentNode.parentNode.parentNode.parentNode;
var iGrandParent=iParent.parentNode.parentNode.parentNode.parentNode;
var iSpanNews=document.createElement('span');
iSpanNews.innerHTML='<font size="1"><b>'+((document.title.match(/^(.+?)\s-\sHome/))? ((document.title.match(/^(.+?)s\s-\sHome/))? RegExp.$1+'s\'' : RegExp.$1+'\'s') : '')+' latest news: '+((iTd.item(i+3).firstChild.innerHTML.match(/<br\s?\/?>in (.+?)$/i))? RegExp.$1 : 'None')+'</b></font>';
iGrandParent.insertBefore(iSpanNews, iGrandParent.firstChild);
break;
}
}
}
//-->
</script>