Peter
Junior Member
Coding God
Posts: 50
|
Post by Peter on Apr 29, 2006 13:19:18 GMT
This code will shorten links in posts so they don't stretch the table, which can be a problem in mozilla. Links will change from... ssdesigns.proboards17.com/index.cgi?board=postcodeto something like.. ssdesigns.proboards17.com/...postcode<script type="text/javascript"> <!-- /* Shorten long links in posts - Created by Peter
This code cannot be reposted anywhere other than SSDesigns or ProBoards Support.
This header must stay intact. */
// Any links above this number will be shortened var iMaxLen = 25;
function shortenLinks(){ var iCell = document.getElementsByTagName("td"); for(c = 0; c < iCell.length; c ++){ if(iCell.item(c).colSpan == "3" && iCell.item(c).vAlign == "top"){ var allLinks = iCell.item(c).getElementsByTagName("a"); for(a = 0; a < allLinks.length; a ++){ if(allLinks.item(a).innerHTML.length >= iMaxLen){ var inVal = allLinks.item(a); if(inVal.innerHTML.match(/((http(s)?:\/\/|www\.)(\w+([\.-]\w+)+))/igm)){ var iNum = (inVal.innerHTML.length > 50)? [10, 15] : [5, 0]; var iEnd = (inVal.innerHTML.length - iNum[0]); var nVal = inVal.innerHTML.substring((RegExp.$1.length + iNum[1]), iEnd); inVal.innerHTML = inVal.innerHTML.replace(nVal, "..."); } } } } } }
if(location.href.match(/thread=/)){ shortenLinks(); }
//--> </script>Global footers
|
|