-
-
Save 4chenz/de3a3490aff19fd72e4fdd9b7dafc8f4 to your computer and use it in GitHub Desktop.
A userscript that links file hashes on usenet.
This file contains hidden or 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 useneet archive | |
// @namespace Violentmonkey Scripts | |
// @match *://desuarchive.org/gif/* | |
// @match *://desuarchive.org/wsg/* | |
// @match *://archived.moe/gif/* | |
// @match *://archived.moe/wsg/* | |
// @grant none | |
// @updateURL https://gist.github.com/4chenz/de3a3490aff19fd72e4fdd9b7dafc8f4/raw/useneet.user.js | |
// @version 1.0 | |
// @author - | |
// @description 7/7/2022, 10:38:01 AM | |
// ==/UserScript== | |
function insertA(el, hex){ | |
elle = document.createElement('a'); | |
elle.textContent = '[usenet]'; | |
elle.setAttribute('href', 'https://nzbindex.com/search/?q='+hex); | |
elle.setAttribute('class', 'btnr parent'); | |
el.appendChild(elle); | |
} | |
function useneet(element){ | |
hex = base64ToHex ( element.querySelector('a').href.split('/')[6]) | |
insertA(element, hex) | |
//console.log(hex); | |
} | |
function base64ToHex(str) { | |
for (var i = 0, bin = atob(str.replace(/_/g, '/').replace(/-/g, '+')), hex = []; i < bin.length; ++i) { | |
let tmp = bin.charCodeAt(i).toString(16); | |
if (tmp.length === 1) tmp = "0" + tmp; | |
hex[hex.length] = tmp; | |
} | |
return hex.join(""); | |
} | |
document.querySelectorAll('.post_file_controls').forEach(e => useneet(e)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
get a cheap block at news demon