Advertisement
Guest User

Vimeo jQuery Downloader (v1.0)

a guest
Sep 5th, 2014
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. javascript:function main(){if(window.location.hostname!="vimeo.com"){alert("This script will only work on vimeo.com!");return}$.ajax({url:window.location.href,type:"GET",async:true,error:function(e){modal.open("Error","There was an error! Details printed in the browser console.");console.log(e);return},success:function(e){if(!e){jq_config.failed_tries++;console.log("Failed to get page. Retrying...");if(jq_config.failed_tries>=10){modal.open("Failed to get page","Couldn't get page info. Try again in a moment.");return}setTimeout(function(){main()},400);return}var t=$(e);var n=t.find(".player_container .player");if(!n.length){modal.open("Something went wrong","Couldn't find the video player on this page. Maybe the site updated.");return}var r=n.data("configUrl");$.ajax({url:r,success:function(e){if(e.message){modal.open("Download Not Found","Could not retrieve download URLs.")}else{var t=e.request.files[jq_config.vimeo_codec];var n="";$.each(t,function(e,t){if(jq_config.video_types[e]){n+="<a class='btn' target='_blank' href='"+t.url+"'><i class='fa fa-download'></i> "+jq_config.video_types[e]+"</a>"}});if(n==""){modal.open("Download Not Found","Could not find download URLs.");return}modal.open("Download Video",n)}}})}})}function jquery_ready(e){if(window.jQuery){e(window.jQuery);return}var t=document.createElement("script");t.src=jq_config.jquery_url;t.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(t);var n=function(e){if(window.jQuery){e(jQuery)}else{window.setTimeout(function(){n(e)},20)}};n(function(t){t(e)})}function modal_init(){$("#clips > li > a").click(function(){window.location=$(this).attr("href")});modal.init=true;modal.close=function(){if(modal.object){modal.object.fadeOut(200,function(){$(this).remove()});modal.object=null}};$('<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">').appendTo("body");$("<style>#tsf{line-height: 20px;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:block;background-color:rgba(0,0,0,.5)}#tsf .dialogue{background-color:#292929;color:#eee;max-width:600px;min-height:200px;margin:0 auto;font-size:14px;position:relative;box-shadow:0 2px 6px rgba(0,0,0,.7)}#tsf .muted{color:#777;font-size:13px}#tsf a{color:#aaa;display:block}#tsf a:hover{color:#ccc}#tsf .close{position:absolute;top:0;right:0;margin:6px 8px;font-size:20px;cursor:pointer;color:#aaa}#tsf .close:hover{color:#ccc}#tsf .header{border-bottom:1px solid #444;font-size:20px;padding:8px}#tsf .content{padding:8px}#tsf a.btn{background-color:#333;border:1px solid #444;border-radius:2px;padding:7px 9px;display:inline-block;margin:3px;text-decoration:none}#tsf a.btn:hover{background-color:#393939;}#tsf *{transition:color .2s,background-color .2s;} #tsf .version{position:absolute;bottom:0;right:0;text-align:right;font-size:11px;color:#777;padding:3px 5px;}</style>").appendTo("body");modal.open=function(e,t){modal.close();var n="<div id='tsf'><div class='dialogue'><div class='close'><i class='fa fa-times'></i></div><div class='header'></div><div class='content'></div><div class='version'></div></div></div>";modal.object=$(n);modal.object.find(".close").click(modal.close);modal.object.find(".header").html(e);modal.object.find(".content").html(t);modal.object.find(".version").html(jq_config.info);$("body").append(modal.object);modal.object.hide();modal.object.fadeIn(200);modal.object.find(".dialogue").animate({"margin-top":"30px"},200)};$(document).mouseup(function(e){if($(e.target).is("#tsf"))modal.close()})}var jq_config={jquery_url:"//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js",info:"Vimeo jQuery Downloader v1.0",vimeo_codec:"h264",video_types:{hd:"HD MP4",sd:"SD MP4"},failed_tries:0};if(typeof modal==="undefined"){var modal={};modal.init=false}jquery_ready(function(){if(!modal.init)modal_init();main()})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement