Created
January 31, 2019 06:53
-
-
Save speters/e37e99c2399606bc3192f4011161bfae to your computer and use it in GitHub Desktop.
Violentmonkey/Greasemonkey userscript to embed images on selected sites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Embed images on selected sites | |
// @namespace 7d47d98c-acd8-434f-b058-72f9ce028241 | |
// @version 0.1 | |
// @description Turn image URLs into embeded images. | |
// @author Print | |
// @match *://forum.zerspanungsbude.net/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var img = document.getElementsByTagName("a"); | |
for (var i = 0, l = img.length; i < l; i++) { | |
var imgno = img[i]; | |
var reg = new RegExp(/.*\.(png|svg|jpg|jpeg|gif|webp|tiff)/i); | |
if (reg.test(imgno.href)){ | |
console.log(imgno.href); | |
imgno.innerHTML = "<img src="+imgno.href+" width='100%'>"; | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment