🏠 Home 

Greasy Fork is available in English.

Imgur Direct Images

Direct images on Imgur including albums


安装此脚本?
  1. // ==UserScript==
  2. // @name Imgur Direct Images
  3. // @version 1.0.1
  4. // @description Direct images on Imgur including albums
  5. // @namespace https://github.com/AbdurazaaqMohammed
  6. // @author Abdurazaaq Mohammed
  7. // @license The Unlicense
  8. // @homepage https://github.com/AbdurazaaqMohammed/userscripts
  9. // @supportURL https://github.com/AbdurazaaqMohammed/userscripts/issues
  10. // @match https://imgur.com/*
  11. // @exclude https://imgur.com/
  12. // @grant none
  13. // @run-at document-start
  14. // ==/UserScript==
  15. (function() {
  16. 'use strict';
  17. const url = window.location.href;
  18. if(url.includes('/a/')) {
  19. // Try to clean the crap. If you try to hide all elements imgur will redirect to the homepage for some reason.
  20. document.head.appendChild(document.createElement('style')).innerHTML = 'a:not(.Gallery-Content--media) { display: none !important; } *{ background-color: black !important; }';
  21. const intervalID = setInterval(function() {
  22. const images = document.querySelectorAll('.Gallery-Content--media img');
  23. if(images[0]) {
  24. const links = [];
  25. clearInterval(intervalID);
  26. images.forEach(image => {
  27. const directLink = image.src.split('?')[0].replace('_d.', '.'); //_d is a lower quality image.
  28. if(!links.includes(directLink)) links.push(directLink); // For some reason it shows all links twice.
  29. });
  30. window.location.href = 'https://abdurazaaqmohammed.github.io/website/imgviewer?viewimg=' + links.join(',');
  31. }
  32. }, 200);
  33. } else {
  34. window.location.href = url.replace('imgur', 'i.imgur') + '.jpg'; // It always works even if it's not a jpg.
  35. }
  36. })();