/*! TimelineJS Version 1.65 Designed and built by Zach Wise at VéritéCo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. http://www.gnu.org/licenses/ */ /*********************************************** Begin VMM.js ***********************************************/ /* VéritéCo JS Master Version: 0.6 Date: June 19, 2012 Copyright 2012 VéritéCo unless part of TimelineJS, if part of TimelineJS then it inherits TimelineJS's license. Designed and built by Zach Wise digitalartwork.net ================================================== */ /* Simple JavaScript Inheritance By John Resig http://ejohn.org/ MIT Licensed. ================================================== */ (function() { var initializing = false, fnTest = /xyz/.test(function() { xyz; }) ? /\b_super\b/: /.*/; // The base Class implementation (does nothing) this.Class = function() {}; // Create a new Class that inherits from this class Class.extend = function(prop) { var _super = this.prototype; // Instantiate a base class (but only create the instance, // don't run the init constructor) initializing = true; var prototype = new this(); initializing = false; // Copy the properties over onto the new prototype for (var name in prop) { // Check if we're overwriting an existing function prototype[name] = typeof prop[name] == "function" && typeof _super[name] == "function" && fnTest.test(prop[name]) ? (function(name, fn) { return function() { var tmp = this._super; // Add a new ._super() method that is the same method // but on the super-class this._super = _super[name]; // The method only need to be bound temporarily, so we // remove it when we're done executing var ret = fn.apply(this, arguments); this._super = tmp; return ret; }; })(name, prop[name]) : prop[name]; } // The dummy class constructor function Class() { // All construction is actually done in the init method if (!initializing && this.init) this.init.apply(this, arguments); } // Populate our constructed prototype object Class.prototype = prototype; // Enforce the constructor to be what we expect Class.prototype.constructor = Class; // And make this class extendable Class.extend = arguments.callee; return Class; }; })(); /* Access to the Global Object access the global object without hard-coding the identifier window ================================================== */ var global = (function () { return this || (1,eval)('this'); }()); /* VMM ================================================== */ if (typeof VMM == 'undefined') { /* Main Scope Container ================================================== */ //var VMM = {}; var VMM = Class.extend({}); /* Debug ================================================== */ VMM.debug = true; /* Master Config ================================================== */ VMM.master_config = ({ init: function() { return this; }, sizes: { api: { width: 0, height: 0 } }, vp: "Pellentesque nibh felis, eleifend id, commodo in, interdum vitae, leo", api_keys_master: { flickr: "RAIvxHY4hE/Elm5cieh4X5ptMyDpj7MYIxziGxi0WGCcy1s+yr7rKQ==", google: "jwNGnYw4hE9lmAez4ll0QD+jo6SKBJFknkopLS4FrSAuGfIwyj57AusuR0s8dAo=", twitter: "" }, timers: { api: 7000 }, api: { pushques: [] }, twitter: { active: false, array: [], api_loaded: false, que: [] }, flickr: { active: false, array: [], api_loaded: false, que: [] }, youtube: { active: false, array: [], api_loaded: false, que: [] }, vimeo: { active: false, array: [], api_loaded: false, que: [] }, googlemaps: { active: false, map_active: false, places_active: false, array: [], api_loaded: false, que: [] }, googledocs: { active: false, array: [], api_loaded: false, que: [] }, googleplus: { active: false, array: [], api_loaded: false, que: [] }, wikipedia: { active: false, array: [], api_loaded: false, que: [], tries: 0 }, soundcloud: { active: false, array: [], api_loaded: false, que: [] } }).init(); //VMM.createElement(tag, value, cName, attrs, styles); VMM.createElement = function(tag, value, cName, attrs, styles) { var ce = ""; if (tag != null && tag != "") { // TAG ce += "<" + tag; if (cName != null && cName != "") { ce += " class='" + cName + "'"; }; if (attrs != null && attrs != "") { ce += " " + attrs; }; if (styles != null && styles != "") { ce += " style='" + styles + "'"; }; ce += ">"; if (value != null && value != "") { ce += value; } // CLOSE TAG ce = ce + "" + tag + ">"; } return ce; }; VMM.createMediaElement = function(media, caption, credit) { var ce = ""; var _valid = false; ce += "
"; // TWEET MEDIA if (typeof d.entities.media != 'undefined') { if (d.entities.media[0].type == "photo") { //twit += "" } } // TWEET AUTHOR twit += " "; VMM.attachElement("#"+tweet.id.toString(), twit ); VMM.attachElement("#text_thumb_"+tweet.id.toString(), d.text ); }) .error(function(jqXHR, textStatus, errorThrown) { trace("TWITTER error"); trace("TWITTER ERROR: " + textStatus + " " + jqXHR.responseText); VMM.attachElement("#"+tweet.id, VMM.MediaElement.loadingmessage("ERROR LOADING TWEET " + tweet.mid) ); }) .success(function(d) { clearTimeout(twitter_timeout); clearTimeout(callback_timeout); callback(); }); }, errorTimeOut: function(tweet) { trace("TWITTER JSON ERROR TIMEOUT " + tweet.mid); VMM.attachElement("#"+tweet.id.toString(), VMM.MediaElement.loadingmessage("Still waiting on Twitter: " + tweet.mid) ); // CHECK RATE STATUS VMM.getJSON("http://api.twitter.com/1/account/rate_limit_status.json", function(d) { trace("REMAINING TWITTER API CALLS " + d.remaining_hits); trace("TWITTER RATE LIMIT WILL RESET AT " + d.reset_time); var mes = ""; if (d.remaining_hits == 0) { mes = "", td = VMM.Util.linkify_with_twitter(d.text, "_blank"); // TWEET CONTENT twit += td; twit += "
You've reached the maximum number of tweets you can load in an hour.
"; mes += "You can view tweets again starting at:
" + d.reset_time + "
Still waiting on Twitter. " + tweet.mid + "
"; //mes = "Tweet " + id + " was not found.
"; } VMM.attachElement("#"+tweet.id.toString(), VMM.MediaElement.loadingmessage(mes) ); }); }, pushQue: function() { if (VMM.master_config.twitter.que.length > 0) { VMM.ExternalAPI.twitter.create(VMM.master_config.twitter.que[0], VMM.ExternalAPI.twitter.pushQue); VMM.master_config.twitter.que.remove(0); } }, getHTML: function(id) { //var the_url = document.location.protocol + "//api.twitter.com/1/statuses/oembed.json?id=" + id+ "&callback=?"; var the_url = "http://api.twitter.com/1/statuses/oembed.json?id=" + id+ "&callback=?"; VMM.getJSON(the_url, VMM.ExternalAPI.twitter.onJSONLoaded); }, onJSONLoaded: function(d) { trace("TWITTER JSON LOADED"); var id = d.id; VMM.attachElement("#"+id, VMM.Util.linkify_with_twitter(d.html) ); }, parseTwitterDate: function(d) { var date = new Date(Date.parse(d)); /* var t = d.replace(/(\d{1,2}[:]\d{2}[:]\d{2}) (.*)/, '$2 $1'); t = t.replace(/(\+\S+) (.*)/, '$2 $1'); var date = new Date(Date.parse(t)).toLocaleDateString(); var time = new Date(Date.parse(t)).toLocaleTimeString(); */ return date; }, prettyParseTwitterDate: function(d) { var date = new Date(Date.parse(d)); return VMM.Date.prettyDate(date, true); }, getTweets: function(tweets) { var tweetArray = []; var number_of_tweets = tweets.length; for(var i = 0; i < tweets.length; i++) { var twitter_id = ""; /* FIND THE TWITTER ID ================================================== */ if (tweets[i].tweet.match("status\/")) { twitter_id = tweets[i].tweet.split("status\/")[1]; } else if (tweets[i].tweet.match("statuses\/")) { twitter_id = tweets[i].tweet.split("statuses\/")[1]; } else { twitter_id = ""; } /* FETCH THE DATA ================================================== */ var the_url = "http://api.twitter.com/1/statuses/show.json?id=" + twitter_id + "&include_entities=true&callback=?"; VMM.getJSON(the_url, function(d) { var tweet = {} /* FORMAT RESPONSE ================================================== */ var twit = ""; var td = VMM.Util.linkify_with_twitter(d.text, "_blank"); twit += td; twit += "
"; twit += "— " + d.user.name + " (@" + d.user.screen_name + ") " + VMM.ExternalAPI.twitter.prettyParseTwitterDate(d.created_at) + "
"; var td = VMM.Util.linkify_with_twitter(d.results[i].text, "_blank"); twit += td; twit += "
"; twit += "— " + d.results[i].from_user_name + " (@" + d.results[i].from_user + ") " + VMM.ExternalAPI.twitter.prettyParseTwitterDate(d.results[i].created_at) + "
ERROR LOADING TWEET " + id + "
" ); }) .success(function(d) { clearTimeout(twitter_timeout); if (secondary) { VMM.ExternalAPI.twitter.secondaryMedia(d); } }); }, formatJSON: function(d) { var id = d.id_str; var twit = ""; //twit += " " + "" + " "; twit += " "; if (typeof d.entities.media != 'undefined') { if (d.entities.media[0].type == "photo") { twit += "" } } VMM.attachElement("#twitter_"+id.toString(), twit ); VMM.attachElement("#text_thumb_"+id.toString(), d.text ); } }, googlemaps: { get: function(url, id) { var timer, api_key, map_vars; map_vars = VMM.Util.getUrlVars(url); if (VMM.master_config.Timeline.api_keys.google != "") { api_key = VMM.master_config.Timeline.api_keys.google; } else { api_key = Aes.Ctr.decrypt(VMM.master_config.api_keys_master.google, VMM.master_config.vp, 256); } var map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady"; var map = { url: url, vars: map_vars, id: id }; if (VMM.master_config.googlemaps.active) { VMM.master_config.googlemaps.que.push(map); } else { VMM.master_config.googlemaps.que.push(map); if (VMM.master_config.googlemaps.api_loaded) { } else { VMM.LoadLib.js(map_url, function() { trace("Google Maps API Library Loaded"); }); } } }, create: function(m) { var map_attribution = ""; var layer; var map; function mapProvider(name) { if (name in VMM.ExternalAPI.googlemaps.map_providers) { map_attribution = VMM.ExternalAPI.googlemaps.map_attribution[VMM.ExternalAPI.googlemaps.map_providers[name].attribution]; return VMM.ExternalAPI.googlemaps.map_providers[name]; } else { if (VMM.ExternalAPI.googlemaps.defaultType(name)) { trace("GOOGLE MAP DEFAULT TYPE"); return google.maps.MapTypeId[name.toUpperCase()]; } else { trace("Not a maptype: " + name ); } } } google.maps.VeriteMapType = function(name) { if (VMM.ExternalAPI.googlemaps.defaultType(name)) { return google.maps.MapTypeId[name.toUpperCase()]; } else { var provider = mapProvider(name); return google.maps.ImageMapType.call(this, { "getTileUrl": function(coord, zoom) { var index = (zoom + coord.x + coord.y) % VMM.ExternalAPI.googlemaps.map_subdomains.length; return [ provider.url .replace("{S}", VMM.ExternalAPI.googlemaps.map_subdomains[index]) .replace("{Z}", zoom) .replace("{X}", coord.x) .replace("{Y}", coord.y) .replace("{z}", zoom) .replace("{x}", coord.x) .replace("{y}", coord.y) ]; }, "tileSize": new google.maps.Size(256, 256), "name": name, "minZoom": provider.minZoom, "maxZoom": provider.maxZoom }); } }; google.maps.VeriteMapType.prototype = new google.maps.ImageMapType("_"); /* Make the Map ================================================== */ if (type.of(VMM.master_config.Timeline.maptype) == "string") { if (VMM.ExternalAPI.googlemaps.defaultType(VMM.master_config.Timeline.maptype)) { layer = google.maps.MapTypeId[VMM.master_config.Timeline.maptype.toUpperCase()]; } else { layer = VMM.master_config.Timeline.maptype; } } else { layer = "toner"; } var location = new google.maps.LatLng(41.875696,-87.624207); var latlong; var zoom = 11; var has_location = false; var has_zoom = false; var map_bounds; if (type.of(VMM.Util.getUrlVars(m.url)["ll"]) == "string") { has_location = true; latlong = VMM.Util.getUrlVars(m.url)["ll"].split(","); location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1])); } else if (type.of(VMM.Util.getUrlVars(m.url)["sll"]) == "string") { latlong = VMM.Util.getUrlVars(m.url)["sll"].split(","); location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1])); } if (type.of(VMM.Util.getUrlVars(m.url)["z"]) == "string") { has_zoom = true; zoom = parseFloat(VMM.Util.getUrlVars(m.url)["z"]); } var map_options = { zoom: zoom, disableDefaultUI: true, mapTypeControl: false, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL, position: google.maps.ControlPosition.TOP_RIGHT }, center: location, mapTypeId: layer, mapTypeControlOptions: { mapTypeIds: [layer] } } var unique_map_id = m.id.toString() + "_gmap"; VMM.attachElement("#" + m.id, ""); var map = new google.maps.Map(document.getElementById(unique_map_id), map_options); if (VMM.ExternalAPI.googlemaps.defaultType(VMM.master_config.Timeline.maptype)) { } else { map.mapTypes.set(layer, new google.maps.VeriteMapType(layer)); // ATTRIBUTION var map_attribution_html = ""; var td = VMM.Util.linkify_with_twitter(d.text, "_blank"); //td = td.replace(/(@([\w]+))/g,"$1"); //td = td.replace(/(#([\w]+))/g,"$1"); twit += td; twit += "
" + a_data.object.attachments[k].content + "
"; g_attachments += ""; g_attachments += "" + a_data.object.attachments[k].content + "
"; g_attachments += ""; g_attachments += "ERROR LOADING GOOGLE+
" + error_obj.error.message + "
")); }) .success(function(d) { clearTimeout(googleplus_timeout); clearTimeout(callback_timeout); callback(); }); }, pushQue: function() { if (VMM.master_config.googleplus.que.length > 0) { VMM.ExternalAPI.googleplus.create(VMM.master_config.googleplus.que[0], VMM.ExternalAPI.googleplus.pushQue); VMM.master_config.googleplus.que.remove(0); } /* for(var i = 0; i < VMM.master_config.googleplus.que.length; i++) { VMM.ExternalAPI.googleplus.create(VMM.master_config.googleplus.que[i]); } VMM.master_config.googleplus.que = []; */ }, errorTimeOut: function(gplus) { trace("GOOGLE+ JSON ERROR TIMEOUT " + gplus.activity); VMM.attachElement("#googleplus_" + gplus.activity, VMM.MediaElement.loadingmessage("Still waiting on GOOGLE+
" + gplus.activity + "
")); } }, googledocs: { get: function(url, id) { var doc = {url: url, id: id}; VMM.master_config.googledocs.que.push(doc); VMM.master_config.googledocs.active = true; }, create: function(doc) { var mediaElem = ""; if (doc.url.match(/docs.google.com/i)) { mediaElem = ""; } else { mediaElem = ""; } VMM.attachElement("#"+doc.id, mediaElem); }, pushQue: function() { for(var i = 0; i < VMM.master_config.googledocs.que.length; i++) { VMM.ExternalAPI.googledocs.create(VMM.master_config.googledocs.que[i]); } VMM.master_config.googledocs.que = []; } }, flickr: { get: function(mid, id, link) { var flick = {mid: mid, id: id, link:link}; VMM.master_config.flickr.que.push(flick); VMM.master_config.flickr.active = true; }, create: function(flick, callback) { var api_key, callback_timeout= setTimeout(callback, VMM.master_config.timers.api, flick); if (VMM.master_config.Timeline.api_keys.flickr != "") { api_key = VMM.master_config.Timeline.api_keys.flickr; } else { 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=?"; VMM.getJSON(the_url, function(d) { var flickr_id = d.sizes.size[0].url.split("photos\/")[1].split("/")[1]; var flickr_large_id = "#" + flick.id, flickr_thumb_id = "#" + flick.id + "_thumb"; //flickr_thumb_id = "flickr_" + uid + "_thumb"; var flickr_img_size, flickr_img_thumb, flickr_size_found = false, flickr_best_size = "Large"; flickr_best_size = VMM.ExternalAPI.flickr.sizes(VMM.master_config.sizes.api.height); for(var i = 0; i < d.sizes.size.length; i++) { if (d.sizes.size[i].label == flickr_best_size) { flickr_size_found = true; flickr_img_size = d.sizes.size[i].source; } } if (!flickr_size_found) { flickr_img_size = d.sizes.size[d.sizes.size.length - 1].source; } flickr_img_thumb = d.sizes.size[0].source; VMM.Lib.attr(flickr_large_id, "src", flickr_img_size); //VMM.attachElement(flickr_large_id, ""); VMM.attachElement(flickr_thumb_id, ""); }) .error(function(jqXHR, textStatus, errorThrown) { trace("FLICKR error"); trace("FLICKR ERROR: " + textStatus + " " + jqXHR.responseText); }) .success(function(d) { clearTimeout(callback_timeout); callback(); }); }, pushQue: function() { if (VMM.master_config.flickr.que.length > 0) { VMM.ExternalAPI.flickr.create(VMM.master_config.flickr.que[0], VMM.ExternalAPI.flickr.pushQue); VMM.master_config.flickr.que.remove(0); } }, sizes: function(s) { var _size = ""; if (s <= 75) { _size = "Thumbnail"; } else if (s <= 180) { _size = "Small"; } else if (s <= 240) { _size = "Small 320"; } else if (s <= 375) { _size = "Medium"; } else if (s <= 480) { _size = "Medium 640"; } else if (s <= 600) { _size = "Medium 800"; } else { _size = "Large"; } return _size; } }, instagram: { get: function(mid, thumb) { if (thumb) { return "http://instagr.am/p/" + mid + "/media/?size=t"; } else { return "http://instagr.am/p/" + mid + "/media/?size=" + VMM.ExternalAPI.instagram.sizes(VMM.master_config.sizes.api.height); } }, sizes: function(s) { var _size = ""; if (s <= 150) { _size = "t"; } else if (s <= 306) { _size = "m"; } else { _size = "l"; } return _size; } }, soundcloud: { get: function(mid, id) { var sound = {mid: mid, id: id}; VMM.master_config.soundcloud.que.push(sound); VMM.master_config.soundcloud.active = true; }, create: function(sound, callback) { var the_url = "http://soundcloud.com/oembed?url=" + sound.mid + "&format=js&callback=?"; VMM.getJSON(the_url, function(d) { VMM.attachElement("#"+sound.id, d.html); callback(); }); }, pushQue: function() { if (VMM.master_config.soundcloud.que.length > 0) { VMM.ExternalAPI.soundcloud.create(VMM.master_config.soundcloud.que[0], VMM.ExternalAPI.soundcloud.pushQue); VMM.master_config.soundcloud.que.remove(0); } } }, wikipedia: { get: function(url, id, lang) { var api_obj = {url: url, id: id, lang: lang}; VMM.master_config.wikipedia.que.push(api_obj); VMM.master_config.wikipedia.active = true; }, create: function(api_obj, 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=?"; callback_timeout= setTimeout(callback, VMM.master_config.timers.api, api_obj); if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.Browser.version, 10) >= 7 && window.XDomainRequest) { var temp_text = "Wikipedia entry unable to load using Internet Explorer 8 or below.
"; VMM.attachElement("#"+api_obj.id, temp_text ); } VMM.getJSON(the_url, function(d) { if (d.query) { var wiki_extract, wiki_title, _wiki = "", wiki_text = "", wiki_number_of_paragraphs = 1, wiki_text_array = []; wiki_extract = VMM.Util.getObjectAttributeByIndex(d.query.pages, 0).extract; wiki_title = VMM.Util.getObjectAttributeByIndex(d.query.pages, 0).title; if (wiki_extract.match("")) { wiki_text_array = wiki_extract.split("
"); } else { wiki_text_array.push(wiki_extract); } for(var i = 0; i < wiki_text_array.length; i++) { if (i+1 <= wiki_number_of_paragraphs && i+1 < wiki_text_array.length) { wiki_text += "
" + wiki_text_array[i+1]; } } _wiki = "
Wikipedia is not responding
")); // TRY AGAIN? clearTimeout(callback_timeout); if (VMM.master_config.wikipedia.tries < 4) { trace("WIKIPEDIA ATTEMPT " + VMM.master_config.wikipedia.tries); trace(api_obj); VMM.master_config.wikipedia.tries++; VMM.ExternalAPI.wikipedia.create(api_obj, callback); } else { callback(); } }) .success(function(d) { VMM.master_config.wikipedia.tries = 0; clearTimeout(callback_timeout); callback(); }); }, pushQue: function() { if (VMM.master_config.wikipedia.que.length > 0) { trace("WIKIPEDIA PUSH QUE " + VMM.master_config.wikipedia.que.length); VMM.ExternalAPI.wikipedia.create(VMM.master_config.wikipedia.que[0], VMM.ExternalAPI.wikipedia.pushQue); VMM.master_config.wikipedia.que.remove(0); } } }, youtube: { get: function(mid, id, start) { var the_url = "http://gdata.youtube.com/feeds/api/videos/" + mid + "?v=2&alt=jsonc&callback=?", vid = {mid: mid, id: id, start: start}; VMM.master_config.youtube.que.push(vid); if (!VMM.master_config.youtube.active) { if (!VMM.master_config.youtube.api_loaded) { VMM.LoadLib.js('http://www.youtube.com/player_api', function() { trace("YouTube API Library Loaded"); }); } } // THUMBNAIL VMM.getJSON(the_url, function(d) { VMM.ExternalAPI.youtube.createThumb(d, vid) }); }, create: function(vid) { if (typeof(vid.start) != 'undefined') { var vidstart = vid.start.toString(), vid_start_minutes = 0, vid_start_seconds = 0; if (vidstart.match('m')) { vidstart = vidstart.split("=")[1]; vid_start_minutes = parseInt(vidstart.split("m")[0], 10); vid_start_seconds = parseInt(vidstart.split("m")[1].split("s")[0], 10); vid.start = (vid_start_minutes * 60) + vid_start_seconds; } else { vid.start = 0; } } else { vid.start = 0; } var p = { active: false, player: {}, name: vid.id, playing: false }; p.player[vid.id] = new YT.Player(vid.id, { height: '390', width: '640', playerVars: { enablejsapi: 1, color: 'white', showinfo: 0, theme: 'light', start: vid.start, rel: 0 }, videoId: vid.mid, events: { 'onReady': VMM.ExternalAPI.youtube.onPlayerReady, 'onStateChange': VMM.ExternalAPI.youtube.onStateChange } }); VMM.master_config.youtube.array.push(p); }, createThumb: function(d, vid) { trace("CREATE THUMB"); trace(d); trace(vid); if (typeof d.data != 'undefined') { var thumb_id = "#" + vid.id + "_thumb"; VMM.attachElement(thumb_id, ""); } }, pushQue: function() { for(var i = 0; i < VMM.master_config.youtube.que.length; i++) { VMM.ExternalAPI.youtube.create(VMM.master_config.youtube.que[i]); } VMM.master_config.youtube.que = []; }, onAPIReady: function() { VMM.master_config.youtube.active = true; VMM.ExternalAPI.youtube.pushQue(); }, stopPlayers: function() { for(var i = 0; i < VMM.master_config.youtube.array.length; i++) { if (VMM.master_config.youtube.array[i].playing) { var the_name = VMM.master_config.youtube.array[i].name; VMM.master_config.youtube.array[i].player[the_name].stopVideo(); } } }, onStateChange: function(e) { for(var i = 0; i < VMM.master_config.youtube.array.length; i++) { var the_name = VMM.master_config.youtube.array[i].name; if (VMM.master_config.youtube.array[i].player[the_name] == e.target) { if (e.data == YT.PlayerState.PLAYING) { VMM.master_config.youtube.array[i].playing = true; } } } }, onPlayerReady: function(e) { } }, vimeo: { get: function(mid, id) { var vid = {mid: mid, id: id}; VMM.master_config.vimeo.que.push(vid); VMM.master_config.vimeo.active = true; }, create: function(vid, callback) { trace("VIMEO CREATE"); // THUMBNAIL var the_url = "http://vimeo.com/api/v2/video/" + vid.mid + ".json"; VMM.getJSON(the_url, function(d) { VMM.ExternalAPI.vimeo.createThumb(d, vid); callback(); }); }, createThumb: function(d, vid) { trace("VIMEO CREATE THUMB"); var thumb_id = "#" + vid.id + "_thumb"; VMM.attachElement(thumb_id, ""); }, pushQue: function() { if (VMM.master_config.vimeo.que.length > 0) { VMM.ExternalAPI.vimeo.create(VMM.master_config.vimeo.que[0], VMM.ExternalAPI.vimeo.pushQue); 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 = []; */ } } } } /* YOUTUBE API READY Can't find a way to customize this callback and keep it in the VMM namespace Youtube wants it to be this function. ================================================== */ function onYouTubePlayerAPIReady() { trace("GLOBAL YOUTUBE API CALLED") VMM.ExternalAPI.youtube.onAPIReady(); } /*********************************************** Begin VMM.MediaElement.js ***********************************************/ /* MediaElement ================================================== */ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') { VMM.MediaElement = ({ init: function() { return this; }, loadingmessage: function(m) { return "" + VMM.master_config.language.messages.loading + "
"; loading_messege = VMM.MediaElement.loadingmessage(VMM.master_config.language.messages.loading + "..."); if (data.media != null && data.media != "") { var mediaElem = "", captionElem = "", creditElem = "", _id = "", isTextMedia = false, m; m = VMM.MediaType(data.media); //returns an object with .type and .id _valid = true; // CREDIT if (data.credit != null && data.credit != "") { creditElem = "