Browse Source

Changed the way API keys are set

pull/197/head
Zach Wise 12 years ago
parent
commit
066484c47b
  1. 8
      compiled/js/timeline-min.js
  2. 143
      compiled/js/timeline.js
  3. 2
      source/js/Core
  4. 23
      source/js/VMM.Timeline.TimeNav.js
  5. 5
      source/js/VMM.Timeline.js

8
compiled/js/timeline-min.js vendored

File diff suppressed because one or more lines are too long

143
compiled/js/timeline.js

@ -2362,7 +2362,28 @@ if(typeof VMM != 'undefined' && typeof VMM.Language == 'undefined') {
================================================== */ ================================================== */
if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') { if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
VMM.ExternalAPI = { VMM.ExternalAPI = ({
keys: {
google: "",
flickr: "",
twitter: ""
},
keys_master: {
vp: "Pellentesque nibh felis, eleifend id, commodo in, interdum vitae, leo",
flickr: "RAIvxHY4hE/Elm5cieh4X5ptMyDpj7MYIxziGxi0WGCcy1s+yr7rKQ==",
google: "jwNGnYw4hE9lmAez4ll0QD+jo6SKBJFknkopLS4FrSAuGfIwyj57AusuR0s8dAo=",
twitter: ""
},
init: function() {
return this;
},
setKeys: function(d) {
VMM.ExternalAPI.keys = d;
},
pushQues: function() { pushQues: function() {
@ -2659,6 +2680,14 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
googlemaps: { googlemaps: {
maptype: "toner",
setMapType: function(d) {
if (d != "") {
VMM.ExternalAPI.googlemaps.maptype = d;
}
},
get: function(m) { get: function(m) {
var timer, var timer,
api_key, api_key,
@ -2668,10 +2697,10 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
map_vars = VMM.Util.getUrlVars(m.id); map_vars = VMM.Util.getUrlVars(m.id);
if (VMM.master_config.Timeline.api_keys.google != "") { if (VMM.ExternalAPI.keys.google != "") {
api_key = VMM.master_config.Timeline.api_keys.google; api_key = VMM.ExternalAPI.keys.google;
} else { } else {
api_key = Aes.Ctr.decrypt(VMM.master_config.api_keys_master.google, VMM.master_config.vp, 256); api_key = Aes.Ctr.decrypt(VMM.ExternalAPI.keys_master.google, VMM.ExternalAPI.keys_master.vp, 256);
} }
map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady"; map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady";
@ -2693,9 +2722,19 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
}, },
create: function(m) { create: function(m) {
var map_attribution = ""; var map_attribution = "",
var layer; layer,
var map; map,
map_options,
unique_map_id = m.id.toString() + "_gmap",
map_attribution_html = "",
location = new google.maps.LatLng(41.875696,-87.624207),
latlong,
zoom = 11,
has_location = false,
has_zoom = false,
map_bounds;
function mapProvider(name) { function mapProvider(name) {
if (name in VMM.ExternalAPI.googlemaps.map_providers) { if (name in VMM.ExternalAPI.googlemaps.map_providers) {
@ -2743,32 +2782,25 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
/* Make the Map /* Make the Map
================================================== */ ================================================== */
if (VMM.ExternalAPI.googlemaps.maptype != "") {
if (type.of(VMM.master_config.Timeline.maptype) == "string") { if (VMM.ExternalAPI.googlemaps.defaultType(VMM.ExternalAPI.googlemaps.maptype)) {
if (VMM.ExternalAPI.googlemaps.defaultType(VMM.master_config.Timeline.maptype)) { layer = google.maps.MapTypeId[VMM.ExternalAPI.googlemaps.maptype.toUpperCase()];
layer = google.maps.MapTypeId[VMM.master_config.Timeline.maptype.toUpperCase()];
} else { } else {
layer = VMM.master_config.Timeline.maptype; layer = VMM.ExternalAPI.googlemaps.maptype;
} }
} else { } else {
layer = "toner"; layer = "toner";
} }
var location = new google.maps.LatLng(41.875696,-87.624207);
var latlong;
var zoom = 11;
var has_location = false;
var has_zoom = false;
var map_bounds;
if (type.of(VMM.Util.getUrlVars(m.url)["ll"]) == "string") { if (type.of(VMM.Util.getUrlVars(m.url)["ll"]) == "string") {
has_location = true; has_location = true;
latlong = VMM.Util.getUrlVars(m.url)["ll"].split(","); latlong = VMM.Util.getUrlVars(m.url)["ll"].split(",");
location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1])); location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1]));
} else if (type.of(VMM.Util.getUrlVars(m.url)["sll"]) == "string") { } else if (type.of(VMM.Util.getUrlVars(m.url)["sll"]) == "string") {
latlong = VMM.Util.getUrlVars(m.url)["sll"].split(","); latlong = VMM.Util.getUrlVars(m.url)["sll"].split(",");
location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1])); location = new google.maps.LatLng(parseFloat(latlong[0]),parseFloat(latlong[1]));
} }
if (type.of(VMM.Util.getUrlVars(m.url)["z"]) == "string") { if (type.of(VMM.Util.getUrlVars(m.url)["z"]) == "string") {
@ -2776,7 +2808,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
zoom = parseFloat(VMM.Util.getUrlVars(m.url)["z"]); zoom = parseFloat(VMM.Util.getUrlVars(m.url)["z"]);
} }
var map_options = { map_options = {
zoom: zoom, zoom: zoom,
disableDefaultUI: true, disableDefaultUI: true,
mapTypeControl: false, mapTypeControl: false,
@ -2792,18 +2824,17 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} }
} }
var unique_map_id = m.id.toString() + "_gmap";
VMM.attachElement("#" + m.id, "<div class='google-map' id='" + unique_map_id + "' style='width=100%;height=100%;'></div>"); VMM.attachElement("#" + m.id, "<div class='google-map' id='" + unique_map_id + "' style='width=100%;height=100%;'></div>");
var map = new google.maps.Map(document.getElementById(unique_map_id), map_options); map = new google.maps.Map(document.getElementById(unique_map_id), map_options);
if (VMM.ExternalAPI.googlemaps.defaultType(VMM.master_config.Timeline.maptype)) { if (VMM.ExternalAPI.googlemaps.defaultType(VMM.ExternalAPI.googlemaps.maptype)) {
} else { } else {
map.mapTypes.set(layer, new google.maps.VeriteMapType(layer)); map.mapTypes.set(layer, new google.maps.VeriteMapType(layer));
// ATTRIBUTION // ATTRIBUTION
var map_attribution_html = "<div class='map-attribution'><div class='attribution-text'>" + map_attribution + "</div></div>"; map_attribution_html = "<div class='map-attribution'><div class='attribution-text'>" + map_attribution + "</div></div>";
VMM.appendElement("#"+unique_map_id, map_attribution_html); VMM.appendElement("#"+unique_map_id, map_attribution_html);
} }
@ -2811,10 +2842,12 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
// KML // KML
function loadKML() { function loadKML() {
var kml_url = m.url + "&output=kml"; var kml_url, kml_layer, infowindow, text;
kml_url = kml_url.replace("&output=embed", "");
var kml_layer = new google.maps.KmlLayer(kml_url, {preserveViewport:true}); kml_url = m.url + "&output=kml";
var infowindow = new google.maps.InfoWindow(); kml_url = kml_url.replace("&output=embed", "");
kml_layer = new google.maps.KmlLayer(kml_url, {preserveViewport:true});
infowindow = new google.maps.InfoWindow();
kml_layer.setMap(map); kml_layer.setMap(map);
google.maps.event.addListenerOnce(kml_layer, "defaultviewport_changed", function() { google.maps.event.addListenerOnce(kml_layer, "defaultviewport_changed", function() {
@ -2828,7 +2861,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
}); });
google.maps.event.addListener(kml_layer, 'click', function(kmlEvent) { google.maps.event.addListener(kml_layer, 'click', function(kmlEvent) {
var text = kmlEvent.featureData.description; text = kmlEvent.featureData.description;
showInfoWindow(text); showInfoWindow(text);
function showInfoWindow(c) { function showInfoWindow(c) {
@ -3109,7 +3142,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
var api_key, var api_key,
callback_timeout= setTimeout(callback, VMM.master_config.timers.api, flick); callback_timeout= setTimeout(callback, VMM.master_config.timers.api, flick);
if (VMM.master_config.Timeline.api_keys.flickr != "") { if (typeof VMM.master_config.Timeline != 'undefined' && VMM.master_config.Timeline.api_keys.flickr != "") {
api_key = VMM.master_config.Timeline.api_keys.flickr; api_key = VMM.master_config.Timeline.api_keys.flickr;
} else { } else {
api_key = Aes.Ctr.decrypt(VMM.master_config.api_keys_master.flickr, VMM.master_config.vp, 256) api_key = Aes.Ctr.decrypt(VMM.master_config.api_keys_master.flickr, VMM.master_config.vp, 256)
@ -3499,7 +3532,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
} }
} }).init();
} }
@ -4780,8 +4813,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
navigation.nextDate = VMM.appendAndGetElement(navigation.nextBtnContainer, "<div>", "date", ""); navigation.nextDate = VMM.appendAndGetElement(navigation.nextBtnContainer, "<div>", "date", "");
navigation.prevDate = VMM.appendAndGetElement(navigation.prevBtnContainer, "<div>", "date", ""); navigation.prevDate = VMM.appendAndGetElement(navigation.prevBtnContainer, "<div>", "date", "");
} }
navigation.nextTitle = VMM.appendAndGetElement(navigation.nextBtnContainer, "<div>", "title", "Title Goes Here"); navigation.nextTitle = VMM.appendAndGetElement(navigation.nextBtnContainer, "<div>", "title", "");
navigation.prevTitle = VMM.appendAndGetElement(navigation.prevBtnContainer, "<div>", "title", "Title Goes Here"); navigation.prevTitle = VMM.appendAndGetElement(navigation.prevBtnContainer, "<div>", "title", "");
VMM.bindEvent(".nav-next", onNextClick); VMM.bindEvent(".nav-next", onNextClick);
VMM.bindEvent(".nav-previous", onPrevClick); VMM.bindEvent(".nav-previous", onPrevClick);
@ -4797,10 +4830,10 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.attachElement(layout, ""); VMM.attachElement(layout, "");
// Get DOM Objects to local objects // Get DOM Objects to local objects
$slider = VMM.getElement(layout); $slider = VMM.getElement(layout);
$slider_mask = VMM.appendAndGetElement($slider, "<div>", "slider-container-mask"); $slider_mask = VMM.appendAndGetElement($slider, "<div>", "slider-container-mask");
$slider_container = VMM.appendAndGetElement($slider_mask, "<div>", "slider-container"); $slider_container = VMM.appendAndGetElement($slider_mask, "<div>", "slider-container");
$slides_items = VMM.appendAndGetElement($slider_container, "<div>", "slider-item-container"); $slides_items = VMM.appendAndGetElement($slider_container, "<div>", "slider-item-container");
// BUILD NAVIGATION // BUILD NAVIGATION
buildNavigation(); buildNavigation();
@ -6234,9 +6267,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
config.source = _data; config.source = _data;
} }
// LANGUAGE
VMM.Date.setLanguage(config.language); VMM.Date.setLanguage(config.language);
VMM.master_config.language = config.language; VMM.master_config.language = config.language;
// EXTERNAL API
VMM.ExternalAPI.setKeys(config.api_keys);
VMM.ExternalAPI.googlemaps.setMapType(config.maptype);
// EVENTS // EVENTS
VMM.bindEvent(global, onDataReady, config.events.data_ready); VMM.bindEvent(global, onDataReady, config.events.data_ready);
VMM.bindEvent(global, showMessege, config.events.messege); VMM.bindEvent(global, showMessege, config.events.messege);
@ -7934,14 +7972,14 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
for(i = 0; i < data.length; i++) { for(i = 0; i < data.length; i++) {
var _marker, var _marker,
_marker_flag, _marker_flag,
_marker_content, _marker_content,
_marker_dot, _marker_dot,
_marker_line, _marker_line,
_marker_line_event, _marker_line_event,
_marker_obj, _marker_obj,
_marker_title = "", _marker_title = "",
has_title = false; has_title = false;
_marker = VMM.appendAndGetElement($content, "<div>", "marker"); _marker = VMM.appendAndGetElement($content, "<div>", "marker");
@ -7986,7 +8024,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} else { } else {
trace("TITLE SLUG NOT FOUND " + data[i].slug) trace("TITLE SLUG NOT FOUND " + data[i].slug)
} }
if (has_title) { if (has_title) {
VMM.appendElement(_marker_content, "<h3>" + _marker_title + "</h3>"); VMM.appendElement(_marker_content, "<h3>" + _marker_title + "</h3>");
@ -8033,7 +8070,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// CREATE TAGS // CREATE TAGS
tags = VMM.Util.deDupeArray(tags); tags = VMM.Util.deDupeArray(tags);
if (tags.length > 2) { if (tags.length > 3) {
config.nav.rows.current = config.nav.rows.half; config.nav.rows.current = config.nav.rows.half;
} else { } else {
config.nav.rows.current = config.nav.rows.full; config.nav.rows.current = config.nav.rows.full;
@ -8042,7 +8079,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
if (k < config.nav.rows.current.length) { if (k < config.nav.rows.current.length) {
var tag_element = VMM.appendAndGetElement($timebackground, "<div>", "timenav-tag"); var tag_element = VMM.appendAndGetElement($timebackground, "<div>", "timenav-tag");
VMM.Lib.addClass(tag_element, "timenav-tag-row-" + (k+1)); VMM.Lib.addClass(tag_element, "timenav-tag-row-" + (k+1));
if (tags.length > 2) { if (tags.length > 3) {
VMM.Lib.addClass(tag_element, "timenav-tag-size-half"); VMM.Lib.addClass(tag_element, "timenav-tag-size-half");
} else { } else {
VMM.Lib.addClass(tag_element, "timenav-tag-size-full"); VMM.Lib.addClass(tag_element, "timenav-tag-size-full");
@ -8053,7 +8090,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
// RESIZE FLAGS IF NEEDED // RESIZE FLAGS IF NEEDED
if (tags.length > 2) { if (tags.length > 3) {
for(l = 0; l < markers.length; l++) { for(l = 0; l < markers.length; l++) {
VMM.Lib.addClass(markers[l].flag, "flag-small"); VMM.Lib.addClass(markers[l].flag, "flag-small");
markers[l].full = false; markers[l].full = false;

2
source/js/Core

@ -1 +1 @@
Subproject commit 7c4dcd4760fbd197602de2c8edf23d898970b534 Subproject commit 27cea679940eed77af69de6d5700956a161fa107

23
source/js/VMM.Timeline.TimeNav.js

@ -1422,14 +1422,14 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
for(i = 0; i < data.length; i++) { for(i = 0; i < data.length; i++) {
var _marker, var _marker,
_marker_flag, _marker_flag,
_marker_content, _marker_content,
_marker_dot, _marker_dot,
_marker_line, _marker_line,
_marker_line_event, _marker_line_event,
_marker_obj, _marker_obj,
_marker_title = "", _marker_title = "",
has_title = false; has_title = false;
_marker = VMM.appendAndGetElement($content, "<div>", "marker"); _marker = VMM.appendAndGetElement($content, "<div>", "marker");
@ -1474,7 +1474,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} else { } else {
trace("TITLE SLUG NOT FOUND " + data[i].slug) trace("TITLE SLUG NOT FOUND " + data[i].slug)
} }
if (has_title) { if (has_title) {
VMM.appendElement(_marker_content, "<h3>" + _marker_title + "</h3>"); VMM.appendElement(_marker_content, "<h3>" + _marker_title + "</h3>");
@ -1521,7 +1520,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// CREATE TAGS // CREATE TAGS
tags = VMM.Util.deDupeArray(tags); tags = VMM.Util.deDupeArray(tags);
if (tags.length > 2) { if (tags.length > 3) {
config.nav.rows.current = config.nav.rows.half; config.nav.rows.current = config.nav.rows.half;
} else { } else {
config.nav.rows.current = config.nav.rows.full; config.nav.rows.current = config.nav.rows.full;
@ -1530,7 +1529,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
if (k < config.nav.rows.current.length) { if (k < config.nav.rows.current.length) {
var tag_element = VMM.appendAndGetElement($timebackground, "<div>", "timenav-tag"); var tag_element = VMM.appendAndGetElement($timebackground, "<div>", "timenav-tag");
VMM.Lib.addClass(tag_element, "timenav-tag-row-" + (k+1)); VMM.Lib.addClass(tag_element, "timenav-tag-row-" + (k+1));
if (tags.length > 2) { if (tags.length > 3) {
VMM.Lib.addClass(tag_element, "timenav-tag-size-half"); VMM.Lib.addClass(tag_element, "timenav-tag-size-half");
} else { } else {
VMM.Lib.addClass(tag_element, "timenav-tag-size-full"); VMM.Lib.addClass(tag_element, "timenav-tag-size-full");
@ -1541,7 +1540,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
// RESIZE FLAGS IF NEEDED // RESIZE FLAGS IF NEEDED
if (tags.length > 2) { if (tags.length > 3) {
for(l = 0; l < markers.length; l++) { for(l = 0; l < markers.length; l++) {
VMM.Lib.addClass(markers[l].flag, "flag-small"); VMM.Lib.addClass(markers[l].flag, "flag-small");
markers[l].full = false; markers[l].full = false;

5
source/js/VMM.Timeline.js

@ -334,9 +334,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
config.source = _data; config.source = _data;
} }
// LANGUAGE
VMM.Date.setLanguage(config.language); VMM.Date.setLanguage(config.language);
VMM.master_config.language = config.language; VMM.master_config.language = config.language;
// EXTERNAL API
VMM.ExternalAPI.setKeys(config.api_keys);
VMM.ExternalAPI.googlemaps.setMapType(config.maptype);
// EVENTS // EVENTS
VMM.bindEvent(global, onDataReady, config.events.data_ready); VMM.bindEvent(global, onDataReady, config.events.data_ready);
VMM.bindEvent(global, showMessege, config.events.messege); VMM.bindEvent(global, showMessege, config.events.messege);

Loading…
Cancel
Save