Created
July 12, 2013 07:23
-
-
Save lyatziv/5982560 to your computer and use it in GitHub Desktop.
A quick way to load a bunch of videos from vimeo.
This file contains 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
jQuery(document).ready(function($){ | |
$('iframe[src*="player.vimeo"]').each(function(){ | |
var id = $(this).attr("src").split("/").slice(-1)[0]; | |
$(this).addClass("video_id_"+id); | |
$(this).parent().addClass("vimeo_id_"+id); | |
$.ajax({ | |
type:'GET', | |
url: 'http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/' + id +'.json', | |
jsonp: 'callback', | |
dataType: 'jsonp', | |
success: function(data){ | |
$(".vimeo_id_"+id).append("<img class='lazy_vimeo' data-object='" + JSON.stringify(data) + "' src='" + data.thumbnail_url + "'/>"); | |
$(".video_id_"+id).remove(); | |
$(".lazy_vimeo").each(function(){ | |
$(this).click(function(){ | |
var data = $.parseJSON($(this).attr("data-object")); | |
$(this).parent().append(data.html); | |
$(this).remove(); | |
}); | |
}); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If any help, here is the page:
http://davidortiz.es/c/unseen/videos.php