Last active
October 15, 2022 11:51
-
-
Save joshparkerj/387e6798a4b5cb2e64e21bb2daf7d6fc to your computer and use it in GitHub Desktop.
show svgs
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 show svgs | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description show svgs | |
// @author Josh Parker | |
// @source https://github.com/joshparkerj/silly-internet-tricks/blob/main/wikipedia/show-svgs.user.js | |
// @downloadURL https://gist.github.com/joshparkerj/387e6798a4b5cb2e64e21bb2daf7d6fc/raw/show-svgs.user.js | |
// @updateURL https://gist.github.com/joshparkerj/387e6798a4b5cb2e64e21bb2daf7d6fc/raw/show-svgs.meta.js | |
// @match https://en.wikipedia.org/wiki/* | |
// @icon https://www.google.com/s2/favicons?domain=wikipedia.org | |
// @grant none | |
// ==/UserScript== |
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 show svgs | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description show svgs | |
// @author Josh Parker | |
// @source https://github.com/joshparkerj/silly-internet-tricks/blob/main/wikipedia/show-svgs.user.js | |
// @downloadURL https://gist.github.com/joshparkerj/387e6798a4b5cb2e64e21bb2daf7d6fc/raw/show-svgs.user.js | |
// @updateURL https://gist.github.com/joshparkerj/387e6798a4b5cb2e64e21bb2daf7d6fc/raw/show-svgs.meta.js | |
// @match https://en.wikipedia.org/wiki/* | |
// @icon https://www.google.com/s2/favicons?domain=wikipedia.org | |
// @grant none | |
// ==/UserScript== | |
!function(){const e=document.querySelector("#bodyContent"),t=document.createElement("button");t.innerText="show svgs",t.addEventListener("click",(()=>{t.disabled=!0;const n=[...document.querySelectorAll("a[href$=svg]")].map((e=>e.href)),c=document.createElement("section");c.id="svgs";const r=new DOMParser;n.forEach((e=>{e.match(/https:\/\/en\.wikipedia\.org\/wiki\/File:(?<fileName>.*\.svg)/)&&fetch(e).then((e=>e.text())).then((e=>r.parseFromString(e,"text/html"))).then((e=>e.querySelector(".fullImageLink a[href$=svg]").href)).then((e=>{fetch(e).then((e=>e.text())).then((e=>{const t=document.createElement("div");t.innerHTML=e,c.appendChild(t)}))}))})),e.appendChild(c)})),e.appendChild(t)}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment