Guest User

Untitled

a guest
Aug 4th, 2008
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. (function () { // function wrapper for Opera
  2.  
  3.  
  4. var pics = document.evaluate(
  5. "//a[contains(@href, '.blogger.com/')]",
  6. document,
  7. null,
  8. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  9. null);
  10.  
  11.  
  12. var img, link, matchesLink, matchesImg,
  13. regexp = /^http:\/\/bp\d\.blogger\.com\/[^\/]+\/[^\/]+\/[^\/]+\/([^\/]+)\/([^\/]+)\/.+$/;
  14.  
  15. for (var i = 0; i < pics.snapshotLength; i++) {
  16. link = pics.snapshotItem(i);
  17. matchesLink = link.href.match(regexp);
  18. if (matchesLink) {
  19. if (matchesLink[2].search(/-R/) > -1) {
  20. alert(link.firstChild.src);
  21. matchesImg = link.firstChild.src.match(regexp);
  22. if (matchesImg != null) {
  23. link.href = link.href.replace(new RegExp(matchesLink[1]),
  24. matchesImg[1]);
  25. link.href = link.href.replace(/\/s\d+-R\//, "/s1600-h/");
  26. }
  27. } else {
  28. if (matchesLink[0].search(/\/s\d+\//) > -1) {
  29. link.href = link.href.replace(/\/s\d+\//, "/s1600-h/");
  30. }
  31. }
  32. }
  33. }
  34.  
  35. })();
Advertisement
Add Comment
Please, Sign In to add comment