Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Turn imgur GIF links into GIFV
// ==UserScript==
// @name imgur GIF to GIFV
// @description Turn imgur GIF links into GIFV.
// @exclude *imgur.com*
// @version 1.2.1
// @grant none
// @run-at document-start
// ==/UserScript==
(function () {
var imgur_regex = /^https?:\/\/i\.imgur\.com\/[A-Za-z0-9]+.gif$/
var result2 = imgur_regex.exec(window.location);
function replace_links() {
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
var item = links[i];
result2 = imgur_regex.exec(item.href);
if (result2) {
item.href = item.href + "v";
}
}
}
window.addEventListener("DOMContentLoaded", replace_links, false);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment