Browse Source

Enabling thumbnails in the timeline

pull/127/head
Zach Wise 13 years ago
parent
commit
5a4ac4b0c2
  1. 47
      source/js/VMM.ExternalAPI.js
  2. 10
      source/js/VMM.MediaElement.js

47
source/js/VMM.ExternalAPI.js

@ -21,6 +21,9 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
if (VMM.master_config.wikipedia.active) { if (VMM.master_config.wikipedia.active) {
VMM.ExternalAPI.wikipedia.pushQue(); VMM.ExternalAPI.wikipedia.pushQue();
} }
if (VMM.master_config.vimeo.active) {
VMM.ExternalAPI.vimeo.pushQue();
}
}, },
@ -534,7 +537,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
var flickr_img_thumb = d.sizes.size[0].source; var flickr_img_thumb = d.sizes.size[0].source;
VMM.Lib.attr("#"+flickr_large_id, "src", flickr_img_large); VMM.Lib.attr("#"+flickr_large_id, "src", flickr_img_large);
VMM.Lib.attr("#"+flickr_thumb_id, "src", flickr_img_thumb); VMM.attachElement("#"+flickr_thumb_id, "<img src='" + flickr_img_thumb + "'>");
//VMM.Lib.attr("#"+flickr_thumb_id, "src", flickr_img_thumb);
} }
}, },
@ -615,6 +619,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
youtube: { youtube: {
get: function(id) { get: function(id) {
var url = "http://gdata.youtube.com/feeds/api/videos/" + id + "?v=2&alt=jsonc&callback=?";
if (VMM.master_config.youtube.active) { if (VMM.master_config.youtube.active) {
VMM.master_config.youtube.que.push(id); VMM.master_config.youtube.que.push(id);
} else { } else {
@ -625,6 +631,9 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
}); });
} }
} }
// THUMBNAIL
VMM.getJSON(url, VMM.ExternalAPI.youtube.createThumb);
}, },
create: function(id) { create: function(id) {
@ -656,6 +665,13 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
VMM.master_config.youtube.array.push(p); VMM.master_config.youtube.array.push(p);
}, },
createThumb: function(d) {
trace(d.data.id);
trace(d.data.thumbnail.sqDefault);
var thumb_id = "youtube_" + d.data.id + "_thumb";
VMM.attachElement("#" + thumb_id, "<img src='" + d.data.thumbnail.sqDefault + "'>");
},
pushQue: function() { pushQue: function() {
for(var i = 0; i < VMM.master_config.youtube.que.length; i++) { for(var i = 0; i < VMM.master_config.youtube.que.length; i++) {
VMM.ExternalAPI.youtube.create(VMM.master_config.youtube.que[i]); VMM.ExternalAPI.youtube.create(VMM.master_config.youtube.que[i]);
@ -693,6 +709,35 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} }
},
vimeo: {
get: function(id) {
VMM.master_config.vimeo.que.push(id);
VMM.master_config.vimeo.active = true;
},
create: function(d) {
trace("VIMEO CREATE");
// THUMBNAIL
var url = "http://vimeo.com/api/v2/video/" + d + ".json";
VMM.getJSON(url, VMM.ExternalAPI.vimeo.createThumb);
},
createThumb: function(d) {
trace("VIMEO CREATE THUMB");
var thumb_id = "vimeo_" + d[0].id + "_thumb";
VMM.attachElement("#" + thumb_id, "<img src='" + d[0].thumbnail_small + "'>");
},
pushQue: function() {
for(var i = 0; i < VMM.master_config.vimeo.que.length; i++) {
VMM.ExternalAPI.vimeo.create(VMM.master_config.vimeo.que[i]);
}
VMM.master_config.vimeo.que = [];
}
} }
} }

10
source/js/VMM.MediaElement.js

