NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name a2img // @namespace https://openuserjs.org/scripts/SR_team/a2img // @version 0.32 // @description Converting image links <a> to images <img> // @author SR_team // @homepage https://git.prime-hack.net/SR_team/a2img // @updateURL https://git.prime-hack.net/SR_team/a2img/raw/branch/master/a2img.js // @downloadURL https://git.prime-hack.net/SR_team/a2img/raw/branch/master/a2img.js // @include http://*/* // @include https://*/* // @exclude *://prime-hack.net/* // @exclude *://blast.hk/* // @grant none // @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt // ==/UserScript== (function() { 'use strict' var reExt = /.*\.(?:png|jpg|jpeg|gif)/i; // extensions for converting var reImGur = /(?:https?:\/\/)?imgur\.com\/(\w+)/i; var reLor = /(?:https?:\/\/)?(?:www\.)?linux\.org\.ru\/images\/.*/i; let next = true; while(next){ let links = document.getElementsByTagName('a'); next = false; for (let i = 0; i < links.length; ++i){ let href = links[i].href; if (href.match(reLor)) continue; let text = links[i].innerText; let imgur = href.match(reImGur); if (imgur){ links[i].outerHTML = `<img src='https://i.imgur.com/${imgur[1]}.png' alt='${text}' style='max-width:100%; max-height:100%;'/>`; next = true; } else if (href.match(reExt)){ links[i].outerHTML = `<img src='${href}' alt='${text}' style='max-width:100%; max-height:100%;'/>`; next = true; } } } })();