Browse Source

Changed web thumb service to pagepeeker, tweaked flickr api size logic

Pagepeeker seems to provide better thumbnails
http://pagepeeker.com

Flickr size logic was assuming the medium 800 size exists. It doesn't anymore. This was causing enormous image sizes to load instead.
pull/246/head v2.15
Zach Wise 12 years ago
parent
commit
10d5551f82
  1. 2
      compiled/js/storyjs-embed.js
  2. 10
      compiled/js/timeline-min.js
  3. 254
      compiled/js/timeline.js
  4. 2
      source/js/Core

2
compiled/js/storyjs-embed.js

File diff suppressed because one or more lines are too long

10
compiled/js/timeline-min.js vendored

File diff suppressed because one or more lines are too long

254
compiled/js/timeline.js

@ -185,6 +185,13 @@ if (typeof VMM == 'undefined') {
que: [] que: []
}, },
webthumb: {
active: false,
array: [],
api_loaded: false,
que: []
},
googlemaps: { googlemaps: {
active: false, active: false,
map_active: false, map_active: false,
@ -2631,6 +2638,9 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
if (VMM.master_config.flickr.active) { if (VMM.master_config.flickr.active) {
VMM.ExternalAPI.flickr.pushQue(); VMM.ExternalAPI.flickr.pushQue();
} }
if (VMM.master_config.webthumb.active) {
VMM.ExternalAPI.webthumb.pushQue();
}
}, },
twitter: { twitter: {
@ -2909,11 +2919,9 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
get: function(m) { get: function(m) {
var timer, var timer,
api_key, api_key,
map_vars, map_url;
map_url,
map;
map_vars = VMM.Util.getUrlVars(m.id); m.vars = VMM.Util.getUrlVars(m.id);
if (VMM.ExternalAPI.keys.google != "") { if (VMM.ExternalAPI.keys.google != "") {
api_key = VMM.ExternalAPI.keys.google; api_key = VMM.ExternalAPI.keys.google;
@ -2922,12 +2930,11 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} }
map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady"; map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady";
map = { url: m.id, vars: map_vars, id: m.uid };
if (VMM.master_config.googlemaps.active) { if (VMM.master_config.googlemaps.active) {
VMM.master_config.googlemaps.que.push(map); VMM.master_config.googlemaps.que.push(m);
} else { } else {
VMM.master_config.googlemaps.que.push(map); VMM.master_config.googlemaps.que.push(m);
if (VMM.master_config.googlemaps.api_loaded) { if (VMM.master_config.googlemaps.api_loaded) {
@ -2940,26 +2947,19 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
}, },
create: function(m) { create: function(m) {
trace(m.url);
VMM.ExternalAPI.googlemaps.createAPIMap(m); VMM.ExternalAPI.googlemaps.createAPIMap(m);
if (m.url[0].match("msid")) {
//VMM.ExternalAPI.googlemaps.createAPIMap(m);
} else {
//VMM.ExternalAPI.googlemaps.createiFrameMap(m);
}
}, },
createiFrameMap: function(m) { createiFrameMap: function(m) {
var embed_url = m.url + "&output=embed", var embed_url = m.id + "&output=embed",
mc = "", mc = "",
unique_map_id = m.id.toString() + "_gmap"; unique_map_id = m.uid.toString() + "_gmap";
mc += "<div class='google-map' id='" + unique_map_id + "' style='width=100%;height=100%;'>"; mc += "<div class='google-map' id='" + unique_map_id + "' style='width=100%;height=100%;'>";
mc += "<iframe width='100%' height='100%' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='" + embed_url + "'></iframe>"; mc += "<iframe width='100%' height='100%' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='" + embed_url + "'></iframe>";
mc += "</div>"; mc += "</div>";
VMM.attachElement("#" + m.id, mc); VMM.attachElement("#" + m.uid, mc);
}, },
@ -2968,7 +2968,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
layer, layer,
map, map,
map_options, map_options,
unique_map_id = m.id.toString() + "_gmap", unique_map_id = m.uid.toString() + "_gmap",
map_attribution_html = "", map_attribution_html = "",
location = new google.maps.LatLng(41.875696,-87.624207), location = new google.maps.LatLng(41.875696,-87.624207),
latlong, latlong,
@ -3036,19 +3036,19 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} }
if (type.of(VMM.Util.getUrlVars(m.url)["ll"]) == "string") { if (type.of(VMM.Util.getUrlVars(m.id)["ll"]) == "string") {
has_location = true; has_location = true;
latlong = VMM.Util.getUrlVars(m.url)["ll"].split(","); latlong = VMM.Util.getUrlVars(m.id)["ll"].split(",");
location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1])); location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1]));
} else if (type.of(VMM.Util.getUrlVars(m.url)["sll"]) == "string") { } else if (type.of(VMM.Util.getUrlVars(m.id)["sll"]) == "string") {
latlong = VMM.Util.getUrlVars(m.url)["sll"].split(","); latlong = VMM.Util.getUrlVars(m.id)["sll"].split(",");
location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1])); location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1]));
} }
if (type.of(VMM.Util.getUrlVars(m.url)["z"]) == "string") { if (type.of(VMM.Util.getUrlVars(m.id)["z"]) == "string") {
has_zoom = true; has_zoom = true;
zoom = parseFloat(VMM.Util.getUrlVars(m.url)["z"]); zoom = parseFloat(VMM.Util.getUrlVars(m.id)["z"]);
} }
map_options = { map_options = {
@ -3067,7 +3067,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} }
} }
VMM.attachElement("#" + m.id, "<div class='google-map' id='" + unique_map_id + "' style='width=100%;height=100%;'></div>"); VMM.attachElement("#" + m.uid, "<div class='google-map' id='" + unique_map_id + "' style='width=100%;height=100%;'></div>");
map = new google.maps.Map(document.getElementById(unique_map_id), map_options); map = new google.maps.Map(document.getElementById(unique_map_id), map_options);
@ -3081,11 +3081,11 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} }
// DETERMINE IF KML IS POSSIBLE // DETERMINE IF KML IS POSSIBLE
if (m.url[0].match("msid")) { if (m.id[0].match("msid")) {
loadKML(); loadKML();
} else { } else {
//loadPlaces(); //loadPlaces();
if (type.of(VMM.Util.getUrlVars(m.url)["q"]) == "string") { if (type.of(VMM.Util.getUrlVars(m.id)["q"]) == "string") {
geocodePlace(); geocodePlace();
} }
} }
@ -3096,7 +3096,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
var geocoder = new google.maps.Geocoder(), var geocoder = new google.maps.Geocoder(),
address = VMM.Util.getUrlVars(m.url)["q"], address = VMM.Util.getUrlVars(m.id)["q"],
marker; marker;
if (address.match("loc:")) { if (address.match("loc:")) {
@ -3164,8 +3164,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
types: ['country', 'neighborhood', 'political', 'locality', 'geocode'] types: ['country', 'neighborhood', 'political', 'locality', 'geocode']
}; };
if (type.of(VMM.Util.getUrlVars(m.url)["q"]) == "string") { if (type.of(VMM.Util.getUrlVars(m.id)["q"]) == "string") {
search_request.query = VMM.Util.getUrlVars(m.url)["q"]; search_request.query = VMM.Util.getUrlVars(m.id)["q"];
} }
if (has_location) { if (has_location) {
@ -3215,8 +3215,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} }
} else { } else {
trace("USING SIMPLE IFRAME MAP EMBED"); trace("USING SIMPLE IFRAME MAP EMBED");
if (m.url[0].match("https")) { if (m.id[0].match("https")) {
m.url = m.url[0].replace("https", "http"); m.id = m.url[0].replace("https", "http");
} }
VMM.ExternalAPI.googlemaps.createiFrameMap(m); VMM.ExternalAPI.googlemaps.createiFrameMap(m);
} }
@ -3259,8 +3259,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
places_url = "https://maps.googleapis.com/maps/api/place/textsearch/json?key=" + api_key + "&sensor=false&language=" + m.lang + "&"; places_url = "https://maps.googleapis.com/maps/api/place/textsearch/json?key=" + api_key + "&sensor=false&language=" + m.lang + "&";
if (type.of(VMM.Util.getUrlVars(m.url)["q"]) == "string") { if (type.of(VMM.Util.getUrlVars(m.id)["q"]) == "string") {
places_url += "query=" + VMM.Util.getUrlVars(m.url)["q"]; places_url += "query=" + VMM.Util.getUrlVars(m.id)["q"];
} }
if (has_location) { if (has_location) {
@ -3341,7 +3341,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
function loadKML() { function loadKML() {
var kml_url, kml_layer, infowindow, text; var kml_url, kml_layer, infowindow, text;
kml_url = m.url + "&output=kml"; kml_url = m.id + "&output=kml";
kml_url = kml_url.replace("&output=embed", ""); kml_url = kml_url.replace("&output=embed", "");
kml_layer = new google.maps.KmlLayer(kml_url, {preserveViewport:true}); kml_layer = new google.maps.KmlLayer(kml_url, {preserveViewport:true});
infowindow = new google.maps.InfoWindow(); infowindow = new google.maps.InfoWindow();
@ -3605,19 +3605,18 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
googledocs: { googledocs: {
get: function(m) { get: function(m) {
var doc = {url: m.id, id: m.uid}; VMM.master_config.googledocs.que.push(m);
VMM.master_config.googledocs.que.push(doc);
VMM.master_config.googledocs.active = true; VMM.master_config.googledocs.active = true;
}, },
create: function(doc) { create: function(m) {
var mediaElem = ""; var mediaElem = "";
if (doc.url.match(/docs.google.com/i)) { if (m.id.match(/docs.google.com/i)) {
mediaElem = "<iframe class='doc' frameborder='0' width='100%' height='100%' src='" + doc.url + "&amp;embedded=true'></iframe>"; mediaElem = "<iframe class='doc' frameborder='0' width='100%' height='100%' src='" + m.id + "&amp;embedded=true'></iframe>";
} else { } else {
mediaElem = "<iframe class='doc' frameborder='0' width='100%' height='100%' src='" + "http://docs.google.com/viewer?url=" + doc.url + "&amp;embedded=true'></iframe>"; mediaElem = "<iframe class='doc' frameborder='0' width='100%' height='100%' src='" + "http://docs.google.com/viewer?url=" + m.id + "&amp;embedded=true'></iframe>";
} }
VMM.attachElement("#"+doc.id, mediaElem); VMM.attachElement("#"+m.uid, mediaElem);
}, },
pushQue: function() { pushQue: function() {
@ -3633,27 +3632,26 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
flickr: { flickr: {
get: function(m) { get: function(m) {
var flick = {mid: m.id, id: m.uid, link: m.link}; VMM.master_config.flickr.que.push(m);
VMM.master_config.flickr.que.push(flick);
VMM.master_config.flickr.active = true; VMM.master_config.flickr.active = true;
}, },
create: function(flick, callback) { create: function(m, callback) {
var api_key, var api_key,
callback_timeout= setTimeout(callback, VMM.master_config.timers.api, flick); callback_timeout= setTimeout(callback, VMM.master_config.timers.api, m);
if (typeof VMM.master_config.Timeline != 'undefined' && VMM.master_config.Timeline.api_keys.flickr != "") { if (typeof VMM.master_config.Timeline != 'undefined' && VMM.master_config.Timeline.api_keys.flickr != "") {
api_key = VMM.master_config.Timeline.api_keys.flickr; api_key = VMM.master_config.Timeline.api_keys.flickr;
} else { } else {
api_key = Aes.Ctr.decrypt(VMM.master_config.api_keys_master.flickr, VMM.master_config.vp, 256) api_key = Aes.Ctr.decrypt(VMM.master_config.api_keys_master.flickr, VMM.master_config.vp, 256)
} }
var the_url = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=" + api_key + "&photo_id=" + flick.mid + "&format=json&jsoncallback=?"; var the_url = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=" + api_key + "&photo_id=" + m.id + "&format=json&jsoncallback=?";
VMM.getJSON(the_url, function(d) { VMM.getJSON(the_url, function(d) {
var flickr_id = d.sizes.size[0].url.split("photos\/")[1].split("/")[1]; var flickr_id = d.sizes.size[0].url.split("photos\/")[1].split("/")[1];
var flickr_large_id = "#" + flick.id, var flickr_large_id = "#" + m.uid,
flickr_thumb_id = "#" + flick.id + "_thumb"; flickr_thumb_id = "#" + m.uid + "_thumb";
//flickr_thumb_id = "flickr_" + uid + "_thumb"; //flickr_thumb_id = "flickr_" + uid + "_thumb";
var flickr_img_size, var flickr_img_size,
@ -3662,15 +3660,15 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
flickr_best_size = "Large"; flickr_best_size = "Large";
flickr_best_size = VMM.ExternalAPI.flickr.sizes(VMM.master_config.sizes.api.height); flickr_best_size = VMM.ExternalAPI.flickr.sizes(VMM.master_config.sizes.api.height);
for(var i = 0; i < d.sizes.size.length; i++) { for(var i = 0; i < d.sizes.size.length; i++) {
if (d.sizes.size[i].label == flickr_best_size) { if (d.sizes.size[i].label == flickr_best_size) {
flickr_size_found = true; flickr_size_found = true;
flickr_img_size = d.sizes.size[i].source; flickr_img_size = d.sizes.size[i].source;
} }
} }
if (!flickr_size_found) { if (!flickr_size_found) {
flickr_img_size = d.sizes.size[d.sizes.size.length - 1].source; flickr_img_size = d.sizes.size[d.sizes.size.length - 2].source;
} }
flickr_img_thumb = d.sizes.size[0].source; flickr_img_thumb = d.sizes.size[0].source;
@ -3710,7 +3708,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} else if (s <= 480) { } else if (s <= 480) {
_size = "Medium 640"; _size = "Medium 640";
} else if (s <= 600) { } else if (s <= 600) {
_size = "Medium 800"; _size = "Large";
} else { } else {
_size = "Large"; _size = "Large";
} }
@ -3721,11 +3719,11 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
}, },
instagram: { instagram: {
get: function(mid, thumb) { get: function(m, thumb) {
if (thumb) { if (thumb) {
return "http://instagr.am/p/" + mid + "/media/?size=t"; return "http://instagr.am/p/" + m.id + "/media/?size=t";
} else { } else {
return "http://instagr.am/p/" + mid + "/media/?size=" + VMM.ExternalAPI.instagram.sizes(VMM.master_config.sizes.api.height); return "http://instagr.am/p/" + m.id + "/media/?size=" + VMM.ExternalAPI.instagram.sizes(VMM.master_config.sizes.api.height);
} }
}, },
@ -3746,15 +3744,14 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
soundcloud: { soundcloud: {
get: function(m) { get: function(m) {
var sound = {mid: m.id, id: m.uid}; VMM.master_config.soundcloud.que.push(m);
VMM.master_config.soundcloud.que.push(sound);
VMM.master_config.soundcloud.active = true; VMM.master_config.soundcloud.active = true;
}, },
create: function(sound, callback) { create: function(m, callback) {
var the_url = "http://soundcloud.com/oembed?url=" + sound.mid + "&format=js&callback=?"; var the_url = "http://soundcloud.com/oembed?url=" + m.id + "&format=js&callback=?";
VMM.getJSON(the_url, function(d) { VMM.getJSON(the_url, function(d) {
VMM.attachElement("#"+sound.id, d.html); VMM.attachElement("#"+m.uid, d.html);
callback(); callback();
}); });
}, },
@ -3771,20 +3768,19 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
wikipedia: { wikipedia: {
get: function(m) { get: function(m) {
var api_obj = {url: m.id, id: m.uid, lang: m.lang}; VMM.master_config.wikipedia.que.push(m);
VMM.master_config.wikipedia.que.push(api_obj);
VMM.master_config.wikipedia.active = true; VMM.master_config.wikipedia.active = true;
}, },
create: function(api_obj, callback) { create: function(m, callback) {
var the_url = "http://" + api_obj.lang + ".wikipedia.org/w/api.php?action=query&prop=extracts&redirects=&titles=" + api_obj.url + "&exintro=1&format=json&callback=?"; var the_url = "http://" + m.lang + ".wikipedia.org/w/api.php?action=query&prop=extracts&redirects=&titles=" + m.id + "&exintro=1&format=json&callback=?";
callback_timeout= setTimeout(callback, VMM.master_config.timers.api, api_obj); callback_timeout= setTimeout(callback, VMM.master_config.timers.api, m);
if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.Browser.version, 10) >= 7 && window.XDomainRequest) { if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.Browser.version, 10) >= 7 && window.XDomainRequest) {
var temp_text = "<h4><a href='http://" + VMM.master_config.language.api.wikipedia + ".wikipedia.org/wiki/" + api_obj.url + "' target='_blank'>" + api_obj.url + "</a></h4>"; var temp_text = "<h4><a href='http://" + VMM.master_config.language.api.wikipedia + ".wikipedia.org/wiki/" + m.id + "' target='_blank'>" + m.url + "</a></h4>";
temp_text += "<span class='wiki-source'>" + VMM.master_config.language.messages.wikipedia + "</span>"; temp_text += "<span class='wiki-source'>" + VMM.master_config.language.messages.wikipedia + "</span>";
temp_text += "<p>Wikipedia entry unable to load using Internet Explorer 8 or below.</p>"; temp_text += "<p>Wikipedia entry unable to load using Internet Explorer 8 or below.</p>";
VMM.attachElement("#"+api_obj.id, temp_text ); VMM.attachElement("#"+m.uid, temp_text );
} }
VMM.getJSON(the_url, function(d) { VMM.getJSON(the_url, function(d) {
@ -3818,7 +3814,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
if (wiki_extract.match("REDIRECT")) { if (wiki_extract.match("REDIRECT")) {
} else { } else {
VMM.attachElement("#"+api_obj.id, _wiki ); VMM.attachElement("#"+m.uid, _wiki );
} }
} }
//callback(); //callback();
@ -3828,14 +3824,14 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
trace("WIKIPEDIA ERROR: " + textStatus + " " + jqXHR.responseText); trace("WIKIPEDIA ERROR: " + textStatus + " " + jqXHR.responseText);
trace(errorThrown); trace(errorThrown);
VMM.attachElement("#"+api_obj.id, VMM.MediaElement.loadingmessage("<p>Wikipedia is not responding</p>")); VMM.attachElement("#"+m.uid, VMM.MediaElement.loadingmessage("<p>Wikipedia is not responding</p>"));
// TRY AGAIN? // TRY AGAIN?
clearTimeout(callback_timeout); clearTimeout(callback_timeout);
if (VMM.master_config.wikipedia.tries < 4) { if (VMM.master_config.wikipedia.tries < 4) {
trace("WIKIPEDIA ATTEMPT " + VMM.master_config.wikipedia.tries); trace("WIKIPEDIA ATTEMPT " + VMM.master_config.wikipedia.tries);
trace(api_obj); trace(m);
VMM.master_config.wikipedia.tries++; VMM.master_config.wikipedia.tries++;
VMM.ExternalAPI.wikipedia.create(api_obj, callback); VMM.ExternalAPI.wikipedia.create(m, callback);
} else { } else {
callback(); callback();
} }
@ -3865,10 +3861,9 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
youtube: { youtube: {
get: function(m) { get: function(m) {
var the_url = "http://gdata.youtube.com/feeds/api/videos/" + m.id + "?v=2&alt=jsonc&callback=?", var the_url = "http://gdata.youtube.com/feeds/api/videos/" + m.id + "?v=2&alt=jsonc&callback=?";
vid = {mid: m.id, id: m.uid, start: m.start, hd: m.hd};
VMM.master_config.youtube.que.push(vid); VMM.master_config.youtube.que.push(m);
if (!VMM.master_config.youtube.active) { if (!VMM.master_config.youtube.active) {
if (!VMM.master_config.youtube.api_loaded) { if (!VMM.master_config.youtube.api_loaded) {
@ -3880,42 +3875,42 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
// THUMBNAIL // THUMBNAIL
VMM.getJSON(the_url, function(d) { VMM.getJSON(the_url, function(d) {
VMM.ExternalAPI.youtube.createThumb(d, vid) VMM.ExternalAPI.youtube.createThumb(d, m)
}); });
}, },
create: function(vid) { create: function(m) {
if (typeof(vid.start) != 'undefined') { if (typeof(m.start) != 'undefined') {
var vidstart = vid.start.toString(), var vidstart = m.start.toString(),
vid_start_minutes = 0, vid_start_minutes = 0,
vid_start_seconds = 0; vid_start_seconds = 0;
if (vidstart.match('m')) { if (vidstart.match('m')) {
vid_start_minutes = parseInt(vidstart.split("m")[0], 10); vid_start_minutes = parseInt(vidstart.split("m")[0], 10);
vid_start_seconds = parseInt(vidstart.split("m")[1].split("s")[0], 10); vid_start_seconds = parseInt(vidstart.split("m")[1].split("s")[0], 10);
vid.start = (vid_start_minutes * 60) + vid_start_seconds; m.start = (vid_start_minutes * 60) + vid_start_seconds;
} else { } else {
vid.start = 0; m.start = 0;
} }
} else { } else {
vid.start = 0; m.start = 0;
} }
var p = { var p = {
active: false, active: false,
player: {}, player: {},
name: vid.id, name: m.uid,
playing: false, playing: false,
hd: false hd: false
}; };
if (typeof(vid.hd) != 'undefined') { if (typeof(m.hd) != 'undefined') {
p.hd = true; p.hd = true;
} }
p.player[vid.id] = new YT.Player(vid.id, { p.player[m.id] = new YT.Player(m.uid, {
height: '390', height: '390',
width: '640', width: '640',
playerVars: { playerVars: {
@ -3923,10 +3918,10 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
color: 'white', color: 'white',
showinfo: 0, showinfo: 0,
theme: 'light', theme: 'light',
start: vid.start, start: m.start,
rel: 0 rel: 0
}, },
videoId: vid.mid, videoId: m.id,
events: { events: {
'onReady': VMM.ExternalAPI.youtube.onPlayerReady, 'onReady': VMM.ExternalAPI.youtube.onPlayerReady,
'onStateChange': VMM.ExternalAPI.youtube.onStateChange 'onStateChange': VMM.ExternalAPI.youtube.onStateChange
@ -3936,12 +3931,12 @@ 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, vid) { createThumb: function(d, m) {
trace("CREATE THUMB"); trace("CREATE THUMB");
trace(d); trace(d);
trace(vid); trace(m);
if (typeof d.data != 'undefined') { if (typeof d.data != 'undefined') {
var thumb_id = "#" + vid.id + "_thumb"; var thumb_id = "#" + m.uid + "_thumb";
VMM.attachElement(thumb_id, "<img src='" + d.data.thumbnail.sqDefault + "'>"); VMM.attachElement(thumb_id, "<img src='" + d.data.thumbnail.sqDefault + "'>");
} }
@ -3995,25 +3990,31 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
vimeo: { vimeo: {
get: function(m) { get: function(m) {
var vid = {mid: m.id, id: m.uid}; VMM.master_config.vimeo.que.push(m);
VMM.master_config.vimeo.que.push(vid);
VMM.master_config.vimeo.active = true; VMM.master_config.vimeo.active = true;
}, },
create: function(vid, callback) { create: function(m, callback) {
trace("VIMEO CREATE"); trace("VIMEO CREATE");
// THUMBNAIL // THUMBNAIL
var the_url = "http://vimeo.com/api/v2/video/" + vid.mid + ".json"; var thumb_url = "http://vimeo.com/api/v2/video/" + m.id + ".json",
VMM.getJSON(the_url, function(d) { video_url = "http://player.vimeo.com/video/" + m.id + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff";
VMM.ExternalAPI.vimeo.createThumb(d, vid);
VMM.getJSON(thumb_url, function(d) {
VMM.ExternalAPI.vimeo.createThumb(d, m);
callback(); callback();
}); });
// VIDEO
VMM.attachElement("#" + m.uid, "<iframe autostart='false' frameborder='0' width='100%' height='100%' src='" + video_url + "'></iframe>");
}, },
createThumb: function(d, vid) { createThumb: function(d, m) {
trace("VIMEO CREATE THUMB"); trace("VIMEO CREATE THUMB");
var thumb_id = "#" + vid.id + "_thumb"; var thumb_id = "#" + m.uid + "_thumb";
VMM.attachElement(thumb_id, "<img src='" + d[0].thumbnail_small + "'>"); VMM.attachElement(thumb_id, "<img src='" + d[0].thumbnail_small + "'>");
}, },
@ -4022,14 +4023,51 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
VMM.ExternalAPI.vimeo.create(VMM.master_config.vimeo.que[0], VMM.ExternalAPI.vimeo.pushQue); VMM.ExternalAPI.vimeo.create(VMM.master_config.vimeo.que[0], VMM.ExternalAPI.vimeo.pushQue);
VMM.master_config.vimeo.que.remove(0); VMM.master_config.vimeo.que.remove(0);
} }
/*
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 = [];
*/ },
webthumb: {
get: function(m, thumb) {
VMM.master_config.webthumb.que.push(m);
VMM.master_config.webthumb.active = true;
},
sizes: function(s) {
var _size = "";
if (s <= 150) {
_size = "t";
} else if (s <= 306) {
_size = "m";
} else {
_size = "l";
} }
return _size;
},
create: function(m) {
trace("WEB THUMB CREATE");
//http://pagepeeker.com/t/{size}/{url}
//http://api.snapito.com/free/lc?url=
var thumb_url = "http://pagepeeker.com/t/";
url = m.id.replace("http://", "");//.split("/")[0];
// Main Image
VMM.attachElement("#" + m.uid, "<a href='" + m.id + "' target='_blank'><img src='" + thumb_url + "x/" + url + "'></a>");
// Thumb
VMM.attachElement("#" + m.uid + "_thumb", "<a href='" + m.id + "' target='_blank'><img src='" + thumb_url + "t/" + url + "'></a>");
},
pushQue: function() {
for(var i = 0; i < VMM.master_config.webthumb.que.length; i++) {
VMM.ExternalAPI.webthumb.create(VMM.master_config.webthumb.que[i]);
}
VMM.master_config.webthumb.que = [];
}
} }
}).init(); }).init();
@ -4135,7 +4173,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
} }
return mediaElem; return mediaElem;
} else if (m.type == "website") { } else if (m.type == "website") {
mediaElem = "<div class='thumbnail thumb-website'></div>"; mediaElem = "<div class='thumbnail thumb-website' id='" + uid + "_thumb'></div>";
return mediaElem; return mediaElem;
} else { } else {
mediaElem = "<div class='thumbnail thumb-plaintext'></div>"; mediaElem = "<div class='thumbnail thumb-plaintext'></div>";
@ -4177,7 +4215,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
VMM.ExternalAPI.flickr.get(m); VMM.ExternalAPI.flickr.get(m);
// INSTAGRAM // INSTAGRAM
} else if (m.type == "instagram") { } else if (m.type == "instagram") {
mediaElem = "<div class='media-image media-shadow'><a href='" + m.link + "' target='_blank'><img src='" + VMM.ExternalAPI.instagram.get(m.id) + "'></a></div>"; mediaElem = "<div class='media-image media-shadow'><a href='" + m.link + "' target='_blank'><img src='" + VMM.ExternalAPI.instagram.get(m) + "'></a></div>";
//VMM.ExternalAPI.instagram.get(m.id, uid); //VMM.ExternalAPI.instagram.get(m.id, uid);
// GOOGLE DOCS // GOOGLE DOCS
} else if (m.type == "googledoc") { } else if (m.type == "googledoc") {
@ -4189,7 +4227,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
VMM.ExternalAPI.youtube.get(m); VMM.ExternalAPI.youtube.get(m);
// VIMEO // VIMEO
} else if (m.type == "vimeo") { } else if (m.type == "vimeo") {
mediaElem = "<div class='media-shadow'><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></div>"; mediaElem = "<div class='media-shadow media-frame video vimeo' id='" + m.uid + "'>" + loading_messege + "</div>";
VMM.ExternalAPI.vimeo.get(m); VMM.ExternalAPI.vimeo.get(m);
// DAILYMOTION // DAILYMOTION
} else if (m.type == "dailymotion") { } else if (m.type == "dailymotion") {
@ -4237,10 +4275,10 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
mediaElem = "<div class='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 = "<div class='media-shadow'><iframe class='media-frame website' frameborder='0' autostart='false' width='100%' height='100%' scrolling='yes' marginheight='0' marginwidth='0' src='" + m.id + "'></iframe></div>";
//mediaElem = "<a href='" + m.id + "' target='_blank'>" + "<img src='http://api.snapito.com/free/lc?url=" + m.id + "'></a>";
mediaElem = "<div class='media-shadow website'><a href='" + m.id + "' target='_blank'>" + "<img src='http://api1.thumbalizr.com/?url=" + m.id.replace(/[\./]$/g, "") + "&width=300' class='media-image'></a></div>"; mediaElem = "<div class='media-shadow website' id='" + m.uid + "'>" + loading_messege + "</div>";
VMM.ExternalAPI.webthumb.get(m);
//mediaElem = "<div class='media-shadow website'><a href='" + m.id + "' target='_blank'>" + "<img src='http://api1.thumbalizr.com/?url=" + m.id.replace(/[\./]$/g, "") + "&width=300' class='media-image'></a></div>";
// NO MATCH // NO MATCH
} else { } else {

2
source/js/Core

@ -1 +1 @@
Subproject commit 531037c323bf71a0eaf3567606ccb55f3023d64b Subproject commit a3555656b3a648af2a1122283c9bfc119709fbe0
Loading…
Cancel
Save