Created
November 1, 2019 21:21
-
-
Save noskla/938178d580e81a7bc2df8be0db63f5a8 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 z0r.de download button | |
// @include https://z0r.de/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
window.addEventListener('load', function(){ | |
// New element | |
var button = document.createElement('a'); | |
var button_text = document.createTextNode('Download'); | |
button.appendChild(button_text); | |
// CSS | |
button.style.backgroundColor = "#555555"; | |
button.style.color = "#dedede"; | |
button.style.padding = "3px"; | |
button.style.position = "fixed"; | |
button.style.top = "5px"; | |
button.style.right = "5px"; | |
// Check if flash exists on site and get the data. | |
var flash = document.getElementsByTagName('object'); | |
button.style.display = ( (flash[0] === undefined) ? "none" : "block" ); | |
var flash_filename = flash[0].getAttribute("data"); | |
// Set attributes to link element | |
button.setAttribute("href", `https://z0r.de${flash_filename}`); | |
button.setAttribute("download", flash_filename); | |
document.body.appendChild(button); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment