/* MediaElement ================================================== */ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') { VMM.MediaElement = ({ init: function() { return this; }, thumbnail: function(data, w, h) { _w = 16; _h = 24; if (w != null && w != "") {_w = w}; if (h != null && h != "") {_h = h}; if (data.media != null && data.media != "") { _valid = true; var mediaElem = ""; var m = VMM.MediaType(data.media); //returns an object with .type and .id // CREATE MEDIA CODE if (m.type == "image") { //mediaElem = "
"; mediaElem = "
"; return mediaElem; } else if (m.type == "flickr") { mediaElem = "
"; return mediaElem; } else if (m.type == "instagram") { mediaElem = "
"; return mediaElem; } else if (m.type == "youtube") { mediaElem = "
"; return mediaElem; } else if (m.type == "googledoc") { mediaElem = "
"; return mediaElem; } else if (m.type == "vimeo") { mediaElem = "
"; return mediaElem; } else if (m.type == "dailymotion") { mediaElem = "
"; return mediaElem; } else if (m.type == "twitter"){ mediaElem = "
"; return mediaElem; } else if (m.type == "twitter-ready") { mediaElem = "
"; return mediaElem; } else if (m.type == "soundcloud") { mediaElem = "
"; return mediaElem; } else if (m.type == "google-map") { mediaElem = "
"; return mediaElem; } else if (m.type == "wikipedia") { mediaElem = "
"; return mediaElem; } else if (m.type == "storify") { mediaElem = "
"; return mediaElem; } else if (m.type == "quote") { mediaElem = "
"; return mediaElem; } else if (m.type == "unknown") { if (m.id.match("blockquote")) { mediaElem = "
"; } else { mediaElem = "
"; } return mediaElem; } else if (m.type == "website") { mediaElem = "
"; //mediaElem = "
"; return mediaElem; } else { mediaElem = "
"; return mediaElem; } } }, create: function(data, secondary) { //$mediacontainer = element; var _valid = false; if (data.media != null && data.media != "") { var mediaElem = "", captionElem = "", creditElem = "", _id = "", isTextMedia = false; var m = VMM.MediaType(data.media); //returns an object with .type and .id _valid = true; // CREDIT if (data.credit != null && data.credit != "") { creditElem = "
" + VMM.Util.linkify_with_twitter(data.credit, "_blank") + "
"; } // CAPTION if (data.caption != null && data.caption != "") { captionElem = "
" + VMM.Util.linkify_with_twitter(data.caption, "_blank") + "
"; } // IMAGE if (m.type == "image") { mediaElem = "
"; // FLICKR } else if (m.type == "flickr") { _id = "flickr_" + m.id; mediaElem = "
"; VMM.ExternalAPI.flickr.get(m.id, "#" + _id); // INSTAGRAM } else if (m.type == "instagram") { _id = "flickr_" + m.id; mediaElem = "
"; // GOOGLE DOCS } else if (m.type == "googledoc") { _id = "googledoc_" + VMM.Util.unique_ID(5); mediaElem = "

Loading Document

"; VMM.ExternalAPI.googledocs.get(m.id, _id); // YOUTUBE } else if (m.type == "youtube") { mediaElem = "

Loading YouTube video

"; VMM.ExternalAPI.youtube.get(m.id); // VIMEO } else if (m.type == "vimeo") { mediaElem = "
"; VMM.ExternalAPI.vimeo.get(m.id); // DAILYMOTION } else if (m.type == "dailymotion") { mediaElem = "
"; // TWITTER } else if (m.type == "twitter"){ mediaElem = "

Loading Tweet

"; isTextMedia = true; VMM.ExternalAPI.twitter.prettyHTML(m.id, secondary); // TWITTER } else if (m.type == "twitter-ready") { isTextMedia = true; mediaElem = m.id; // SOUNDCLOUD } else if (m.type == "soundcloud") { _id = "soundcloud_" + VMM.Util.unique_ID(5); mediaElem = "

Loading Sound

"; VMM.ExternalAPI.soundcloud.get(m.id, _id); // GOOGLE MAPS } else if (m.type == "google-map") { _id = "googlemap_" + VMM.Util.unique_ID(7); mediaElem = "

Loading Map

"; VMM.ExternalAPI.googlemaps.get(m.id, _id); // WIKIPEDIA } else if (m.type == "wikipedia") { _id = "wikipedia_" + VMM.Util.unique_ID(7); mediaElem = "

Loading Wikipedia

"; isTextMedia = true; VMM.ExternalAPI.wikipedia.get(m.id, _id); // STORIFY } else if (m.type == "storify") { isTextMedia = true; mediaElem = "
" + m.id + "
"; // QUOTE } else if (m.type == "quote") { isTextMedia = true; mediaElem = "
" + m.id + "
"; // UNKNOWN } else if (m.type == "unknown") { trace("NO KNOWN MEDIA TYPE FOUND TRYING TO JUST PLACE THE HTML"); isTextMedia = true; mediaElem = "
" + VMM.Util.properQuotes(m.id) + "
"; // WEBSITE } else if (m.type == "website") { //mediaElem = "
"; //mediaElem = "" + ""; mediaElem = "
" + "
"; // NO MATCH } else { trace("NO KNOWN MEDIA TYPE FOUND"); trace(m.type); } // WRAP THE MEDIA ELEMENT mediaElem = "
" + mediaElem + creditElem + captionElem + "
"; // RETURN if (isTextMedia) { return "
" + mediaElem + "
"; } else { return "
" + mediaElem + "
"; } }; } }).init(); }