9GAG Video Download Button

Provides a download button for 9gag detail view.

// ==UserScript==
// @name         9GAG Video Download Button
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Provides a download button for 9gag detail view.
// @author       Ragnar Lengson
// @match        https://9gag.com/gag/*
// @grant        GM.setValue
// ==/UserScript==

(function() {
    'use strict';

    console.log('Save video as button loaded');
    if($('.post-container source[type="video/mp4"]').length == 0)
    {
        return;
    }

    var videoPost = $('.post-container source[type="video/mp4"]')[0].src;
    var postContainer = $('.post-container');
    postContainer.append('<a class="btn btn-block" style="margin:0px 0px 10px 0px" target="_blank" type="application/octet-stream" href="'+videoPost+'" download>Save video as ...</a>');
})();