@ -8,7 +8,11 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM . Timeline . TimeNav = function ( parent , content _width , content _height ) {
VMM . Timeline . TimeNav = function ( parent , content _width , content _height ) {
trace ( "VMM.Timeline.TimeNav" ) ;
trace ( "VMM.Timeline.TimeNav" ) ;
var events = { } ,
var $timenav , $content , $time , $timeintervalminor , $timeinterval , $timeintervalmajor , $timebackground ,
$timeintervalbackground , $timenavline , $timenavindicator , $timeintervalminor _minor , $toolbar , $zoomin , $zoomout , $dragslide ,
config = VMM . Timeline . Config ,
row _height ,
events = { } ,
timespan = { } ,
timespan = { } ,
layout = parent ,
layout = parent ,
data = [ ] ,
data = [ ] ,
@ -31,25 +35,92 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
right : ""
right : ""
}
}
} ,
} ,
$timenav , $content , $time , $timeintervalminor , $timeinterval , $timeintervalmajor , $timebackground ,
timelookup = {
$timeintervalbackground , $timenavline , $timenavindicator , $timeintervalminor _minor , $toolbar , $zoomin , $zoomout , $dragslide ;
day : 24 ,
month : 12 ,
year : 10 ,
hour : 60 ,
var timelookup = { day : 24 , month : 12 , year : 10 , hour : 60 , minute : 60 , second : 1000 , decade : 10 , century : 100 , millenium : 1000 , age : 1000000 , epoch : 10000000 , era : 100000000 , eon : 500000000 , week : 4.34812141 , days _in _month : 30.4368499 , days _in _week : 7 , weeks _in _month : 4.34812141 , weeks _in _year : 52.177457 , days _in _year : 365.242199 , hours _in _day : 24 } ;
minute : 60 ,
var dateFractionBrowser = { day : 86400000 , week : 7 , month : 30.4166666667 , year : 12 , hour : 24 , minute : 1440 , second : 86400 , decade : 10 , century : 100 , millenium : 1000 , age : 1000000 , epoch : 10000000 , era : 100000000 , eon : 500000000 } ;
second : 1000 ,
decade : 10 ,
var interval = { type : "year" , number : 10 , first : 1970 , last : 2011 , multiplier : 100 , classname : "_idd" , interval _type : "interval" } ;
century : 100 ,
var interval _major = { type : "year" , number : 10 , first : 1970 , last : 2011 , multiplier : 100 , classname : "major" , interval _type : "interval major" } ;
millenium : 1000 ,
var interval _macro = { type : "year" , number : 10 , first : 1970 , last : 2011 , multiplier : 100 , classname : "_dd_minor" , interval _type : "interval minor" } ;
age : 1000000 ,
var interval _calc = { day : { } , month : { } , year : { } , hour : { } , minute : { } , second : { } , decade : { } , century : { } , millenium : { } , week : { } , age : { } , epoch : { } , era : { } , eon : { } } ;
epoch : 10000000 ,
era : 100000000 ,
eon : 500000000 ,
week : 4.34812141 ,
days _in _month : 30.4368499 ,
days _in _week : 7 ,
weeks _in _month : 4.34812141 ,
weeks _in _year : 52.177457 ,
days _in _year : 365.242199 ,
hours _in _day : 24
} ,
dateFractionBrowser = {
day : 86400000 ,
week : 7 ,
month : 30.4166666667 ,
year : 12 ,
hour : 24 ,
minute : 1440 ,
second : 86400 ,
decade : 10 ,
century : 100 ,
millenium : 1000 ,
age : 1000000 ,
epoch : 10000000 ,
era : 100000000 ,
eon : 500000000
} ,
interval = {
type : "year" ,
number : 10 ,
first : 1970 ,
last : 2011 ,
multiplier : 100 ,
classname : "_idd" ,
interval _type : "interval"
} ,
interval _major = {
type : "year" ,
number : 10 ,
first : 1970 ,
last : 2011 ,
multiplier : 100 ,
classname : "major" ,
interval _type : "interval major"
} ,
interval _macro = {
type : "year" ,
number : 10 ,
first : 1970 ,
last : 2011 ,
multiplier : 100 ,
classname : "_dd_minor" ,
interval _type : "interval minor"
} ,
interval _calc = {
day : { } ,
month : { } ,
year : { } ,
hour : { } ,
minute : { } ,
second : { } ,
decade : { } ,
century : { } ,
millenium : { } ,
week : { } ,
age : { } ,
epoch : { } ,
era : { } ,
eon : { }
} ;
/ * A D D t o C o n f i g
/ * A D D t o C o n f i g
=== === === === === === === === === === === === === === === === == * /
=== === === === === === === === === === === === === === === === == * /
var config = VMM . Timeline . Config ;
row _height = config . nav . marker . height / 2 ;
var row _height = config . nav . marker . height / 2 ;
//config.nav.rows = [1, config.nav.marker.height, config.nav.marker.height*2];
config . nav . rows = {
config . nav . rows = {
full : [ 1 , row _height * 2 , row _height * 4 ] ,
full : [ 1 , row _height * 2 , row _height * 4 ] ,
half : [ 1 , row _height , row _height * 2 , row _height * 3 , row _height * 4 , row _height * 5 ] ,
half : [ 1 , row _height , row _height * 2 , row _height * 3 , row _height * 4 , row _height * 5 ] ,
@ -63,15 +134,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
config . nav . height = content _height ;
config . nav . height = content _height ;
}
}
/ *
config . nav . density = 2 ;
config . nav . multiplier = {
current : 6 ,
min : . 1 ,
max : 50
} ;
* /
/ * I N I T
/ * I N I T
=== === === === === === === === === === === === === === === === == * /
=== === === === === === === === === === === === === === === === == * /
this . init = function ( d , e ) {
this . init = function ( d , e ) {
@ -306,9 +368,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var last _pos = 0 ,
var last _pos = 0 ,
pos = 0 ,
pos = 0 ,
pos _dif = 0 ,
pos _dif = 0 ,
mp _diff = [ ] ;
mp _diff = [ ] ,
i = 0 ;
for ( var i = 0 ; i < markers . length ; i ++ ) {
for ( i = 0 ; i < markers . length ; i ++ ) {
if ( data [ i ] . type == "start" ) {
if ( data [ i ] . type == "start" ) {
} else {
} else {
@ -323,30 +386,34 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}
}
var averageDateDistance = function ( ) {
var averageDateDistance = function ( ) {
var last _dd = 0 ;
var last _dd = 0 ,
var dd = 0 ;
dd = 0 ,
var date _dif = 0 ;
_dd = "" ,
var date _diffs = [ ] ;
date _dif = 0 ,
var is _first _date = true ;
date _diffs = [ ] ,
is _first _date = true ,
for ( var i = 0 ; i < data . length ; i ++ ) {
i = 0 ;
for ( i = 0 ; i < data . length ; i ++ ) {
if ( data [ i ] . type == "start" ) {
if ( data [ i ] . type == "start" ) {
trace ( "DATA DATE IS START" )
trace ( "DATA DATE IS START" )
} else {
} else {
var _dd = data [ i ] . startdate ;
_dd = data [ i ] . startdate ;
last _dd = dd ;
last _dd = dd ;
dd = _dd ;
dd = _dd ;
date _dif = dd - last _dd ;
date _dif = dd - last _dd ;
date _diffs . push ( date _dif ) ;
date _diffs . push ( date _dif ) ;
}
}
}
}
return VMM . Util . average ( date _diffs ) ;
return VMM . Util . average ( date _diffs ) ;
}
}
var calculateMultiplier = function ( ) {
var calculateMultiplier = function ( ) {
var temp _multiplier = config . nav . multiplier . current ;
var temp _multiplier = config . nav . multiplier . current ,
for ( var i = 0 ; i < temp _multiplier ; i ++ ) {
i = 0 ;
for ( i = 0 ; i < temp _multiplier ; i ++ ) {
if ( averageMarkerPositionDistance ( ) < 75 ) {
if ( averageMarkerPositionDistance ( ) < 75 ) {
if ( config . nav . multiplier . current > 1 ) {
if ( config . nav . multiplier . current > 1 ) {
config . nav . multiplier . current = ( config . nav . multiplier . current - 1 ) ;
config . nav . multiplier . current = ( config . nav . multiplier . current - 1 ) ;
@ -358,8 +425,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var calculateInterval = function ( ) {
var calculateInterval = function ( ) {
// NEED TO REWRITE ALL OF THIS
// NEED TO REWRITE ALL OF THIS
var _first = getDateFractions ( data [ 0 ] . startdate ) ;
var _first = getDateFractions ( data [ 0 ] . startdate ) ,
var _last = getDateFractions ( data [ data . length - 1 ] . enddate ) ;
_last = getDateFractions ( data [ data . length - 1 ] . enddate ) ;
// EON
// EON
interval _calc . eon . type = "eon" ;
interval _calc . eon . type = "eon" ;
@ -531,80 +598,84 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var positionRelative = function ( _interval , first , last ) {
var positionRelative = function ( _interval , first , last ) {
var _first ,
var _first ,
_last ,
_last ,
_type = _interval . type ,
_type = _interval . type ,
timerelative = { start : "" , end : "" , type : _type } ;
timerelative = {
start : "" ,
end : "" ,
type : _type
} ;
/ * F I R S T
/ * F I R S T
=== === === === === === === === === === === === === === === === == * /
=== === === === === === === === === === === === === === === === == * /
_first = getDateFractions ( first ) ;
_first = getDateFractions ( first ) ;
timerelative . start = first . months ;
timerelative . start = first . months ;
if ( _type == "eon" ) {
if ( _type == "eon" ) {
timerelative . start = _first . eons ;
timerelative . start = _first . eons ;
} else if ( _type == "era" ) {
} else if ( _type == "era" ) {
timerelative . start = _first . eras ;
timerelative . start = _first . eras ;
} else if ( _type == "epoch" ) {
} else if ( _type == "epoch" ) {
timerelative . start = _first . epochs ;
timerelative . start = _first . epochs ;
} else if ( _type == "age" ) {
} else if ( _type == "age" ) {
timerelative . start = _first . ages ;
timerelative . start = _first . ages ;
} else if ( _type == "millenium" ) {
} else if ( _type == "millenium" ) {
timerelative . start = first . milleniums ;
timerelative . start = first . milleniums ;
} else if ( _type == "century" ) {
} else if ( _type == "century" ) {
timerelative . start = _first . centuries ;
timerelative . start = _first . centuries ;
} else if ( _type == "decade" ) {
} else if ( _type == "decade" ) {
timerelative . start = _first . decades ;
timerelative . start = _first . decades ;
} else if ( _type == "year" ) {
} else if ( _type == "year" ) {
timerelative . start = _first . years ;
timerelative . start = _first . years ;
} else if ( _type == "month" ) {
} else if ( _type == "month" ) {
timerelative . start = _first . months ;
timerelative . start = _first . months ;
} else if ( _type == "week" ) {
} else if ( _type == "week" ) {
timerelative . start = _first . weeks ;
timerelative . start = _first . weeks ;
} else if ( _type == "day" ) {
} else if ( _type == "day" ) {
timerelative . start = _first . days ;
timerelative . start = _first . days ;
} else if ( _type == "hour" ) {
} else if ( _type == "hour" ) {
timerelative . start = _first . hours ;
timerelative . start = _first . hours ;
} else if ( _type == "minute" ) {
} else if ( _type == "minute" ) {
timerelative . start = _first . minutes ;
timerelative . start = _first . minutes ;
}
}
/ * L A S T
/ * L A S T
=== === === === === === === === === === === === === === === === == * /
=== === === === === === === === === === === === === === === === == * /
if ( type . of ( last ) == "date" ) {
if ( type . of ( last ) == "date" ) {
_last = getDateFractions ( last ) ;
_last = getDateFractions ( last ) ;
timerelative . end = last . months ;
timerelative . end = last . months ;
if ( _type == "eon" ) {
if ( _type == "eon" ) {
timerelative . end = _last . eons ;
timerelative . end = _last . eons ;
} else if ( _type == "era" ) {
} else if ( _type == "era" ) {
timerelative . end = _last . eras ;
timerelative . end = _last . eras ;
} else if ( _type == "epoch" ) {
} else if ( _type == "epoch" ) {
timerelative . end = _last . epochs ;
timerelative . end = _last . epochs ;
} else if ( _type == "age" ) {
} else if ( _type == "age" ) {
timerelative . end = _last . ages ;
timerelative . end = _last . ages ;
} else if ( _type == "millenium" ) {
} else if ( _type == "millenium" ) {
timerelative . end = last . milleniums ;
timerelative . end = last . milleniums ;
} else if ( _type == "century" ) {
} else if ( _type == "century" ) {
timerelative . end = _last . centuries ;
timerelative . end = _last . centuries ;
} else if ( _type == "decade" ) {
} else if ( _type == "decade" ) {
timerelative . end = _last . decades ;
timerelative . end = _last . decades ;
} else if ( _type == "year" ) {
} else if ( _type == "year" ) {
timerelative . end = _last . years ;
timerelative . end = _last . years ;
} else if ( _type == "month" ) {
} else if ( _type == "month" ) {
timerelative . end = _last . months ;
timerelative . end = _last . months ;
} else if ( _type == "week" ) {
} else if ( _type == "week" ) {
timerelative . end = _last . weeks ;
timerelative . end = _last . weeks ;
} else if ( _type == "day" ) {
} else if ( _type == "day" ) {
timerelative . end = _last . days ;
timerelative . end = _last . days ;
} else if ( _type == "hour" ) {
} else if ( _type == "hour" ) {
timerelative . end = _last . hours ;
timerelative . end = _last . hours ;
} else if ( _type == "minute" ) {
} else if ( _type == "minute" ) {
timerelative . end = _last . minutes ;
timerelative . end = _last . minutes ;
}
}
} else {
} else {
timerelative . end = timerelative . start ;
timerelative . end = timerelative . start ;
}
}
@ -632,9 +703,11 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
pos _cache _array = [ ] ,
pos _cache _array = [ ] ,
pos _cache _max = 6 ,
pos _cache _max = 6 ,
in _view = {
in _view = {
left : timenav _pos . visible . left - in _view _margin ,
left : timenav _pos . visible . left - in _view _margin ,
right : timenav _pos . visible . right + in _view _margin
right : timenav _pos . visible . right + in _view _margin
} ;
} ,
i = 0 ,
k = 0 ;
config . nav . minor _width = config . width ;
config . nav . minor _width = config . width ;
@ -642,7 +715,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM . Lib . removeClass ( ".flag" , "row2" ) ;
VMM . Lib . removeClass ( ".flag" , "row2" ) ;
VMM . Lib . removeClass ( ".flag" , "row3" ) ;
VMM . Lib . removeClass ( ".flag" , "row3" ) ;
for ( var i = 0 ; i < markers . length ; i ++ ) {
for ( i = 0 ; i < markers . length ; i ++ ) {
var line ,
var line ,
marker = markers [ i ] ,
marker = markers [ i ] ,
@ -697,7 +770,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// CONTROL ROW POSITION
// CONTROL ROW POSITION
if ( tags . length > 0 ) {
if ( tags . length > 0 ) {
for ( var k = 0 ; k < tags . length ; k ++ ) {
for ( k = 0 ; k < tags . length ; k ++ ) {
if ( k < config . nav . rows . current . length ) {
if ( k < config . nav . rows . current . length ) {
if ( marker . tag == tags [ k ] ) {
if ( marker . tag == tags [ k ] ) {
row = k ;
row = k ;
@ -710,63 +783,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}
}
row _pos = config . nav . rows . current [ row ] ;
row _pos = config . nav . rows . current [ row ] ;
} else {
} else {
/ *
pos _cache _close = 0 ;
for ( var l = 0 ; l < pos _cache _array . length ; l ++ ) {
if ( pos . begin - pos _cache _array [ l ] . pos . begin < ( ( config . nav . marker . width / 2 ) ) ) {
pos _cache _close ++ ;
trace ( "POS CACHE TOO CLOSE" ) ;
markers [ pos _cache _array [ l ] . id ] . full = false ;
VMM . Lib . addClass ( markers [ pos _cache _array [ l ] . id ] . flag , "flag-small" ) ;
}
}
if ( pos _cache _close > 3 ) {
trace ( "POS CACHE TOO CLOSE GRATER THAN 2" ) ;
marker . full = false ;
VMM . Lib . addClass ( marker . flag , "flag-small" ) ;
if ( row < config . nav . rows . current . length - 1 ) {
row ++ ;
} else {
row = 0 ;
row _depth ++ ;
}
if ( config . nav . rows . current == config . nav . rows . full ) {
if ( row _depth _sub == 0 ) {
row _depth _sub = 1 ;
} else {
row _depth _sub = 0 ;
}
row _pos = config . nav . rows . half [ ( row * 2 ) + row _depth _sub ] ;
} else {
row _pos = config . nav . rows . half [ row ] ;
}
} else {
if ( ! marker . full ) {
VMM . Lib . removeClass ( markers [ i ] . flag , "flag-small" ) ;
marker . full = true ;
}
if ( pos . begin - previous _pos . begin < ( config . nav . marker . width + config . spacing ) ) {
if ( row < config . nav . rows . full . length - 1 ) {
row ++ ;
} else {
row = 0 ;
row _depth ++ ;
}
} else {
row _depth = 1 ;
row = 1 ;
}
row _pos = config . nav . rows . full [ row ] ;
}
* /
if ( pos . begin - previous _pos . begin < ( config . nav . marker . width + config . spacing ) ) {
if ( pos . begin - previous _pos . begin < ( config . nav . marker . width + config . spacing ) ) {
if ( row < config . nav . rows . current . length - 1 ) {
if ( row < config . nav . rows . current . length - 1 ) {
@ -781,25 +797,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
row = 1 ;
row = 1 ;
}
}
row _pos = config . nav . rows . current [ row ] ;
row _pos = config . nav . rows . current [ row ] ;
/ *
if ( row _depth > 2 ) {
marker . full = false ;
VMM . Lib . addClass ( marker . flag , "flag-small" ) ;
trace ( config . nav . rows . current ) ;
trace ( config . nav . rows . full ) ;
if ( row _depth _sub == 0 ) {
row _depth _sub = 1 ;
} else {
row _depth _sub = 0 ;
}
if ( config . nav . rows . current == config . nav . rows . full ) {
trace ( config . nav . rows . half [ ( row * 2 ) + 1 ] ) ;
trace ( config . nav . rows . full [ row ] ) ;
row _pos = config . nav . rows . half [ ( row * 2 ) + row _depth _sub ] ;
}
}
* /
}
}
// SET LAST MARKER POSITION
// SET LAST MARKER POSITION
@ -847,7 +845,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}
}
var positionEras = function ( is _animated ) {
var positionEras = function ( is _animated ) {
for ( var i = 0 ; i < era _markers . length ; i ++ ) {
var i = 0 ,
p = 0 ;
for ( i = 0 ; i < era _markers . length ; i ++ ) {
var era = era _markers [ i ] ,
var era = era _markers [ i ] ,
pos = positionOnTimeline ( interval , era . relative _pos ) ,
pos = positionOnTimeline ( interval , era . relative _pos ) ,
row _pos = 0 ,
row _pos = 0 ,
@ -857,7 +858,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// CONTROL ROW POSITION
// CONTROL ROW POSITION
if ( era . tag != "" ) {
if ( era . tag != "" ) {
era _height = ( config . nav . marker . height * config . nav . rows . full . length ) / config . nav . rows . current . length ;
era _height = ( config . nav . marker . height * config . nav . rows . full . length ) / config . nav . rows . current . length ;
for ( var p = 0 ; p < tags . length ; p ++ ) {
for ( p = 0 ; p < tags . length ; p ++ ) {
if ( p < config . nav . rows . current . length ) {
if ( p < config . nav . rows . current . length ) {
if ( era . tag == tags [ p ] ) {
if ( era . tag == tags [ p ] ) {
row = p ;
row = p ;
@ -900,7 +901,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
left : timenav _pos . visible . left - in _view _margin ,
left : timenav _pos . visible . left - in _view _margin ,
right : timenav _pos . visible . right + in _view _margin
right : timenav _pos . visible . right + in _view _margin
}
}
not _too _many = true ;
not _too _many = true ,
i = 0 ;
config . nav . minor _left = 0 ;
config . nav . minor _left = 0 ;
@ -910,7 +912,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}
}
for ( var i = 0 ; i < the _intervals . length ; i ++ ) {
for ( i = 0 ; i < the _intervals . length ; i ++ ) {
var _interval = the _intervals [ i ] . element ,
var _interval = the _intervals [ i ] . element ,
_interval _date = the _intervals [ i ] . date ,
_interval _date = the _intervals [ i ] . date ,
_interval _visible = the _intervals [ i ] . visible ,
_interval _visible = the _intervals [ i ] . visible ,
@ -998,18 +1000,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
if ( pos > config . nav . minor _width ) {
if ( pos > config . nav . minor _width ) {
config . nav . minor _width = pos ;
config . nav . minor _width = pos ;
//config.nav.constraint.right_min = -pos;
//config.nav.constraint.right = config.nav.constraint.right_min + (config.width/2);
}
}
if ( pos < config . nav . minor _left ) {
if ( pos < config . nav . minor _left ) {
config . nav . minor _left = pos ;
config . nav . minor _left = pos ;
//config.nav.constraint.right_min = pos;
//config.nav.constraint.right = config.nav.constraint.right_min + (config.width/2);
}
}
}
}
@ -1022,25 +1016,12 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}
}
}
}
config . nav . constraint . right _min = - ( config . nav . minor _width ) + ( config . width ) ;
config . nav . constraint . right _min = - ( config . nav . minor _width ) + ( config . width ) ;
config . nav . constraint . right = config . nav . constraint . right _min + ( config . width / 2 ) ;
config . nav . constraint . right = config . nav . constraint . right _min + ( config . width / 2 ) ;
VMM . Lib . css ( $timeintervalminor _minor , "left" , config . nav . minor _left - ( config . width ) / 2 ) ;
VMM . Lib . css ( $timeintervalminor _minor , "left" , config . nav . minor _left - ( config . width ) / 2 ) ;
VMM . Lib . width ( $timeintervalminor _minor , ( config . nav . minor _width ) + ( config . width ) + Math . abs ( config . nav . minor _left ) ) ;
VMM . Lib . width ( $timeintervalminor _minor , ( config . nav . minor _width ) + ( config . width ) + Math . abs ( config . nav . minor _left ) ) ;
//trace((config.nav.minor_width/config.nav.multiplier.current)/2)
/ *
for ( var k = 0 ; k < the _intervals . length ; k ++ ) {
var _animation = the _intervals [ k ] . animation ;
if ( _animation . animate ) {
var _interval = the _intervals [ k ] . interval _element ;
VMM . Lib . animate ( _interval , config . duration / 2 , config . ease , { opacity : _animation . opacity , left : _animation . pos } , "interval_que" ) ;
}
}
* /
}
}
/ * I n t e r v a l E l e m e n t s
/ * I n t e r v a l E l e m e n t s
@ -1058,14 +1039,15 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
firefox = {
firefox = {
flag : false ,
flag : false ,
offset : 0
offset : 0
} ;
} ,
i = 0 ;
VMM . attachElement ( _element _parent , "" ) ;
VMM . attachElement ( _element _parent , "" ) ;
_interval . date = new Date ( data [ 0 ] . startdate . getFullYear ( ) , 0 , 1 , 0 , 0 , 0 ) ;
_interval . date = new Date ( data [ 0 ] . startdate . getFullYear ( ) , 0 , 1 , 0 , 0 , 0 ) ;
_timezone _offset = _interval . date . getTimezoneOffset ( ) ;
_timezone _offset = _interval . date . getTimezoneOffset ( ) ;
for ( var i = 0 ; i < int _number ; i ++ ) {
for ( i = 0 ; i < int _number ; i ++ ) {
trace ( _interval . type ) ;
trace ( _interval . type ) ;
var _is _year = false ,
var _is _year = false ,
int _obj = {
int _obj = {
@ -1251,21 +1233,25 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
/ * B U I L D
/ * B U I L D
=== === === === === === === === === === === === === === === === == * /
=== === === === === === === === === === === === === === === === == * /
var build = function ( ) {
var build = function ( ) {
var i = 0 ,
j = 0 ;
VMM . attachElement ( layout , "" ) ;
VMM . attachElement ( layout , "" ) ;
$timenav = VMM . appendAndGetElement ( layout , "<div>" , "timenav" ) ;
$timenav = VMM . appendAndGetElement ( layout , "<div>" , "timenav" ) ;
$content = VMM . appendAndGetElement ( $timenav , "<div>" , "content" ) ;
$content = VMM . appendAndGetElement ( $timenav , "<div>" , "content" ) ;
$time = VMM . appendAndGetElement ( $timenav , "<div>" , "time" ) ;
$time = VMM . appendAndGetElement ( $timenav , "<div>" , "time" ) ;
$timeintervalminor = VMM . appendAndGetElement ( $time , "<div>" , "time-interval-minor" ) ;
$timeintervalminor = VMM . appendAndGetElement ( $time , "<div>" , "time-interval-minor" ) ;
$timeintervalminor _minor = VMM . appendAndGetElement ( $timeintervalminor , "<div>" , "minor" ) ;
$timeintervalminor _minor = VMM . appendAndGetElement ( $timeintervalminor , "<div>" , "minor" ) ;
$timeintervalmajor = VMM . appendAndGetElement ( $time , "<div>" , "time-interval-major" ) ;
$timeintervalmajor = VMM . appendAndGetElement ( $time , "<div>" , "time-interval-major" ) ;
$timeinterval = VMM . appendAndGetElement ( $time , "<div>" , "time-interval" ) ;
$timeinterval = VMM . appendAndGetElement ( $time , "<div>" , "time-interval" ) ;
$timebackground = VMM . appendAndGetElement ( layout , "<div>" , "timenav-background" ) ;
$timebackground = VMM . appendAndGetElement ( layout , "<div>" , "timenav-background" ) ;
$timenavline = VMM . appendAndGetElement ( $timebackground , "<div>" , "timenav-line" ) ;
$timenavline = VMM . appendAndGetElement ( $timebackground , "<div>" , "timenav-line" ) ;
$timenavindicator = VMM . appendAndGetElement ( $timebackground , "<div>" , "timenav-indicator" ) ;
$timenavindicator = VMM . appendAndGetElement ( $timebackground , "<div>" , "timenav-indicator" ) ;
$timeintervalbackground = VMM . appendAndGetElement ( $timebackground , "<div>" , "timenav-interval-background" , "<div class='top-highlight'></div>" ) ;
$timeintervalbackground = VMM . appendAndGetElement ( $timebackground , "<div>" , "timenav-interval-background" , "<div class='top-highlight'></div>" ) ;
$toolbar = VMM . appendAndGetElement ( layout , "<div>" , "toolbar" ) ;
$toolbar = VMM . appendAndGetElement ( layout , "<div>" , "toolbar" ) ;
$zoomin = VMM . appendAndGetElement ( $toolbar , "<div>" , "zoom-in" , "<div class='icon'></div>" ) ;
$zoomout = VMM . appendAndGetElement ( $toolbar , "<div>" , "zoom-out" , "<div class='icon'></div>" ) ;
buildInterval ( ) ;
buildInterval ( ) ;
buildMarkers ( ) ;
buildMarkers ( ) ;
@ -1287,8 +1273,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}
}
$zoomin = VMM . appendAndGetElement ( $toolbar , "<div>" , "zoom-in" , "<div class='icon'></div>" ) ;
$zoomout = VMM . appendAndGetElement ( $toolbar , "<div>" , "zoom-out" , "<div class='icon'></div>" ) ;
// MAKE TIMELINE DRAGGABLE/TOUCHABLE
// MAKE TIMELINE DRAGGABLE/TOUCHABLE
$dragslide = new VMM . DragSlider ;
$dragslide = new VMM . DragSlider ;
@ -1320,11 +1304,11 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// USER CONFIGURABLE ADJUSTMENT TO DEFAULT ZOOM
// USER CONFIGURABLE ADJUSTMENT TO DEFAULT ZOOM
if ( config . nav . zoom . adjust != 0 ) {
if ( config . nav . zoom . adjust != 0 ) {
if ( config . nav . zoom . adjust < 0 ) {
if ( config . nav . zoom . adjust < 0 ) {
for ( var i = 0 ; i < Math . abs ( config . nav . zoom . adjust ) ; i ++ ) {
for ( i = 0 ; i < Math . abs ( config . nav . zoom . adjust ) ; i ++ ) {
onZoomOut ( ) ;
onZoomOut ( ) ;
}
}
} else {
} else {
for ( var j = 0 ; j < config . nav . zoom . adjust ; j ++ ) {
for ( j = 0 ; j < config . nav . zoom . adjust ; j ++ ) {
onZoomIn ( ) ;
onZoomIn ( ) ;
}
}
}
}
@ -1333,7 +1317,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} ;
} ;
var buildInterval = function ( ) {
var buildInterval = function ( ) {
var i = 0 ,
j = 0 ;
// CALCULATE INTERVAL
// CALCULATE INTERVAL
timespan = getDateFractions ( ( data [ data . length - 1 ] . enddate ) - ( data [ 0 ] . startdate ) , true ) ;
timespan = getDateFractions ( ( data [ data . length - 1 ] . enddate ) - ( data [ 0 ] . startdate ) , true ) ;
trace ( timespan ) ;
trace ( timespan ) ;
@ -1411,8 +1396,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
createIntervalElements ( interval _major , interval _major _array , $timeintervalmajor ) ;
createIntervalElements ( interval _major , interval _major _array , $timeintervalmajor ) ;
// Cleanup duplicate interval elements between normal and major
// Cleanup duplicate interval elements between normal and major
for ( var i = 0 ; i < interval _array . length ; i ++ ) {
for ( i = 0 ; i < interval _array . length ; i ++ ) {
for ( var j = 0 ; j < interval _major _array . length ; j ++ ) {
for ( j = 0 ; j < interval _major _array . length ; j ++ ) {
if ( interval _array [ i ] . date _string == interval _major _array [ j ] . date _string ) {
if ( interval _array [ i ] . date _string == interval _major _array [ j ] . date _string ) {
VMM . attachElement ( interval _array [ i ] . element , "" ) ;
VMM . attachElement ( interval _array [ i ] . element , "" ) ;
}
}
@ -1424,14 +1409,27 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var row = 2 ,
var row = 2 ,
lpos = 0 ,
lpos = 0 ,
row _depth = 0 ;
row _depth = 0 ,
i = 0 ,
k = 0 ,
l = 0 ;
markers = [ ] ;
markers = [ ] ;
era _markers = [ ] ;
era _markers = [ ] ;
for ( var i = 0 ; i < data . length ; i ++ ) {
for ( i = 0 ; i < data . length ; i ++ ) {
var _marker ,
_marker _flag ,
_marker _content ,
_marker _dot ,
_marker _line ,
_marker _line _event ,
_marker _obj ,
_marker _title = "" ,
has _title = false ;
var _marker , _marker _flag , _marker _content , _marker _dot , _marker _line , _marker _line _event , _marker _title = "" , has _title = false ;
_marker = VMM . appendAndGetElement ( $content , "<div>" , "marker" ) ;
_marker = VMM . appendAndGetElement ( $content , "<div>" , "marker" ) ;
_marker _flag = VMM . appendAndGetElement ( _marker , "<div>" , "flag" ) ;
_marker _flag = VMM . appendAndGetElement ( _marker , "<div>" , "flag" ) ;
@ -1488,7 +1486,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM . bindEvent ( _marker _flag , onMarkerClick , "" , { number : i } ) ;
VMM . bindEvent ( _marker _flag , onMarkerClick , "" , { number : i } ) ;
VMM . bindEvent ( _marker _flag , onMarkerHover , "mouseenter mouseleave" , { number : i , elem : _marker _flag } ) ;
VMM . bindEvent ( _marker _flag , onMarkerHover , "mouseenter mouseleave" , { number : i , elem : _marker _flag } ) ;
var _marker _obj = {
_marker _obj = {
marker : _marker ,
marker : _marker ,
flag : _marker _flag ,
flag : _marker _flag ,
lineevent : _marker _line _event ,
lineevent : _marker _line _event ,
@ -1527,7 +1525,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} else {
} else {
config . nav . rows . current = config . nav . rows . full ;
config . nav . rows . current = config . nav . rows . full ;
}
}
for ( var k = 0 ; k < tags . length ; k ++ ) {
for ( k = 0 ; k < tags . length ; k ++ ) {
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 ) ) ;
@ -1543,7 +1541,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 > 2 ) {
for ( var 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 ;
}
}
@ -1554,9 +1552,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var buildEras = function ( ) {
var buildEras = function ( ) {
var number _of _colors = 6 ,
var number _of _colors = 6 ,
current _color = 0 ;
current _color = 0 ,
j = 0 ;
// CREATE ERAS
// CREATE ERAS
for ( var j = 0 ; j < eras . length ; j ++ ) {
for ( j = 0 ; j < eras . length ; j ++ ) {
var era = {
var era = {
content : VMM . appendAndGetElement ( $content , "<div>" , "era" ) ,
content : VMM . appendAndGetElement ( $content , "<div>" , "era" ) ,
text _content : VMM . appendAndGetElement ( $timeinterval , "<div>" , "era" ) ,
text _content : VMM . appendAndGetElement ( $timeinterval , "<div>" , "era" ) ,
@ -1569,29 +1568,21 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} ,
} ,
st = VMM . Date . prettyDate ( era . startdate ) ,
st = VMM . Date . prettyDate ( era . startdate ) ,
en = VMM . Date . prettyDate ( era . enddate ) ,
en = VMM . Date . prettyDate ( era . enddate ) ,
era _text = "" ;
era _text = "<div> </div>" ;
if ( typeof eras [ j ] . tag != "undefined" ) {
if ( typeof eras [ j ] . tag != "undefined" ) {
era . tag = eras [ j ] . tag ;
era . tag = eras [ j ] . tag ;
}
}
era . relative _pos = positionRelative ( interval , era . startdate , era . enddate ) ;
era . relative _pos = positionRelative ( interval , era . startdate , era . enddate ) ;
VMM . Lib . attr ( era . content , "id" , era . uniqueid ) ;
VMM . Lib . attr ( era . content , "id" , era . uniqueid ) ;
VMM . Lib . attr ( era . text _content , "id" , era . uniqueid + "_text" ) ;
VMM . Lib . attr ( era . text _content , "id" , era . uniqueid + "_text" ) ;
//VMM.Lib.css(era.content, "background", era.color);
era _text += "<div> " ;
//era_text += "<h3>" + VMM.Util.unlinkify(era.title) + "</h3>"
if ( st != en ) {
//era_text += "<h4>" + st + " — " + en + "</h4>";
} else {
//era_text += "<h4>" + st + "</h4>";
}
era _text += "</div>" ;
// Background Color
// Background Color
VMM . Lib . addClass ( era . content , "era" + ( current _color + 1 ) ) ;
VMM . Lib . addClass ( era . content , "era" + ( current _color + 1 ) ) ;
VMM . Lib . addClass ( era . text _content , "era" + ( current _color + 1 ) ) ;
VMM . Lib . addClass ( era . text _content , "era" + ( current _color + 1 ) ) ;
if ( current _color < number _of _colors ) {
if ( current _color < number _of _colors ) {
current _color ++ ;
current _color ++ ;
} else {
} else {