@ -1,6 +1,6 @@
/ * !
TimelineJS
Version 2.12
Version 2.14
Designed and built by Zach Wise at VéritéCo
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" ;
}
trace ( "VERSION " + version ) ;
/ * C O N F I G
=== === === === === === === === === === === === === === === === == * /
@ -6542,6 +6541,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
touch : false ,
orientation : "normal" ,
maptype : "toner" ,
version : "2.x" ,
preload : 4 ,
current _slide : 0 ,
hash _bookmark : false ,
@ -6677,6 +6677,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
if ( config . gmap _key != "" ) {
config . api _keys . google = config . gmap _key ;
}
trace ( "VERSION " + config . version ) ;
version = config . version ;
}
/ * C R E A T E T I M E L I N E S T R U C T U R E
@ -6725,7 +6728,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
function onDataReady ( e , d ) {
trace ( "onDataReady" ) ;
trace ( d ) ;
data = d . timeline ;
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" ;
timeout = setTimeout ( function ( ) {
trace ( "Google Docs timeout" ) ;
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" ) ;
}
} , 6000 ) ;
} , 1 6000) ;
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 ) {
trace ( "Google Docs ERROR" ) ;
trace ( "Google Docs ERROR: " + textStatus + " " + jqXHR . responseText ) ;
@ -9001,9 +9008,10 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
} ,
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 ) {
if ( typeof v != 'undefined' ) {
@ -9012,57 +9020,257 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
return "" ;
}
}
if ( typeof d . feed . entry != 'undefined' ) {
is _valid = true ;
for ( var i = 0 ; i < d . feed . entry . length ; i ++ ) {
var dd = d . feed . entry [ i ] ,
dd _type = "" ;
if ( typeof dd . gsx$type != 'undefined' ) {
dd _type = dd . gsx$type . $t ;
} else if ( typeof dd . gsx$titleslide != 'undefined' ) {
dd _type = dd . gsx$titleslide . $t ;
}
for ( var i = 0 ; i < d . feed . entry . length ; i ++ ) {
var dd = d . feed . entry [ i ] ,
dd _type = "" ;
if ( dd _type . match ( "start" ) || dd _type . match ( "title" ) ) {
data _obj . timeline . startDate = getGVar ( dd . gsx$startdate ) ;
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 ) ,
endDate : getGVar ( dd . gsx$enddate ) ,
headline : getGVar ( dd . gsx$headline ) ,
text : getGVar ( dd . gsx$text ) ,
tag : getGVar ( dd . gsx$tag )
if ( typeof dd . gsx$type != 'undefined' ) {
dd _type = dd . gsx$type . $t ;
} else if ( typeof dd . gsx$titleslide != 'undefined' ) {
dd _type = dd . gsx$titleslide . $t ;
}
data _obj . timeline . era . push ( era ) ;
} else {
var date = {
type : "google spreadsheet" ,
if ( dd _type . match ( "start" ) || dd _type . match ( "title" ) ) {
data _obj . timeline . startDate = getGVar ( dd . gsx$startdate ) ;
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 ) ,
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 )
}
tag : getGVar ( dd . gsx$tag )
}
data _obj . timeline . era . push ( era ) ;
} else {
var date = {
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 ) ;
}
} ;
} 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 ( ) ;
} ,
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 ) ;
}
data _obj . timeline . date . push ( date ) ;
}
} ;
VMM . fireEvent ( global , VMM . Timeline . Config . events . messege , "Finished Parsing Data" ) ;
//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" ) ;
}
}
} ,