@ -24,17 +24,16 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
mediaElem = "<div class='thumbnail thumb-photo'></div>"; mediaElem = "<div class='thumbnail thumb-photo'></div>";
return mediaElem; return mediaElem;
} else if (m.type == "flickr") { } else if (m.type == "flickr") {
//mediaElem = "<div class='thumbnail thumb-photo'><img id='flickr_" + m.id + "_thumb' width='" + _w + "px' height='" + _h + "px'></div>"; mediaElem = "<div class='thumbnail thumb-photo' id='flickr_" + m.id + "_thumb'></div>";
mediaElem = "<div class='thumbnail thumb-photo'></div>";
return mediaElem; return mediaElem;
} else if (m.type == "youtube") { } else if (m.type == "youtube") {
mediaElem = "<div class='thumbnail thumb-youtube'></div>"; mediaElem = "<div class='thumbnail thumb-youtube' id='youtube_" + m.id + "_thumb'></div>";
return mediaElem; return mediaElem;
} else if (m.type == "googledoc") { } else if (m.type == "googledoc") {
mediaElem = "<div class='thumbnail thumb-document'></div>"; mediaElem = "<div class='thumbnail thumb-document'></div>";
return mediaElem; return mediaElem;
} else if (m.type == "vimeo") { } else if (m.type == "vimeo") {
mediaElem = "<div class='thumbnail thumb-vimeo'></div>"; mediaElem = "<div class='thumbnail thumb-vimeo' id='vimeo_" + m.id + "_thumb'></div>";
return mediaElem; return mediaElem;
} else if (m.type == "dailymotion") { } else if (m.type == "dailymotion") {
mediaElem = "<div class='thumbnail thumb-video'></div>"; mediaElem = "<div class='thumbnail thumb-video'></div>";
@ -113,6 +112,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
// VIMEO // VIMEO
} else if (m.type == "vimeo") { } else if (m.type == "vimeo") {
mediaElem = "<iframe class='media-frame video vimeo' autostart='false' frameborder='0' width='100%' height='100%' src='http://player.vimeo.com/video/" + m.id + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'></iframe>"; mediaElem = "<iframe class='media-frame video vimeo' autostart='false' frameborder='0' width='100%' height='100%' src='http://player.vimeo.com/video/" + m.id + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'></iframe>";
VMM.ExternalAPI.vimeo.get(m.id);
// DAILYMOTION // DAILYMOTION
} else if (m.type == "dailymotion") { } else if (m.type == "dailymotion") {
mediaElem = "<iframe class='media-frame video dailymotion' autostart='false' frameborder='0' width='100%' height='100%' src='http://www.dailymotion.com/embed/video/" + m.id + "'></iframe>"; mediaElem = "<iframe class='media-frame video dailymotion' autostart='false' frameborder='0' width='100%' height='100%' src='http://www.dailymotion.com/embed/video/" + m.id + "'></iframe>";
@ -142,7 +142,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
// UNKNOWN // UNKNOWN
} else if (m.type == "unknown") { } else if (m.type == "unknown") {
trace("NO KNOWN MEDIA TYPE FOUND TRYING TO JUST PLACE THE HTML"); trace("NO KNOWN MEDIA TYPE FOUND TRYING TO JUST PLACE THE HTML");
mediaElem = "<div class='media-frame plain-text'><div class='container'>" + VMM.Util.properQuotes(m.id) + "</div></div>"; mediaElem = "<div class='plain-text'><div class='container'>" + VMM.Util.properQuotes(m.id) + "</div></div>";
// WEBSITE // WEBSITE
} else if (m.type == "website") { } else if (m.type == "website") {
mediaElem = "<iframe class='media-frame website' frameborder='0' autostart='false' width='100%' height='100%' scrolling='yes' marginheight='0' marginwidth='0' src='" + m.id + "'></iframe>"; mediaElem = "<iframe class='media-frame website' frameborder='0' autostart='false' width='100%' height='100%' scrolling='yes' marginheight='0' marginwidth='0' src='" + m.id + "'></iframe>";

Loading…
Cancel
Save