Skip to content

Instantly share code, notes, and snippets.

@Nyr
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Nyr/468571584e053a50d5fb to your computer and use it in GitHub Desktop.
Save Nyr/468571584e053a50d5fb to your computer and use it in GitHub Desktop.
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