Post by Peter on Apr 29, 2006 13:18:40 GMT
This code will link certain keywords to a url. So for example, if I was to include the keyword "google" in my post, it will link the text to google.com.
<script type="text/javascript">
<!--
/*
link keywords in posts to site - Created by Peter
This code cannot be reposted anywhere other than SSDesigns or ProBoards Support.
This header must stay intact.
*/
var keyWords = [
["google", "http://www.google.com"],
["yahoo", "http://www.yahoo.com"],
["proboards", "http://www.proboards.com"],
["ssdesigns", "http://ssdesigns.proboards17.com"],
["ssd", "http://ssdesigns.proboards17.com"],
["altavista", "http://www.altavista.com"],
["firefox", "http://www.firefox.com/"],
["mozilla", "http://www.mozilla.org/"],
["microsoft", "http://www.microsoft.com/"],
["download", "http://www.download.com/"],
["photoshop", "http://www.adobe.com/products/photoshop/"],
["flash", "http://www.macromedia.com/software/flash/"],
["shockwave", "http://www.shockwave.com"],
["stargate", "http://www.mgm.com/stargate/"],
["movies", "http://www.pocketmovies.net/"],
["trailers", "http://www.apple.com/trailers"],
["music", "http://www..allmusic.com"]
];
function keyWordLink(){
var iCell = document.getElementsByTagName("td");
for(c = 0; c < iCell.length; c ++){
if(iCell.item(c).colSpan == "3" && iCell.item(c).vAlign == "top"){
for(k = 0; k < keyWords.length; k ++){
if(iCell.item(c).innerHTML.match(new RegExp("(\\s|^)(" + keyWords[k][0] + ")(\\s|$)", "ig"))){
var iLink = '<a href="' + keyWords[k][1] + '" target="_blank">' + RegExp.$2 + '</a>';
iCell.item(c).innerHTML = iCell.item(c).innerHTML.replace(new RegExp(RegExp.$2, "g"), iLink);
}
}
}
}
}
if(location.href.match(/thread=/)){
keyWordLink();
}
//-->
</script>
Global footers
<script type="text/javascript">
<!--
/*
link keywords in posts to site - Created by Peter
This code cannot be reposted anywhere other than SSDesigns or ProBoards Support.
This header must stay intact.
*/
var keyWords = [
["google", "http://www.google.com"],
["yahoo", "http://www.yahoo.com"],
["proboards", "http://www.proboards.com"],
["ssdesigns", "http://ssdesigns.proboards17.com"],
["ssd", "http://ssdesigns.proboards17.com"],
["altavista", "http://www.altavista.com"],
["firefox", "http://www.firefox.com/"],
["mozilla", "http://www.mozilla.org/"],
["microsoft", "http://www.microsoft.com/"],
["download", "http://www.download.com/"],
["photoshop", "http://www.adobe.com/products/photoshop/"],
["flash", "http://www.macromedia.com/software/flash/"],
["shockwave", "http://www.shockwave.com"],
["stargate", "http://www.mgm.com/stargate/"],
["movies", "http://www.pocketmovies.net/"],
["trailers", "http://www.apple.com/trailers"],
["music", "http://www..allmusic.com"]
];
function keyWordLink(){
var iCell = document.getElementsByTagName("td");
for(c = 0; c < iCell.length; c ++){
if(iCell.item(c).colSpan == "3" && iCell.item(c).vAlign == "top"){
for(k = 0; k < keyWords.length; k ++){
if(iCell.item(c).innerHTML.match(new RegExp("(\\s|^)(" + keyWords[k][0] + ")(\\s|$)", "ig"))){
var iLink = '<a href="' + keyWords[k][1] + '" target="_blank">' + RegExp.$2 + '</a>';
iCell.item(c).innerHTML = iCell.item(c).innerHTML.replace(new RegExp(RegExp.$2, "g"), iLink);
}
}
}
}
}
if(location.href.match(/thread=/)){
keyWordLink();
}
//-->
</script>
Global footers