Browse Source

Tweaked Google Docs data loading

tweaked timeout and added a more robust alternative to loading data from Google because of Google's apparent restriction on spreadsheets with more than 100 rows.
pull/246/head v2.14
Zach Wise 12 years ago
parent
commit
54cfb9abc8
  1. 2
      compiled/js/storyjs-embed.js
  2. 8
      compiled/js/timeline-min.js
  3. 304
      compiled/js/timeline.js
  4. 2
      source/js/Core
  5. 296
      source/js/VMM.Timeline.DataObj.js
  6. 2
      source/js/VMM.Timeline.License.js
  7. 6
      source/js/VMM.Timeline.js

2
compiled/js/storyjs-embed.js

File diff suppressed because one or more lines are too long

8
compiled/js/timeline-min.js vendored

File diff suppressed because one or more lines are too long

304
compiled/js/timeline.js

@ -1,6 +1,6 @@
/*! /*!
TimelineJS TimelineJS
Version 2.12 Version 2.14
Designed and built by Zach Wise at VéritéCo Designed and built by Zach Wise at VéritéCo
This Source Code Form is subject to the terms of the Mozilla Public This Source Code Form is subject to the terms of the Mozilla Public
@ -6523,7 +6523,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
timeline_id = "#timelinejs"; timeline_id = "#timelinejs";
} }
trace("VERSION " + version);
/* CONFIG /* CONFIG
================================================== */ ================================================== */
@ -6542,6 +6541,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
touch: false, touch: false,
orientation: "normal", orientation: "normal",
maptype: "toner", maptype: "toner",
version: "2.x",
preload: 4, preload: 4,
current_slide: 0, current_slide: 0,
hash_bookmark: false, hash_bookmark: false,
@ -6677,6 +6677,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
if (config.gmap_key != "") { if (config.gmap_key != "") {
config.api_keys.google = config.gmap_key; config.api_keys.google = config.gmap_key;
} }
trace("VERSION " + config.version);
version = config.version;
} }
/* CREATE TIMELINE STRUCTURE /* CREATE TIMELINE STRUCTURE
@ -6725,7 +6728,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
function onDataReady(e, d) { function onDataReady(e, d) {
trace("onDataReady"); trace("onDataReady");
trace(d);
data = d.timeline; data = d.timeline;
if (type.of(data.era) != "array") { if (type.of(data.era) != "array") {
@ -8976,18 +8978,23 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
url = "https://spreadsheets.google.com/feeds/list/" + key + "/od6/public/values?alt=json"; url = "https://spreadsheets.google.com/feeds/list/" + key + "/od6/public/values?alt=json";
timeout = setTimeout(function() { timeout = setTimeout(function() {
trace("Google Docs timeout"); trace("Google Docs timeout " + url);
trace(url);
if (tries < 3) { if (tries < 3) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Still waiting on Google Docs, trying again " + tries); VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Still waiting on Google Docs, trying again " + tries);
tries ++; tries ++;
getjsondata.abort()
requestJsonData(); requestJsonData();
} else { } else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Google Docs is not responding"); VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Google Docs is not responding");
} }
}, 6000); }, 16000);
function requestJsonData() { function requestJsonData() {
getjsondata = VMM.getJSON(url, VMM.Timeline.DataObj.model.googlespreadsheet.buildData) getjsondata = VMM.getJSON(url, function(d) {
clearTimeout(timeout);
VMM.Timeline.DataObj.model.googlespreadsheet.buildData(d);
})
.error(function(jqXHR, textStatus, errorThrown) { .error(function(jqXHR, textStatus, errorThrown) {
trace("Google Docs ERROR"); trace("Google Docs ERROR");
trace("Google Docs ERROR: " + textStatus + " " + jqXHR.responseText); trace("Google Docs ERROR: " + textStatus + " " + jqXHR.responseText);
@ -9001,9 +9008,10 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
}, },
buildData: function(d) { buildData: function(d) {
var data_obj = VMM.Timeline.DataObj.data_template_obj; var data_obj = VMM.Timeline.DataObj.data_template_obj,
is_valid = false;
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Parsing Data"); VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Parsing Google Doc Data");
function getGVar(v) { function getGVar(v) {
if (typeof v != 'undefined') { if (typeof v != 'undefined') {
@ -9012,57 +9020,257 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
return ""; return "";
} }
} }
if (typeof d.feed.entry != 'undefined') {
for(var i = 0; i < d.feed.entry.length; i++) { is_valid = true;
var dd = d.feed.entry[i],
dd_type = "";
if (typeof dd.gsx$type != 'undefined') { for(var i = 0; i < d.feed.entry.length; i++) {
dd_type = dd.gsx$type.$t; var dd = d.feed.entry[i],
} else if (typeof dd.gsx$titleslide != 'undefined') { dd_type = "";
dd_type = dd.gsx$titleslide.$t;
}
if (dd_type.match("start") || dd_type.match("title") ) { if (typeof dd.gsx$type != 'undefined') {
data_obj.timeline.startDate = getGVar(dd.gsx$startdate); dd_type = dd.gsx$type.$t;
data_obj.timeline.headline = getGVar(dd.gsx$headline); } else if (typeof dd.gsx$titleslide != 'undefined') {
data_obj.timeline.asset.media = getGVar(dd.gsx$media); dd_type = dd.gsx$titleslide.$t;
data_obj.timeline.asset.caption = getGVar(dd.gsx$mediacaption);
data_obj.timeline.asset.credit = getGVar(dd.gsx$mediacredit);
data_obj.timeline.text = getGVar(dd.gsx$text);
data_obj.timeline.type = "google spreadsheet";
} else if (dd_type.match("era")) {
var era = {
startDate: getGVar(dd.gsx$startdate),
endDate: getGVar(dd.gsx$enddate),
headline: getGVar(dd.gsx$headline),
text: getGVar(dd.gsx$text),
tag: getGVar(dd.gsx$tag)
} }
data_obj.timeline.era.push(era);
} else { if (dd_type.match("start") || dd_type.match("title") ) {
var date = { data_obj.timeline.startDate = getGVar(dd.gsx$startdate);
type: "google spreadsheet", data_obj.timeline.headline = getGVar(dd.gsx$headline);
data_obj.timeline.asset.media = getGVar(dd.gsx$media);
data_obj.timeline.asset.caption = getGVar(dd.gsx$mediacaption);
data_obj.timeline.asset.credit = getGVar(dd.gsx$mediacredit);
data_obj.timeline.text = getGVar(dd.gsx$text);
data_obj.timeline.type = "google spreadsheet";
} else if (dd_type.match("era")) {
var era = {
startDate: getGVar(dd.gsx$startdate), startDate: getGVar(dd.gsx$startdate),
endDate: getGVar(dd.gsx$enddate), endDate: getGVar(dd.gsx$enddate),
headline: getGVar(dd.gsx$headline), headline: getGVar(dd.gsx$headline),
text: getGVar(dd.gsx$text), text: getGVar(dd.gsx$text),
tag: getGVar(dd.gsx$tag), tag: getGVar(dd.gsx$tag)
asset: { }
media: getGVar(dd.gsx$media), data_obj.timeline.era.push(era);
credit: getGVar(dd.gsx$mediacredit), } else {
caption: getGVar(dd.gsx$mediacaption), var date = {
thumbnail: getGVar(dd.gsx$mediathumbnail) type: "google spreadsheet",
} startDate: getGVar(dd.gsx$startdate),
}; endDate: getGVar(dd.gsx$enddate),
headline: getGVar(dd.gsx$headline),
text: getGVar(dd.gsx$text),
tag: getGVar(dd.gsx$tag),
asset: {
media: getGVar(dd.gsx$media),
credit: getGVar(dd.gsx$mediacredit),
caption: getGVar(dd.gsx$mediacaption),
thumbnail: getGVar(dd.gsx$mediathumbnail)
}
};
data_obj.timeline.date.push(date); data_obj.timeline.date.push(date);
}
};
} else {
}
if (is_valid) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Finished Parsing Data");
VMM.fireEvent(global, VMM.Timeline.Config.events.data_ready, data_obj);
} else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, VMM.Language.messages.loading + " Google Doc Data (cells)");
trace("There may be too many entries. Still trying to load data. Now trying to load cells to avoid Googles limitation on cells");
VMM.Timeline.DataObj.model.googlespreadsheet.getDataCells(d.feed.link[0].href);
}
},
getDataCells: function(raw) {
var getjsondata, key, url, timeout, tries = 0;
key = VMM.Util.getUrlVars(raw)["key"];
url = "https://spreadsheets.google.com/feeds/cells/" + key + "/od6/public/values?alt=json";
timeout = setTimeout(function() {
trace("Google Docs timeout " + url);
trace(url);
if (tries < 3) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Still waiting on Google Docs, trying again " + tries);
tries ++;
getjsondata.abort()
requestJsonData();
} else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Google Docs is not responding");
} }
}; }, 16000);
function requestJsonData() {
getjsondata = VMM.getJSON(url, function(d) {
clearTimeout(timeout);
VMM.Timeline.DataObj.model.googlespreadsheet.buildDataCells(d);
})
.error(function(jqXHR, textStatus, errorThrown) {
trace("Google Docs ERROR");
trace("Google Docs ERROR: " + textStatus + " " + jqXHR.responseText);
})
.success(function(d) {
clearTimeout(timeout);
});
}
requestJsonData();
},
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Finished Parsing Data"); buildDataCells: function(d) {
var data_obj = VMM.Timeline.DataObj.data_template_obj,
is_valid = false,
cellnames = ["timeline"],
list = [],
max_row = 0,
i = 0,
k = 0;
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, VMM.Language.messages.loading_timeline + " Parsing Google Doc Data (cells)");
function getGVar(v) {
if (typeof v != 'undefined') {
return v.$t;
} else {
return "";
}
}
if (typeof d.feed.entry != 'undefined') {
is_valid = true;
// DETERMINE NUMBER OF ROWS
for(i = 0; i < d.feed.entry.length; i++) {
var dd = d.feed.entry[i];
if (parseInt(dd.gs$cell.row) > max_row) {
max_row = parseInt(dd.gs$cell.row);
}
}
// CREATE OBJECT FOR EACH ROW
for(var i = 0; i < max_row + 1; i++) {
var date = {
type: "",
startDate: "",
endDate: "",
headline: "",
text: "",
tag: "",
asset: {
media: "",
credit: "",
caption: "",
thumbnail: ""
}
};
list.push(date);
}
// PREP GOOGLE DOC CELL DATA TO EVALUATE
for(i = 0; i < d.feed.entry.length; i++) {
var dd = d.feed.entry[i],
dd_type = "",
column_name = "",
cell = {
content: getGVar(dd.gs$cell),
col: dd.gs$cell.col,
row: dd.gs$cell.row,
name: ""
};
//trace(cell);
if (cell.row == 1) {
if (cell.content == "Start Date") {
column_name = "startDate";
} else if (cell.content == "End Date") {
column_name = "endDate";
} else if (cell.content == "Headline") {
column_name = "headline";
} else if (cell.content == "Text") {
column_name = "text";
} else if (cell.content == "Media") {
column_name = "media";
} else if (cell.content == "Media Credit") {
column_name = "credit";
} else if (cell.content == "Media Caption") {
column_name = "caption";
} else if (cell.content == "Media Thumbnail") {
column_name = "thumbnail";
} else if (cell.content == "Type") {
column_name = "type";
} else if (cell.content == "Tag") {
column_name = "tag";
}
cellnames.push(column_name);
} else {
cell.name = cellnames[cell.col];
list[cell.row][cell.name] = cell.content;
}
};
for(i = 0; i < list.length; i++) {
var date = list[i];
if (date.type.match("start") || date.type.match("title") ) {
data_obj.timeline.startDate = date.startDate;
data_obj.timeline.headline = date.headline;
data_obj.timeline.asset.media = date.media;
data_obj.timeline.asset.caption = date.caption;
data_obj.timeline.asset.credit = date.credit;
data_obj.timeline.text = date.text;
data_obj.timeline.type = "google spreadsheet";
} else if (date.type.match("era")) {
var era = {
startDate: date.startDate,
endDate: date.endDate,
headline: date.headline,
text: date.text,
tag: date.tag
}
data_obj.timeline.era.push(era);
} else {
var date = {
type: "google spreadsheet",
startDate: date.startDate,
endDate: date.endDate,
headline: date.headline,
text: date.text,
tag: date.tag,
asset: {
media: date.media,
credit: date.credit,
caption: date.caption,
thumbnail: date.thumbnail
}
};
data_obj.timeline.date.push(date);
}
}
//trace(cellnames);
//trace(max_row);
//trace(list);
}
VMM.fireEvent(global, VMM.Timeline.Config.events.data_ready, data_obj); if (is_valid) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Finished Parsing Data");
VMM.fireEvent(global, VMM.Timeline.Config.events.data_ready, data_obj);
} else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Unable to load Google Doc data source");
}
} }
}, },

2
source/js/Core

@ -1 +1 @@
Subproject commit c404b8b92bee0f97abaf00c38107a56b922d15a1 Subproject commit 360f36e1157477c4e1c16b6711dcbf0efb70f5d1

296
source/js/VMM.Timeline.DataObj.js

@ -172,18 +172,23 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
url = "https://spreadsheets.google.com/feeds/list/" + key + "/od6/public/values?alt=json"; url = "https://spreadsheets.google.com/feeds/list/" + key + "/od6/public/values?alt=json";
timeout = setTimeout(function() { timeout = setTimeout(function() {
trace("Google Docs timeout"); trace("Google Docs timeout " + url);
trace(url);
if (tries < 3) { if (tries < 3) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Still waiting on Google Docs, trying again " + tries); VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Still waiting on Google Docs, trying again " + tries);
tries ++; tries ++;
getjsondata.abort()
requestJsonData(); requestJsonData();
} else { } else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Google Docs is not responding"); VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Google Docs is not responding");
} }
}, 6000); }, 16000);
function requestJsonData() { function requestJsonData() {
getjsondata = VMM.getJSON(url, VMM.Timeline.DataObj.model.googlespreadsheet.buildData) getjsondata = VMM.getJSON(url, function(d) {
clearTimeout(timeout);
VMM.Timeline.DataObj.model.googlespreadsheet.buildData(d);
})
.error(function(jqXHR, textStatus, errorThrown) { .error(function(jqXHR, textStatus, errorThrown) {
trace("Google Docs ERROR"); trace("Google Docs ERROR");
trace("Google Docs ERROR: " + textStatus + " " + jqXHR.responseText); trace("Google Docs ERROR: " + textStatus + " " + jqXHR.responseText);
@ -197,9 +202,10 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
}, },
buildData: function(d) { buildData: function(d) {
var data_obj = VMM.Timeline.DataObj.data_template_obj; var data_obj = VMM.Timeline.DataObj.data_template_obj,
is_valid = false;
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Parsing Data"); VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Parsing Google Doc Data");
function getGVar(v) { function getGVar(v) {
if (typeof v != 'undefined') { if (typeof v != 'undefined') {
@ -208,57 +214,257 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
return ""; return "";
} }
} }
if (typeof d.feed.entry != 'undefined') {
for(var i = 0; i < d.feed.entry.length; i++) { is_valid = true;
var dd = d.feed.entry[i],
dd_type = "";
if (typeof dd.gsx$type != 'undefined') { for(var i = 0; i < d.feed.entry.length; i++) {
dd_type = dd.gsx$type.$t; var dd = d.feed.entry[i],
} else if (typeof dd.gsx$titleslide != 'undefined') { dd_type = "";
dd_type = dd.gsx$titleslide.$t;
}
if (dd_type.match("start") || dd_type.match("title") ) { if (typeof dd.gsx$type != 'undefined') {
data_obj.timeline.startDate = getGVar(dd.gsx$startdate); dd_type = dd.gsx$type.$t;
data_obj.timeline.headline = getGVar(dd.gsx$headline); } else if (typeof dd.gsx$titleslide != 'undefined') {
data_obj.timeline.asset.media = getGVar(dd.gsx$media); dd_type = dd.gsx$titleslide.$t;
data_obj.timeline.asset.caption = getGVar(dd.gsx$mediacaption);
data_obj.timeline.asset.credit = getGVar(dd.gsx$mediacredit);
data_obj.timeline.text = getGVar(dd.gsx$text);
data_obj.timeline.type = "google spreadsheet";
} else if (dd_type.match("era")) {
var era = {
startDate: getGVar(dd.gsx$startdate),
endDate: getGVar(dd.gsx$enddate),
headline: getGVar(dd.gsx$headline),
text: getGVar(dd.gsx$text),
tag: getGVar(dd.gsx$tag)
} }
data_obj.timeline.era.push(era);
} else { if (dd_type.match("start") || dd_type.match("title") ) {
var date = { data_obj.timeline.startDate = getGVar(dd.gsx$startdate);
type: "google spreadsheet", data_obj.timeline.headline = getGVar(dd.gsx$headline);
data_obj.timeline.asset.media = getGVar(dd.gsx$media);
data_obj.timeline.asset.caption = getGVar(dd.gsx$mediacaption);
data_obj.timeline.asset.credit = getGVar(dd.gsx$mediacredit);
data_obj.timeline.text = getGVar(dd.gsx$text);
data_obj.timeline.type = "google spreadsheet";
} else if (dd_type.match("era")) {
var era = {
startDate: getGVar(dd.gsx$startdate), startDate: getGVar(dd.gsx$startdate),
endDate: getGVar(dd.gsx$enddate), endDate: getGVar(dd.gsx$enddate),
headline: getGVar(dd.gsx$headline), headline: getGVar(dd.gsx$headline),
text: getGVar(dd.gsx$text), text: getGVar(dd.gsx$text),
tag: getGVar(dd.gsx$tag), tag: getGVar(dd.gsx$tag)
asset: { }
media: getGVar(dd.gsx$media), data_obj.timeline.era.push(era);
credit: getGVar(dd.gsx$mediacredit), } else {
caption: getGVar(dd.gsx$mediacaption), var date = {
thumbnail: getGVar(dd.gsx$mediathumbnail) type: "google spreadsheet",
} startDate: getGVar(dd.gsx$startdate),
}; endDate: getGVar(dd.gsx$enddate),
headline: getGVar(dd.gsx$headline),
text: getGVar(dd.gsx$text),
tag: getGVar(dd.gsx$tag),
asset: {
media: getGVar(dd.gsx$media),
credit: getGVar(dd.gsx$mediacredit),
caption: getGVar(dd.gsx$mediacaption),
thumbnail: getGVar(dd.gsx$mediathumbnail)
}
};
data_obj.timeline.date.push(date); data_obj.timeline.date.push(date);
}
};
} else {
}
if (is_valid) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Finished Parsing Data");
VMM.fireEvent(global, VMM.Timeline.Config.events.data_ready, data_obj);
} else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, VMM.Language.messages.loading + " Google Doc Data (cells)");
trace("There may be too many entries. Still trying to load data. Now trying to load cells to avoid Googles limitation on cells");
VMM.Timeline.DataObj.model.googlespreadsheet.getDataCells(d.feed.link[0].href);
}
},
getDataCells: function(raw) {
var getjsondata, key, url, timeout, tries = 0;
key = VMM.Util.getUrlVars(raw)["key"];
url = "https://spreadsheets.google.com/feeds/cells/" + key + "/od6/public/values?alt=json";
timeout = setTimeout(function() {
trace("Google Docs timeout " + url);
trace(url);
if (tries < 3) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Still waiting on Google Docs, trying again " + tries);
tries ++;
getjsondata.abort()
requestJsonData();
} else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Google Docs is not responding");
} }
}; }, 16000);
function requestJsonData() {
getjsondata = VMM.getJSON(url, function(d) {
clearTimeout(timeout);
VMM.Timeline.DataObj.model.googlespreadsheet.buildDataCells(d);
})
.error(function(jqXHR, textStatus, errorThrown) {
trace("Google Docs ERROR");
trace("Google Docs ERROR: " + textStatus + " " + jqXHR.responseText);
})
.success(function(d) {
clearTimeout(timeout);
});
}
requestJsonData();
},
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Finished Parsing Data"); buildDataCells: function(d) {
var data_obj = VMM.Timeline.DataObj.data_template_obj,
is_valid = false,
cellnames = ["timeline"],
list = [],
max_row = 0,
i = 0,
k = 0;
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, VMM.Language.messages.loading_timeline + " Parsing Google Doc Data (cells)");
function getGVar(v) {
if (typeof v != 'undefined') {
return v.$t;
} else {
return "";
}
}
VMM.fireEvent(global, VMM.Timeline.Config.events.data_ready, data_obj); if (typeof d.feed.entry != 'undefined') {
is_valid = true;
// DETERMINE NUMBER OF ROWS
for(i = 0; i < d.feed.entry.length; i++) {
var dd = d.feed.entry[i];
if (parseInt(dd.gs$cell.row) > max_row) {
max_row = parseInt(dd.gs$cell.row);
}
}
// CREATE OBJECT FOR EACH ROW
for(var i = 0; i < max_row + 1; i++) {
var date = {
type: "",
startDate: "",
endDate: "",
headline: "",
text: "",
tag: "",
asset: {
media: "",
credit: "",
caption: "",
thumbnail: ""
}
};
list.push(date);
}
// PREP GOOGLE DOC CELL DATA TO EVALUATE
for(i = 0; i < d.feed.entry.length; i++) {
var dd = d.feed.entry[i],
dd_type = "",
column_name = "",
cell = {
content: getGVar(dd.gs$cell),
col: dd.gs$cell.col,
row: dd.gs$cell.row,
name: ""
};
//trace(cell);
if (cell.row == 1) {
if (cell.content == "Start Date") {
column_name = "startDate";
} else if (cell.content == "End Date") {
column_name = "endDate";
} else if (cell.content == "Headline") {
column_name = "headline";
} else if (cell.content == "Text") {
column_name = "text";
} else if (cell.content == "Media") {
column_name = "media";
} else if (cell.content == "Media Credit") {
column_name = "credit";
} else if (cell.content == "Media Caption") {
column_name = "caption";
} else if (cell.content == "Media Thumbnail") {
column_name = "thumbnail";
} else if (cell.content == "Type") {
column_name = "type";
} else if (cell.content == "Tag") {
column_name = "tag";
}
cellnames.push(column_name);
} else {
cell.name = cellnames[cell.col];
list[cell.row][cell.name] = cell.content;
}
};
for(i = 0; i < list.length; i++) {
var date = list[i];
if (date.type.match("start") || date.type.match("title") ) {
data_obj.timeline.startDate = date.startDate;
data_obj.timeline.headline = date.headline;
data_obj.timeline.asset.media = date.media;
data_obj.timeline.asset.caption = date.caption;
data_obj.timeline.asset.credit = date.credit;
data_obj.timeline.text = date.text;
data_obj.timeline.type = "google spreadsheet";
} else if (date.type.match("era")) {
var era = {
startDate: date.startDate,
endDate: date.endDate,
headline: date.headline,
text: date.text,
tag: date.tag
}
data_obj.timeline.era.push(era);
} else {
var date = {
type: "google spreadsheet",
startDate: date.startDate,
endDate: date.endDate,
headline: date.headline,
text: date.text,
tag: date.tag,
asset: {
media: date.media,
credit: date.credit,
caption: date.caption,
thumbnail: date.thumbnail
}
};
data_obj.timeline.date.push(date);
}
}
//trace(cellnames);
//trace(max_row);
//trace(list);
}
if (is_valid) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Finished Parsing Data");
VMM.fireEvent(global, VMM.Timeline.Config.events.data_ready, data_obj);
} else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Unable to load Google Doc data source");
}
} }
}, },

2
source/js/VMM.Timeline.License.js

@ -1,6 +1,6 @@
/*! /*!
TimelineJS TimelineJS
Version 2.12 Version 2.14
Designed and built by Zach Wise at VéritéCo Designed and built by Zach Wise at VéritéCo
This Source Code Form is subject to the terms of the Mozilla Public This Source Code Form is subject to the terms of the Mozilla Public

6
source/js/VMM.Timeline.js

@ -64,7 +64,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
timeline_id = "#timelinejs"; timeline_id = "#timelinejs";
} }
trace("VERSION " + version);
/* CONFIG /* CONFIG
================================================== */ ================================================== */
@ -83,6 +82,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
touch: false, touch: false,
orientation: "normal", orientation: "normal",
maptype: "toner", maptype: "toner",
version: "2.x",
preload: 4, preload: 4,
current_slide: 0, current_slide: 0,
hash_bookmark: false, hash_bookmark: false,
@ -218,6 +218,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
if (config.gmap_key != "") { if (config.gmap_key != "") {
config.api_keys.google = config.gmap_key; config.api_keys.google = config.gmap_key;
} }
trace("VERSION " + config.version);
version = config.version;
} }
/* CREATE TIMELINE STRUCTURE /* CREATE TIMELINE STRUCTURE
@ -266,7 +269,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
function onDataReady(e, d) { function onDataReady(e, d) {
trace("onDataReady"); trace("onDataReady");
trace(d);
data = d.timeline; data = d.timeline;
if (type.of(data.era) != "array") { if (type.of(data.era) != "array") {

Loading…
Cancel
Save