Skip to content

Instantly share code, notes, and snippets.

@athomason
Created March 4, 2019 02:50
Show Gist options
  • Save athomason/55732735e00b263c46aafa07be58ce02 to your computer and use it in GitHub Desktop.
Save athomason/55732735e00b263c46aafa07be58ce02 to your computer and use it in GitHub Desktop.
mltshp gif link adder
// ==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