Last active
April 18, 2016 00:38
-
-
Save Robdel12/e77fc70800642e62867a to your computer and use it in GitHub Desktop.
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 Vine download link | |
// @namespace http://www.robert-deluca.com | |
// @version 0.1 | |
// @description Download a vine video | |
// @author Robert DeLuca | |
// @match https://vine.co/* | |
// @grant none | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// ==/UserScript== | |
function addVideoURLToSingleVideo() { | |
var s = $('.main .vine-video-container video').attr('poster'); | |
var videoURL = s.substring(0, s.indexOf('.jpg')); | |
var constructedLink = '<a href="' + videoURL + '" class="custom-vine-dl-link" style="display: block; margin-top: 10px"">Download Video</a>'; | |
$('.post-social-metrics').append(constructedLink); | |
} | |
waitForKeyElements (".main", addVideoURLToSingleVideo); | |
function addVideoURLToMulti() { | |
if($('.post').hasClass('ember-view')) { | |
var s = $('.vine-video-container video').attr('poster'); | |
var videoURL = s.substring(0, s.indexOf('.jpg')); | |
var postActionsBtn = '<a href="' + videoURL + '"><button class="ember-view action clear share custom-vine-dl-link"><span style="transform: rotate(180deg);" class="icon-share_stroked"></span><span class="icon-share_stroked"></span><span class="caption">Download Video</span></button></a>' | |
$('.post-actions').append(postActionsBtn); | |
$('.post').removeClass('ember-view'); | |
} | |
} | |
waitForKeyElements (".post", addVideoURLToMulti); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment