-
-
Save okeeblow/c5a6d38d244724ab1485 to your computer and use it in GitHub Desktop.
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 imgur GIFV to GIF | |
// @description Turn imgur GIFV links into GIF. | |
// @exclude *imgur.com* | |
// @version 1.0 | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
(function () { | |
var imgur_regex = /^https?:\/\/i\.imgur\.com\/[A-Za-z0-9]+.gifv$/ | |
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.slice(0, -1); | |
} | |
} | |
} | |
window.addEventListener("DOMContentLoaded", replace_links, false); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment