Last active
August 29, 2015 14:14
-
-
Save Nyr/468571584e053a50d5fb to your computer and use it in GitHub Desktop.
Turn imgur GIF links into GIFV
This file contains hidden or 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 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