function checkLinks () { var links = document.getElementsByTagName("A"); var LinkExclusionsList; var AnyLinkExclusions = false; var ExcludeLink = false; var TargetOption; var LinkExclusions = "http://bfeeds.com,http://hot-warez.com,http://hide-link.com,http://woano.com,http://free-porno-downloads.com"; try { TargetOption = TargetOptionID; } catch (err) { TargetOption = 0; } if (LinkExclusions != "") { AnyLinkExclusions = true; // split LinkExclusions into an array by , LinkExclusionsList = LinkExclusions.split(","); // if a link doesn't have a query string on it, then we need to make sure a trailing / is on the end for (i = 0; i < LinkExclusionsList.length; i++) { if (LinkExclusionsList[i].indexOf("?") == -1) { if (LinkExclusionsList[i].substr(LinkExclusionsList[i].length-1,1) != "/") { LinkExclusionsList[i] += "/"; } } } } for (i = 0; i < links.length; i++) { // only change fully qualified links (otherwise links won't work) if(links[i].href.indexOf('http://') != -1 || links[i].href.indexOf('https://') != -1) { // don't change javascript links if (links[i].href.indexOf('javascript') != -1) { // do nothing } else { ExcludeLink = false; // any exclusions? if (AnyLinkExclusions) { // is this link in the link exclusions list? if it is, do not replace it for (j = 0; j < LinkExclusionsList.length; j++) { // if the base url of this link is in the exclusions list, do not replace it if (links[i].toString().indexOf(LinkExclusionsList[j].toString()) != -1) { ExcludeLink = true; break; } } } if (!ExcludeLink) { if (links[i].href.indexOf("http://hide-link.com/m") != -1) { // skip it } else { links[i].href = 'http://hide-link.com/m/link.php?link_id=28' + "&redirect=" + encodeURIComponent(links[i].href); // TargetOptionID // 0 = do nothing // 1 = open in same window // 2 = open in new window //if (TargetOption == 1) { links[i].target = '_top'; } //else if (TargetOption == 2) { links[i].target = '_blank'; } if (TargetOption == 2) { links[i].target = '_blank'; } else { links[i].target = '_top'; } } } } } } } var timeout = window.setTimeout("checkLinks (); clearTimeout(timeout )", 500);