Browse Source

Adding the ability for using your own api keys with services supported by Timeline

Google and Flickr are hooked up, so you can use your own keys to avoid
possible outages on large publication sites
pull/79/head
Zach Wise 13 years ago
parent
commit
4039266b21
  1. 8
      locale/de.js
  2. 8
      locale/en.js
  3. 8
      locale/es.js
  4. 8
      locale/fr.js
  5. 8
      locale/is.js
  6. 8
      locale/it.js
  7. 8
      locale/kr.js
  8. 8
      locale/nl.js
  9. 8
      locale/pt-br.js
  10. 8
      locale/zh-ch.js
  11. 8
      locale/zh-tw.js
  12. 5
      source/js/VMM.Timeline.js
  13. 5
      source/js/VMM.js
  14. 8
      timeline-min.js
  15. 58
      timeline.js

8
locale/de.js

File diff suppressed because one or more lines are too long

8
locale/en.js

File diff suppressed because one or more lines are too long

8
locale/es.js

File diff suppressed because one or more lines are too long

8
locale/fr.js

File diff suppressed because one or more lines are too long

8
locale/is.js

File diff suppressed because one or more lines are too long

8
locale/it.js

File diff suppressed because one or more lines are too long

8
locale/kr.js

File diff suppressed because one or more lines are too long

8
locale/nl.js

File diff suppressed because one or more lines are too long

8
locale/pt-br.js

File diff suppressed because one or more lines are too long

8
locale/zh-ch.js

File diff suppressed because one or more lines are too long

8
locale/zh-tw.js

File diff suppressed because one or more lines are too long

5
source/js/VMM.Timeline.js

@ -73,6 +73,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
hash_bookmark: false,
start_at_end: false,
start_page: false,
api_keys: {
google: "",
flickr: "",
twitter: ""
},
interval: 10,
something: 0,
width: 960,

5
source/js/VMM.js

@ -105,9 +105,10 @@ if (typeof VMM == 'undefined') {
vp: "Pellentesque nibh felis, eleifend id, commodo in, interdum vitae, leo",
keys: {
api_keys_master: {
flickr: "RAIvxHY4hE/Elm5cieh4X5ptMyDpj7MYIxziGxi0WGCcy1s+yr7rKQ==",
google: "jwNGnYw4hE9lmAez4ll0QD+jo6SKBJFknkopLS4FrSAuGfIwyj57AusuR0s8dAo="
google: "jwNGnYw4hE9lmAez4ll0QD+jo6SKBJFknkopLS4FrSAuGfIwyj57AusuR0s8dAo=",
twitter: ""
},
youtube: {

8
timeline-min.js vendored

File diff suppressed because one or more lines are too long

58
timeline.js

@ -105,9 +105,10 @@ if (typeof VMM == 'undefined') {
vp: "Pellentesque nibh felis, eleifend id, commodo in, interdum vitae, leo",
keys: {
api_keys_master: {
flickr: "RAIvxHY4hE/Elm5cieh4X5ptMyDpj7MYIxziGxi0WGCcy1s+yr7rKQ==",
google: "jwNGnYw4hE9lmAez4ll0QD+jo6SKBJFknkopLS4FrSAuGfIwyj57AusuR0s8dAo="
google: "jwNGnYw4hE9lmAez4ll0QD+jo6SKBJFknkopLS4FrSAuGfIwyj57AusuR0s8dAo=",
twitter: ""
},
youtube: {
@ -2320,7 +2321,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
});
},
// VMM.ExternalAPI.twitter.prettyHTML(id);
prettyHTML: function(id) {
var id = id.toString();
var error_obj = {
@ -2329,8 +2330,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
var the_url = "http://api.twitter.com/1/statuses/show.json?id=" + id + "&include_entities=true&callback=?";
trace("id " + id);
var twitter_timeout = setTimeout(VMM.ExternalAPI.twitter.notFoundError, 4000, id);
VMM.getJSON(the_url, VMM.ExternalAPI.twitter.formatJSON)
VMM.getJSON(the_url, VMM.ExternalAPI.twitter.formatJSON)
.error(function(jqXHR, textStatus, errorThrown) {
trace("TWITTER error");
trace("TWITTER ERROR: " + textStatus + " " + jqXHR.responseText);
@ -2339,13 +2340,26 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
.success(function() {
clearTimeout(twitter_timeout);
});
},
notFoundError: function(id) {
trace("TWITTER JSON ERROR TIMEOUT " + id);
VMM.attachElement("#twitter_" + id, "<p>TWEET NOT FOUND " + id + "</p>" );
VMM.attachElement("#twitter_" + id, "<span class='messege'><p>Error loading tweet: " + id + "</p></span>" );
// 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 = "<p>You've reached the maximum number of tweets you can load in an hour.</p>";
mes += "<p>You can view tweets again starting at: <br/>" + d.reset_time + "</p>";
} else {
mes = "<p>Tweet " + id + " was not found.</p>";
}
VMM.attachElement("#twitter_" + id, "<span class='messege'>" + mes + "</span>" );
});
},
formatJSON: function(d) {
@ -2379,10 +2393,17 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
get: function(url, id) {
var timer;
var map_vars = VMM.Util.getUrlVars(url);
trace(map_vars);
var map_url = "http://maps.googleapis.com/maps/api/js?key=" + Aes.Ctr.decrypt(VMM.master_config.keys.google, VMM.master_config.vp, 256) + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady";
var map = {url: url, vars: map_vars, id: id}
trace(map);
var api_key;
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 {
@ -2662,8 +2683,14 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
flickr: {
get: function(mid, id) {
// http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=6d6f59d8d30d79f4f402a7644d5073e3&photo_id=6115056146&format=json&nojsoncallback=1
var the_url = "http://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=" + Aes.Ctr.decrypt(VMM.master_config.keys.flickr, VMM.master_config.vp, 256) + "&photo_id=" + mid + "&format=json&jsoncallback=?";
var api_key;
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=" + mid + "&format=json&jsoncallback=?";
VMM.getJSON(the_url, VMM.ExternalAPI.flickr.create);
},
@ -5019,6 +5046,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
hash_bookmark: false,
start_at_end: false,
start_page: false,
api_keys: {
google: "",
flickr: "",
twitter: ""
},
interval: 10,
something: 0,
width: 960,

Loading…
Cancel
Save