Last active
November 9, 2021 02:18
-
-
Save phenomist/0383895d93aabba00b46fed8f9954f49 to your computer and use it in GitHub Desktop.
Userscript to add back puzz.link links
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 Re-add puzz.link's | |
// @namespace https://gist.github.com/phenomist/0383895d93aabba00b46fed8f9954f49 | |
// @version 0.2 | |
// @description Re-add puzz.link's link interface | |
// @author phenomist | |
// @match https://puzz.link/db/* | |
// @grant none | |
// ==/UserScript== | |
function add_puzzlinks() { | |
var puzzles = document.getElementsByClassName("pzvpuzzle"); | |
for (var i = 0; i < puzzles.length; i++){ | |
var puzzle = puzzles[i]; | |
if (puzzle.getElementsByClassName("plink").length == 0){ | |
var src = puzzle.getElementsByTagName("img")[0].src; | |
var link = src.replace("v?thumb&","?"); | |
var pzvlink = link.replace("https://puzz.link","http://pzv.jp"); | |
puzzle.getElementsByTagName("a")[0].href = link; | |
puzzle.insertAdjacentHTML('beforeend', '<div class="plink"><a target="_blank" href="'+link+'">[puzz.link]</a> <a target="_blank" href="'+pzvlink+'">[pzv.jp]</a></div>'); | |
} | |
} | |
} | |
(function() { | |
'use strict'; | |
add_puzzlinks(); | |
setInterval(add_puzzlinks, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this! I use it as a bookmarklet, very useful 👍