WaybackMachine - Image preView on Archive.org pages

Provide archived images preview by replace all tags <a> with tags <img> in each archived images links

  1. // ==UserScript==
  2. // @name WaybackMachine - Image preView on Archive.org pages
  3. // @description Provide archived images preview by replace all tags <a> with tags <img> in each archived images links
  4. // @icon https://greasyfork.s3.us-east-2.amazonaws.com/a18s9s6zkhpm0wrcvl3703zr0mel
  5. // @version 1.3.3
  6. // @author Ravlissimo
  7. // @match https://web.archive.org/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
  9. // @require https://update.greatest.deepsurf.us/scripts/488748/1336185/waitForKeyElements2.js
  10. // @grant GM_addStyle
  11. // @license MIT
  12. // @namespace https://greatest.deepsurf.us/users/921216
  13. // ==/UserScript==
  14.  
  15. var imgExtRegex = new RegExp('(.*\.(gif|png|jpg|jpeg|webp|webm).*)$', 'im');
  16. var waitForKeyElements;
  17. waitForKeyElements ("tr > td > a", delinkImage);
  18. //result = text.slice(-3);
  19. function delinkImage (jNode) {
  20. var imgUrl2 = jNode.attr ("href");
  21. var imgUrl3 = imgUrl2.replace("*/","/");
  22. var imgUrl = imgUrl3.replace("/1500w/","/1500/");
  23. if (imgExtRegex.test (imgUrl) ) {
  24. //-- Found an image link. Replace contents.
  25. jNode.html ('<img src="' + imgUrl + '" class="gmDeLinked" alt="GM replaced image">');
  26. }
  27. }
  28.  
  29. GM_addStyle ( "img.gmDeLinked { border: 1px solid lime; max-width: 50vw; };" );