Last active
December 28, 2023 14:11
-
-
Save mouiserat/f9bd3951ec913fe96993dc71a74bddf9 to your computer and use it in GitHub Desktop.
🍴 fork of userscript to get the damn normal gif URL from giphy...
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 Fuck Giphy | |
// @namespace https://yourmove.ai | |
// @version 1.6.9 | |
// @description broken | |
// @author me | |
// @match *://*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Replace with the actual GIF data or load it dynamically | |
const gifData = 'R0lGODlhEAAQAMQTAADSt+/r6ChgoKCv////////yH5BAAAAAAALAAAAAANAAQwAAACVJU5ErkJggg=='; | |
const decodedGif = atob(gifData); | |
function createDownloadButton() { | |
const body = document.getElementsByTagName('body')[0]; | |
const btn = document.createElement('button'); | |
btn.textContent = 'Download GIF'; | |
btn.addEventListener('click', () => downloadGif()); | |
body.appendChild(btn); | |
} | |
function downloadGif() { | |
const blob = new Blob([decodedGif], {type : 'image/gif'}); | |
const url = window.URL.createObjectURL(blob); | |
const a = document.createElement("a"); | |
a.style = "display: none"; | |
a.href = url; | |
a.download = "mygif.gif"; | |
document.body.appendChild(a); | |
a.click(); | |
setTimeout(() => { | |
document.body.removeChild(a); | |
window.URL.revokeObjectURL(url); | |
}, 0); | |
} | |
createDownloadButton(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment