Created
March 4, 2019 02:50
-
-
Save athomason/55732735e00b263c46aafa07be58ce02 to your computer and use it in GitHub Desktop.
mltshp gif link adder
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 mltshp gif link adder | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description add a link for the .gif version of any <video> | |
// @author daam | |
// @match https://mltshp.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var $ = window.jQuery; | |
$('video').each(function() { | |
var src = $(this).attr("data-src"); | |
var gif = src + '.gif'; | |
// TODO find a way to make the "download" attribute work for one-click savings; | |
// doesn't work cross origin from mltshp.com to s.mltshp.com/mltshp-cdn.com | |
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes | |
var a = $('<div><a href="' + gif + '">GIF</a></div>'); | |
$(this).parent().append(a); | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment