Hi, I’m using a little jquery to traverse links on our pages and set a class for different types of urls. Does anyone see a better way to grab file-download links for this? It should run very quickly as we have older machines in our market and a lot of js already.
Thanks!
[code]evans.classlinks = function()
{
var links = $(‘#content-indent .content a’);
for(i=0; i < links.length; i++) {
href = links[i].href.toLowerCase();
if(/(http|https)/.test(href) == true && /localhost|evans.washington/.test(href) == false) {
links[i].className = ‘offsite ‘+ links[i].className;
}
if(/mailto:/.test(href) == true) {
links[i].className = ’email ‘+ links[i].className;
}
if(/(/[-a-zA-Z0-9_?=&;]{0,})$|.(php|htm|html|cgi|pl)$/.test(href) == false) {
//this is also grabbing email links
links[i].className = ‘download ‘+ links[i].className;
}
}
}