home *** CD-ROM | disk | FTP | other *** search
/ PC World 2004 June / PCWorld_2004-06_cd.bin / komunikace / slimb / sbsetup.exe / $_14327_ / ExtractAllLinks.js < prev    next >
Text File  |  2003-05-05  |  514b  |  19 lines

  1. function ExtractAllLinks(sPattern)
  2. {
  3.     var s="";
  4.     var sUrl;
  5.     var i;
  6.     sPattern=sPattern.replace(/\./g,"\\.");
  7.     sPattern=sPattern.replace(/\*/g,".*");
  8.     sPattern=sPattern.replace(/\?/g,".");
  9.     var rx=new RegExp(sPattern,"ig");
  10.     for (i=0;i<document.links.length;i++)
  11.     {
  12.         sUrl=escape(document.links[i].href);
  13.         sUrl=sUrl.replace(/http%3A\/\//ig,"http://");
  14.         sUrl=sUrl.replace(/%25([0-9,A-Z,a-z]{2})/ig,"%$1");
  15.         if (sUrl.match(rx)) s=s+sUrl+"\r\n";
  16.     }
  17.     document.body.retExtractAllLinks=s;
  18.     return s;
  19. }