Permalink
Browse files

Better error handling

Remove unresponsive videos, but load them even without a thumbnail.

Also, remove leftover console.log call.
  • Loading branch information...
1 parent 19216f3 commit bcee43927c941eff280b15a791daf5d9f765da18 @samargulies committed Jan 31, 2012
Showing with 5 additions and 8 deletions.
  1. +5 −8 vimeo-gallery.js
View
@@ -20,24 +20,21 @@ jQuery(document).ready(function($){
'success' : function(video){
// we have the embed info now, lets program the playlist
- // If we can't load the thumbnail, just give up
- if( undefined == video.thumbnail_url ) {
- return;
- }
-
- console.log(video);
-
// save all the the data for later
video_info[video.video_id] = video;
- var listItem = '<a href="##" data-video-id="' + video.video_id + '"><img src="' + video.thumbnail_url + '" class="thumbnail" />';
+ var listItem = '<a href="##" data-video-id="' + video.video_id + '"><img src="' + video.thumbnail_url + '" class="thumbnail" width="33.3333333%" />';
listItem += '<h2>' + video.title + '</h2></a><p>' + video.description + '</p>';
video$.html(listItem);
if( video$.is('li:first-child') ) {
video$.find('a').click();
}
+ },
+ 'error' : function() {
+ // can't let the bad videos spoil all the fun
+ video$.remove();
}
});

0 comments on commit bcee439

Please sign in to comment.