Last active
October 31, 2024 18:10
-
-
Save dotWee/56ba0251f12f83710f7db40367fcfebe to your computer and use it in GitHub Desktop.
UserScript to redirect .webp links to the equivalent .gif file url
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 Giphy webp to gif redirect | |
// @description Giphy: Redirect .webp links to the equivalent .gif file url | |
// @match *://*.giphy.com/media/*/giphy.webp | |
// @run-at document-start | |
// @inject-into content | |
// @version 1.1 | |
// @author Lukas Wolfsteiner <https://lukas.wolfsteiner.media> | |
// @updateURL https://gist.github.com/dotWee/56ba0251f12f83710f7db40367fcfebe/raw/giphy_webp_to_gif_redirect.user.js | |
// @downloadURL https://gist.github.com/dotWee/56ba0251f12f83710f7db40367fcfebe/raw/giphy_webp_to_gif_redirect.user.js | |
// ==/UserScript== | |
function redirect_to_gif() { | |
let current_gif_url = location.href; | |
current_gif_url = current_gif_url.replace(/media\d/, "i").replace(".webp", ".gif"); | |
console.log("Redirecting to: " + current_gif_url); | |
window.location.href = current_gif_url; | |
} | |
redirect_to_gif(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Click on the Raw button or here to install the UserScript.