Browse Source

Added Google Plus. Working in all browsers except IE. IE will be fixed soon.

pull/127/merge
Zach Wise 13 years ago
parent
commit
5acc7fdb14
  1. 54
      source/js/Media/VMM.MediaElement.js
  2. 11
      source/js/Media/VMM.MediaType.js

54
source/js/Media/VMM.MediaElement.js

@ -8,19 +8,22 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
return this; return this;
}, },
thumbnail: function(data, w, h) { thumbnail: function(data, w, h, uid) {
_w = 16; var _w = 16,
_h = 24; _h = 24,
_uid = "";
if (w != null && w != "") {_w = w}; if (w != null && w != "") {_w = w};
if (h != null && h != "") {_h = h}; if (h != null && h != "") {_h = h};
if (uid != null && uid != "") {_uid = uid};
if (data.media != null && data.media != "") { if (data.media != null && data.media != "") {
_valid = true; var _valid = true,
var mediaElem = ""; mediaElem = "",
var m = VMM.MediaType(data.media); //returns an object with .type and .id m = VMM.MediaType(data.media); //returns an object with .type and .id
// CREATE MEDIA CODE // CREATE MEDIA CODE
if (m.type == "image") { if (m.type == "image") {
//mediaElem = "<div class='thumbnail thumb-photo'><img src='" + m.id + "' width='" + _w + "px' height='" + _h + "px'></div>";
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") {
@ -53,6 +56,9 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
} else if (m.type == "google-map") { } else if (m.type == "google-map") {
mediaElem = "<div class='thumbnail thumb-map'></div>"; mediaElem = "<div class='thumbnail thumb-map'></div>";
return mediaElem; return mediaElem;
} else if (m.type == "googleplus") {
mediaElem = "<div class='thumbnail thumb-googleplus'></div>";
return mediaElem;
} else if (m.type == "wikipedia") { } else if (m.type == "wikipedia") {
mediaElem = "<div class='thumbnail thumb-wikipedia'></div>"; mediaElem = "<div class='thumbnail thumb-wikipedia'></div>";
return mediaElem; return mediaElem;
@ -64,14 +70,13 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
return mediaElem; return mediaElem;
} else if (m.type == "unknown") { } else if (m.type == "unknown") {
if (m.id.match("blockquote")) { if (m.id.match("blockquote")) {
mediaElem = "<div class='thumbnail thumb-quote'></div>"; mediaElem = "<div class='thumbnail thumb-quote'></div>";
} else { } else {
mediaElem = "<div class='thumbnail thumb-plaintext'></div>"; mediaElem = "<div class='thumbnail thumb-plaintext'></div>";
} }
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'></div>";
//mediaElem = "<div class='thumbnail'><img src='http://api.snapito.com/free/sc?url=" + m.id + "' width='" + _w + "px' height='" + _h + "px'></div>";
return mediaElem; return mediaElem;
} else { } else {
mediaElem = "<div class='thumbnail thumb-plaintext'></div>"; mediaElem = "<div class='thumbnail thumb-plaintext'></div>";
@ -81,13 +86,14 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
}, },
create: function(data, secondary) { create: function(data, secondary) {
//$mediacontainer = element; var _valid = false,
var _valid = false; loading_messege = "<span class='messege'><p>" + VMM.master_config.language.messages.loading + "</p></span>";
if (data.media != null && data.media != "") { if (data.media != null && data.media != "") {
var mediaElem = "", captionElem = "", creditElem = "", _id = "", isTextMedia = false; var mediaElem = "", captionElem = "", creditElem = "", _id = "", isTextMedia = false, m;
var m = VMM.MediaType(data.media); //returns an object with .type and .id
_valid = true; m = VMM.MediaType(data.media); //returns an object with .type and .id
_valid = true;
// CREDIT // CREDIT
if (data.credit != null && data.credit != "") { if (data.credit != null && data.credit != "") {
@ -112,11 +118,11 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
// GOOGLE DOCS // GOOGLE DOCS
} else if (m.type == "googledoc") { } else if (m.type == "googledoc") {
_id = "googledoc_" + VMM.Util.unique_ID(5); _id = "googledoc_" + VMM.Util.unique_ID(5);
mediaElem = "<div class='media-frame media-shadow doc' id='" + _id + "'><span class='messege'><p>Loading Document</p></span></div>"; mediaElem = "<div class='media-frame media-shadow doc' id='" + _id + "'>" + loading_messege + "</div>";
VMM.ExternalAPI.googledocs.get(m.id, _id); VMM.ExternalAPI.googledocs.get(m.id, _id);
// YOUTUBE // YOUTUBE
} else if (m.type == "youtube") { } else if (m.type == "youtube") {
mediaElem = "<div class='media-shadow'><div class='media-frame video youtube' id='youtube_" + m.id + "'><span class='messege'><p>Loading YouTube video</p></span></div></div>"; mediaElem = "<div class='media-shadow'><div class='media-frame video youtube' id='youtube_" + m.id + "'>" + loading_messege + "</div></div>";
VMM.ExternalAPI.youtube.get(m.id); VMM.ExternalAPI.youtube.get(m.id);
// VIMEO // VIMEO
} else if (m.type == "vimeo") { } else if (m.type == "vimeo") {
@ -127,7 +133,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
mediaElem = "<div class='media-shadow'><iframe class='media-frame video dailymotion' autostart='false' frameborder='0' width='100%' height='100%' src='http://www.dailymotion.com/embed/video/" + m.id + "'></iframe></div>"; mediaElem = "<div class='media-shadow'><iframe class='media-frame video dailymotion' autostart='false' frameborder='0' width='100%' height='100%' src='http://www.dailymotion.com/embed/video/" + m.id + "'></iframe></div>";
// TWITTER // TWITTER
} else if (m.type == "twitter"){ } else if (m.type == "twitter"){
mediaElem = "<div class='twitter' id='" + "twitter_" + m.id + "'><span class='messege'><p>Loading Tweet</p></span></div>"; mediaElem = "<div class='twitter' id='" + "twitter_" + m.id + "'>" + loading_messege + "</div>";
isTextMedia = true; isTextMedia = true;
VMM.ExternalAPI.twitter.prettyHTML(m.id, secondary); VMM.ExternalAPI.twitter.prettyHTML(m.id, secondary);
// TWITTER // TWITTER
@ -137,17 +143,23 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
// SOUNDCLOUD // SOUNDCLOUD
} else if (m.type == "soundcloud") { } else if (m.type == "soundcloud") {
_id = "soundcloud_" + VMM.Util.unique_ID(5); _id = "soundcloud_" + VMM.Util.unique_ID(5);
mediaElem = "<div class='media-frame media-shadow soundcloud' id='" + _id + "'><span class='messege'><p>Loading Sound</p></span></div>"; mediaElem = "<div class='media-frame media-shadow soundcloud' id='" + _id + "'>" + loading_messege + "</div>";
VMM.ExternalAPI.soundcloud.get(m.id, _id); VMM.ExternalAPI.soundcloud.get(m.id, _id);
// GOOGLE MAPS // GOOGLE MAPS
} else if (m.type == "google-map") { } else if (m.type == "google-map") {
_id = "googlemap_" + VMM.Util.unique_ID(7); _id = "googlemap_" + VMM.Util.unique_ID(7);
mediaElem = "<div class='media-frame media-shadow map' id='" + _id + "'><span class='messege'><p>Loading Map</p></span></div>"; mediaElem = "<div class='media-frame media-shadow map' id='" + _id + "'>" + loading_messege + "</div>";
VMM.ExternalAPI.googlemaps.get(m.id, _id); VMM.ExternalAPI.googlemaps.get(m.id, _id);
// GOOGLE PLUS
} else if (m.type == "googleplus") {
_id = "googleplus_" + m.id;
mediaElem = "<div class='googleplus' id='" + _id + "'>" + loading_messege + "</div>";
isTextMedia = true;
VMM.ExternalAPI.googleplus.get(m.user, m.id);
// WIKIPEDIA // WIKIPEDIA
} else if (m.type == "wikipedia") { } else if (m.type == "wikipedia") {
_id = "wikipedia_" + VMM.Util.unique_ID(7); _id = "wikipedia_" + VMM.Util.unique_ID(7);
mediaElem = "<div class='wikipedia' id='" + _id + "'><span class='messege'><p>Loading Wikipedia</p></span></div>"; mediaElem = "<div class='wikipedia' id='" + _id + "'>" + loading_messege + "</div>";
isTextMedia = true; isTextMedia = true;
VMM.ExternalAPI.wikipedia.get(m.id, _id, m.lang); VMM.ExternalAPI.wikipedia.get(m.id, _id, m.lang);
// STORIFY // STORIFY

11
source/js/Media/VMM.MediaType.js

@ -49,6 +49,17 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
media.type = "google-map"; media.type = "google-map";
media.id = d.split(/src=['|"][^'|"]*?['|"]/gi); media.id = d.split(/src=['|"][^'|"]*?['|"]/gi);
success = true; success = true;
} else if (d.match("plus.google")) {
media.type = "googleplus";
media.id = d.split("/posts/")[1];
//https://plus.google.com/u/0/112374836634096795698/posts/bRJSvCb5mUU
//https://plus.google.com/107096716333816995401/posts/J5iMpEDHWNL
if (d.split("/posts/")[0].match("u/0/")) {
media.user = d.split("u/0/")[1].split("/posts")[0];
} else {
media.user = d.split("google.com/")[1].split("/posts/")[0];
}
success = true;
} else if (d.match("flickr.com/photos")) { } else if (d.match("flickr.com/photos")) {
media.type = "flickr"; media.type = "flickr";
media.id = d.split("photos\/")[1].split("/")[1]; media.id = d.split("photos\/")[1].split("/")[1];

Loading…
Cancel
Save