Browse Source

Added loading animation

pull/177/head
Zach Wise 13 years ago
parent
commit
5b990033e5
  1. 15
      source/js/Media/VMM.ExternalAPI.js
  2. 10
      source/js/Media/VMM.MediaElement.js

15
source/js/Media/VMM.ExternalAPI.js

@ -88,7 +88,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
.error(function(jqXHR, textStatus, errorThrown) {
trace("TWITTER error");
trace("TWITTER ERROR: " + textStatus + " " + jqXHR.responseText);
VMM.attachElement("#"+tweet.id, "<p>ERROR LOADING TWEET " + tweet.mid + "</p>" );
VMM.attachElement("#"+tweet.id, VMM.MediaElement.loadingmessage("ERROR LOADING TWEET " + tweet.mid) );
})
.success(function(d) {
clearTimeout(twitter_timeout);
@ -114,7 +114,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
mes = "<p>Still waiting on Twitter. " + id + "</p>";
//mes = "<p>Tweet " + id + " was not found.</p>";
}
VMM.attachElement("#twitter_" + id, "<span class='messege'>" + mes + "</span>" );
VMM.attachElement("#twitter_" + id, VMM.MediaElement.loadingmessage(mes) );
});
},
@ -673,7 +673,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
.error(function(jqXHR, textStatus, errorThrown) {
var error_obj = VMM.parseJSON(jqXHR.responseText);
trace(error_obj.error.message);
VMM.attachElement("#googleplus_" + gplus.activity, "<p>ERROR LOADING GOOGLE+ </p><p>" + error_obj.error.message + "</p>");
VMM.attachElement("#googleplus_" + gplus.activity, VMM.MediaElement.loadingmessage("<p>ERROR LOADING GOOGLE+ </p><p>" + error_obj.error.message + "</p>"));
})
.success(function(d) {
clearTimeout(googleplus_timeout);
@ -700,7 +700,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
errorTimeOut: function(gplus) {
trace("GOOGLE+ JSON ERROR TIMEOUT " + gplus.activity);
VMM.attachElement("#googleplus_" + gplus.activity, "<p>Still waiting on GOOGLE+ </p><p>" + gplus.activity + "</p>");
VMM.attachElement("#googleplus_" + gplus.activity, VMM.MediaElement.loadingmessage("<p>Still waiting on GOOGLE+ </p><p>" + gplus.activity + "</p>"));
}
@ -736,8 +736,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
flickr: {
get: function(mid, id) {
var flick = {mid: mid, id: id};
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;
},
@ -779,6 +779,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
flickr_img_thumb = d.sizes.size[0].source;
VMM.Lib.attr(flickr_large_id, "src", flickr_img_size);
//VMM.attachElement(flickr_large_id, "<a href='" + flick.link + "' target='_blank'><img src='" + flickr_img_size + "'></a>");
VMM.attachElement(flickr_thumb_id, "<img src='" + flickr_img_thumb + "'>");
})
@ -931,7 +932,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
trace("WIKIPEDIA ERROR: " + textStatus + " " + jqXHR.responseText);
trace(errorThrown);
VMM.attachElement("#"+api_obj.id, "<span class='messege'>" + "<p>Wikipedia is not responding</p>" + "</span>" );
VMM.attachElement("#"+api_obj.id, VMM.MediaElement.loadingmessage("<p>Wikipedia is not responding</p>"));
// TRY AGAIN?
clearTimeout(callback_timeout);
if (VMM.master_config.wikipedia.tries < 4) {

10
source/js/Media/VMM.MediaElement.js

@ -8,6 +8,10 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
return this;
},
loadingmessage: function(m) {
return "<div class='loading'><div class='loading-container'><div class='loading-icon'></div>" + "<div class='message'><p>" + m + "</p></div></div></div>";
},
thumbnail: function(data, w, h, uid) {
var _w = 16,
_h = 24,
@ -87,7 +91,8 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
create: function(data, uid) {
var _valid = false,
loading_messege = "<span class='messege'><p>" + VMM.master_config.language.messages.loading + "</p></span>";
//loading_messege = "<span class='messege'><p>" + VMM.master_config.language.messages.loading + "</p></span>";
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;
@ -108,8 +113,9 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
mediaElem = "<div class='media-image media-shadow'><img src='" + m.id + "' class='media-image'></div>";
// FLICKR
} else if (m.type == "flickr") {
//mediaElem = "<div class='media-image media-shadow' id='" + uid + "'>" + loading_messege + "</div>";
mediaElem = "<div class='media-image media-shadow'><a href='" + m.link + "' target='_blank'><img id='" + uid + "'></a></div>";
VMM.ExternalAPI.flickr.get(m.id, uid);
VMM.ExternalAPI.flickr.get(m.id, uid, m.link);
// 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>";

Loading…
Cancel
Save