From: <bra...@us...> - 2009-07-18 00:41:21
|
Revision: 2783 http://archive-access.svn.sourceforge.net/archive-access/?rev=2783&view=rev Author: bradtofel Date: 2009-07-18 00:41:19 +0000 (Sat, 18 Jul 2009) Log Message: ----------- Improvement to ArchivalUrl client-rewrite.js to preserve link text, working around a bug in Internet Explorer. Modified Paths: -------------- branches/wayback-1_4_2/wayback-webapp/src/main/webapp/js/client-rewrite.js Modified: branches/wayback-1_4_2/wayback-webapp/src/main/webapp/js/client-rewrite.js =================================================================== --- branches/wayback-1_4_2/wayback-webapp/src/main/webapp/js/client-rewrite.js 2009-07-18 00:40:05 UTC (rev 2782) +++ branches/wayback-1_4_2/wayback-webapp/src/main/webapp/js/client-rewrite.js 2009-07-18 00:41:19 UTC (rev 2783) @@ -4,28 +4,41 @@ image.src = url; return image.src; } +var xWaybackIsIE = (navigator.appName=="Microsoft Internet Explorer"); function xLateUrl(aCollection, sProp) { var i = 0; for(i = 0; i < aCollection.length; i++) { if(aCollection[i].getAttribute(sProp) && (aCollection[i].getAttribute(sProp).length > 0) && - (typeof(aCollection[i][sProp]) == "string")) { + (typeof(aCollection[i][sProp]) == "string") && + (aCollection[i][sProp].indexOf("mailto:") == -1) && + (aCollection[i][sProp].indexOf("javascript:") == -1)) { - if(aCollection[i][sProp].indexOf("mailto:") == -1 && - aCollection[i][sProp].indexOf("javascript:") == -1) { - var wmSpecial = aCollection[i].getAttribute("wmSpecial"); if(wmSpecial && wmSpecial.length > 0) { } else { - if(aCollection[i][sProp].indexOf(sWayBackCGI) == -1) { - if(aCollection[i][sProp].indexOf("http") == 0) { - aCollection[i][sProp] = sWayBackCGI + aCollection[i][sProp]; - } else { - aCollection[i][sProp] = sWayBackCGI + xResolveUrl(aCollection[i][sProp]); - } - } + var newUrl; + if(aCollection[i][sProp].indexOf("http") == 0) { + newUrl = sWayBackCGI + aCollection[i][sProp]; + } else { + newUrl = sWayBackCGI + xResolveUrl(aCollection[i][sProp]); + } + if(navigator.appName=="Microsoft Internet Explorer") { + var inTmp = aCollection[i].innerHTML; + aCollection[i][sProp] = newUrl; + + if(inTmp && + ( (inTmp.indexOf("@") > 0) + || (inTmp.indexOf("www.") == 0) + || (inTmp.indexOf("http://") == 0) + ) + ) { + aCollection[i].innerHTML = inTmp; + } + } else { + aCollection[i][sProp] = newUrl; + } } - } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |