Skip to content

Instantly share code, notes, and snippets.

@Far-Se
Last active April 18, 2023 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Far-Se/b3742ba3326357b15108ecf6cf675db5 to your computer and use it in GitHub Desktop.
Save Far-Se/b3742ba3326357b15108ecf6cf675db5 to your computer and use it in GitHub Desktop.
// ==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