/* MediaElement
================================================== */
if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
VMM.MediaElement = ({
init: function() {
return this;
},
thumbnail: function(data, w, h) {
_w = 32;
_h = 32;
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 = "
";
return mediaElem;
} else if (m.type == "flickr") {
mediaElem = "";
return mediaElem;
} else if (m.type == "youtube") {
mediaElem = "";
return mediaElem;
} else if (m.type == "googledoc") {
mediaElem = "";
} else if (m.type == "vimeo") {
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 == "unknown") {
mediaElem = "";
return mediaElem;
} else if (m.type == "website") {
mediaElem = "";
//mediaElem = "";
return mediaElem;
} else {
mediaElem = "";
return mediaElem;
}
}
},
create: function(data) {
//$mediacontainer = element;
var _valid = false;
if (data.media != null && data.media != "") {
var mediaElem = "";
var captionElem = "";
var creditElem = "";
var m = VMM.MediaType(data.media); //returns an object with .type and .id
var isTextMedia = false;
_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") {
var flickr_id = "flickr_" + m.id;
mediaElem = "";
VMM.ExternalAPI.flickr.get(m.id, "#" + flickr_id);
// GOOGLE DOCS
} else if (m.type == "googledoc") {
var googledocs_id = "googledoc_" + VMM.Util.unique_ID(5);
mediaElem = "Loading Document
";
VMM.ExternalAPI.googledocs.get(m.id, googledocs_id);
// YOUTUBE
} else if (m.type == "youtube") {
mediaElem = "Loading YouTube video...
";
VMM.ExternalAPI.youtube.get(m.id);
// VIMEO
} else if (m.type == "vimeo") {
mediaElem = "";
// TWITTER
} else if (m.type == "twitter"){
mediaElem = "";
isTextMedia = true;
VMM.ExternalAPI.twitter.prettyHTML(m.id);
// TWITTER
} else if (m.type == "twitter-ready") {
mediaElem = m.id;
// SOUNDCLOUD
} else if (m.type == "soundcloud") {
var soundcloud_id = "soundcloud_" + VMM.Util.unique_ID(5);
mediaElem = "Loading Sound
";
VMM.ExternalAPI.soundcloud.get(m.id, soundcloud_id);
// GOOGLE MAPS
} else if (m.type == "google-map") {
var map_id = "googlemap_" + VMM.Util.unique_ID(7);
mediaElem = "Loading Map
";
VMM.ExternalAPI.googlemaps.get(m.id, map_id);
// UNKNOWN
} else if (m.type == "unknown") {
trace("NO KNOWN MEDIA TYPE FOUND TRYING TO JUST PLACE THE HTML");
mediaElem = "" + VMM.Util.properQuotes(m.id) + "
";
// WEBSITE
} else if (m.type == "website") {
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 "";
} else {
return "";
}
/*
if (_return) {
if (isTextMedia) {
return "";
} else {
return "";
}
} else {
VMM.appendElement($mediacontainer, mediaElem);
VMM.appendElement($mediacontainer, creditElem);
VMM.appendElement($mediacontainer, captionElem);
}
*/
};
},
}).init();
}