Post by Peter on Jun 5, 2005 3:55:20 GMT -8
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">
<!--
// Created by PopThosePringles
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">
<!--
// Created by PopThosePringles
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