Last active
April 18, 2023 06:42
-
-
Save Far-Se/b3742ba3326357b15108ecf6cf675db5 to your computer and use it in GitHub Desktop.
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 Discord Copy SRC ALT+C | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://discord.com/* | |
// @icon https://icons.duckduckgo.com/ip2/discord.com.ico | |
// @grant none | |
// ==/UserScript== | |
let logKey = (event)=>{ | |
if (event.altKey && event.keyCode == 67) { // ALT + C. Needs to be spammed sometime | |
const url = (event.target.querySelector('video') | |
||event.target.querySelector('img[alt="Image"]') | |
||event.target.querySelector('source')) | |
.getAttribute('src'); | |
if(!url)return; | |
navigator.clipboard.writeText(url.split('?')[0]); | |
alert('Copied '+url.substring(url.lastIndexOf('/')+1)); | |
} | |
} | |
document.addEventListener('keydown', logKey); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment