WaybackMachine - Image preView on Archive.org pages

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

As of 2024-03-03. See the latest version.

  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://play-lh.googleusercontent.com/hJnWYDQLRKqXZS7siQe-HeHZfcEFQ-cPS6cMNAKA4ukC5IwHgKHjQR8nWC9AUS-0kO-9
  5. // @version 1.3.2
  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 imgUrl = imgUrl2.replace("*/","/");
  22. if (imgExtRegex.test (imgUrl) ) {
  23. //-- Found an image link. Replace contents.
  24. jNode.html ('<img src="' + imgUrl + '" class="gmDeLinked" alt="GM replaced image">');
  25. }
  26. }
  27.  
  28. GM_addStyle ( "img.gmDeLinked { border: 1px solid lime; max-width: 70vw; };" );