Greasy Fork is available in English.

Wayback Machine - Image preView

Change <a>-tag to <img> in each img link

Verze ze dne 02. 03. 2024. Zobrazit nejnovější verzi.

  1. // ==UserScript==
  2. // @name Wayback Machine - Image preView
  3. // @description Change <a>-tag to <img> in each img link
  4. // @icon https://play-lh.googleusercontent.com/hJnWYDQLRKqXZS7siQe-HeHZfcEFQ-cPS6cMNAKA4ukC5IwHgKHjQR8nWC9AUS-0kO-9
  5. // @version 1.2
  6. // @author Ravlissimo
  7. // @license GPL-3.0 License
  8. // @match https://web.archive.org/*
  9. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
  10. // @require https://update.greatest.deepsurf.us/scripts/488748/1336185/waitForKeyElements2.js
  11. // @grant GM_addStyle
  12. // @namespace https://greatest.deepsurf.us/users/921216
  13. // ==/UserScript==
  14. /*
  15. https://gist.github.com/Ravlissimo/6c49a9b975b1dfa8280bc4aa2823e5bf/raw/207bf5ec7f92cc533bf5195b1152153b261209f2/wayback-img-view.user.js
  16. */
  17. var imageExtensions = ["gif", "png", "jpg", "jpeg"];
  18. var imgExtRegex = new RegExp('.*\.(gif|png|jpg|jpeg)$', 'im');
  19.  
  20. /*-- Tune the CSS path, for each site, to only find links that can be
  21. the image links you care about.
  22. */
  23. //-- For forums.hardwarezone.com.sg
  24. var waitForKeyElements;
  25. waitForKeyElements ("tr > td > a", delinkImage);
  26.  
  27. function delinkImage (jNode) {
  28. var imgUrl = jNode.attr ("href");
  29.  
  30. if (imgExtRegex.test (imgUrl) ) {
  31. //-- Found an image link. Replace contents.
  32. jNode.html ('<img src="' + imgUrl + '" class="gmDeLinked" alt="GM replaced image">');
  33. }
  34. }
  35.  
  36. GM_addStyle ( "img.gmDeLinked { border: 1px solid lime; max-width: 60vw; };" );