Browse Source

Refactored the way that the time interval is created and modified.

Zoom should be much smoother now and interval animates upon zooming.
pull/23/merge
Zach Wise 13 years ago
parent
commit
a2f5e15667
  1. 5
      locale/de.js
  2. 5
      locale/en.js
  3. 5
      locale/es.js
  4. 5
      locale/fr.js
  5. 5
      locale/is.js
  6. 5
      locale/it.js
  7. 5
      locale/kr.js
  8. 5
      locale/nl.js
  9. 5
      locale/pt-br.js
  10. 5
      locale/zh-ch.js
  11. 5
      locale/zh-tw.js
  12. 4
      source/js/VMM.Language.js
  13. 76
      source/js/VMM.Slider.js
  14. 265
      source/js/VMM.Timeline.TimeNav.js
  15. 135
      source/js/VMM.Timeline.js
  16. 6
      source/js/VMM.Util.js
  17. 4
      source/js/locale/en.js
  18. 5
      timeline-min.js
  19. 486
      timeline.js

5
locale/de.js

File diff suppressed because one or more lines are too long

5
locale/en.js

File diff suppressed because one or more lines are too long

5
locale/es.js

File diff suppressed because one or more lines are too long

5
locale/fr.js

File diff suppressed because one or more lines are too long

5
locale/is.js

File diff suppressed because one or more lines are too long

5
locale/it.js

File diff suppressed because one or more lines are too long

5
locale/kr.js

File diff suppressed because one or more lines are too long

5
locale/nl.js

File diff suppressed because one or more lines are too long

5
locale/pt-br.js

File diff suppressed because one or more lines are too long

5
locale/zh-ch.js

File diff suppressed because one or more lines are too long

5
locale/zh-tw.js

File diff suppressed because one or more lines are too long

4
source/js/VMM.Language.js

@ -14,8 +14,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Language == 'undefined') {
month: "mmmm yyyy", month: "mmmm yyyy",
full_short: "mmm d", full_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "hh:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "hh:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
}, },

76
source/js/VMM.Slider.js

@ -350,28 +350,78 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Element.css(".slider-item", "width", config.slider.content.width ); VMM.Element.css(".slider-item", "width", config.slider.content.width );
VMM.Element.height(".slider-item", config.slider.height); VMM.Element.height(".slider-item", config.slider.height);
VMM.Element.css(".slider-item .layout-text-media .media .media-container img", "max-height", config.slider.height - 50 );
VMM.Element.css(".slider-item .layout-media .media .media-container img", "max-height", config.slider.height - 150 ); /* RESIZE IFRAME MEDIA ELEMENTS
================================================== */
//var _iframe_height = Math.round(config.height) - 60;
var _iframe_height_full = Math.round(config.slider.height) - 160;
//var _iframe_width = Math.round((_iframe_height / 9) * 16);
var _iframe_width_full = Math.round((_iframe_height_full / 9) * 16);
var _iframe_width = (config.slider.content.width/100)*60 ;
var _iframe_height = Math.round((_iframe_width / 16) * 9) + 25;
/* MEDIA HEIGHT
================================================== */
var _media_height = Math.round(config.slider.height) - 160;
//var _text_height = config.slider.height;
var _media_width_with_text = ((config.slider.content.width/100) * 60);
/* FIX FOR NON-WEBKIT BROWSERS /* FIX FOR NON-WEBKIT BROWSERS
================================================== */ ================================================== */
VMM.Element.css(".slider-item .layout-text-media .media .media-container img", "max-width", ((config.slider.content.width/100) * 60) );
VMM.Element.css(".slider-item .layout-text-media .media .media-container .twitter .avatar img", "max-width", 32 ); VMM.Element.css(".slider-item .layout-text-media .media .media-container .twitter .avatar img", "max-width", 32 );
VMM.Element.css(".slider-item .layout-text-media .media .media-container .twitter .avatar img", "max-height", 32 ); VMM.Element.css(".slider-item .layout-text-media .media .media-container .twitter .avatar img", "max-height", 32 );
/* SOUNDCLOUD /* SOUNDCLOUD
================================================== */ ================================================== */
VMM.Element.css(".slider-item .media .media-container .soundcloud", "max-height", 168 ); VMM.Element.css(".slider-item .media .media-container .soundcloud", "max-height", 168 );
/* RESIZE IFRAME MEDIA ELEMENTS /* HANDLE SMALLER SIZES
================================================== */ ================================================== */
//var _iframe_height = Math.round(config.height) - 60; if (config.width <= 650) {
var _iframe_height_full = Math.round(config.slider.height) - 160; _media_height = ((config.slider.height/100) * 40 ) - 40;
//var _iframe_width = Math.round((_iframe_height / 9) * 16); //_text_height = (config.slider.height/100) * 60;
var _iframe_width_full = Math.round((_iframe_height_full / 9) * 16); _iframe_width = config.slider.content.width;
_media_width_with_text = config.slider.content.width;
var _iframe_width = (config.slider.content.width/100)*60 ; VMM.Element.css(".slider-item .layout-text-media .text", "width", "100%" );
var _iframe_height = Math.round((_iframe_width / 16) * 9) + 25; VMM.Element.css(".slider-item .layout-text-media .text", "display", "block" );
VMM.Element.css(".slider-item .layout-text-media .media", "float", "none" );
//VMM.Element.css(".slider-item .layout-text-media .media", "width", "100%" );
VMM.Element.css(".slider-item .media blockquote p", "line-height", "18px" );
VMM.Element.css(".slider-item .media blockquote p", "font-size", "16px" );
VMM.Element.css(".slider-item .layout-text-media", "height", config.slider.height );
VMM.Element.css(".slider-item .layout-text-media", "overflow", "auto" );
VMM.Element.css(".slider-item .layout-text-media", "display", "block" );
} else {
_media_height = config.slider.height - 40;
//_text_height = config.slider.height;
_iframe_width = (config.slider.content.width/100)*60 ;
_media_width_with_text = ((config.slider.content.width/100) * 60);
VMM.Element.css(".slider-item .layout-text-media .text", "width", "40%" );
VMM.Element.css(".slider-item .layout-text-media .text", "display", "table-cell" );
VMM.Element.css(".slider-item .layout-text-media .media", "float", "left" );
//VMM.Element.css(".slider-item .layout-text-media .media", "width", "60%" );
VMM.Element.css(".slider-item .layout-text-media", "display", "table" );
}
// TEXT
//VMM.Element.css(".slider-item .layout-text-media .text", "max-height", _text_height );
//VMM.Element.css(".slider-item .layout-text-media .text", "overflow", "auto" );
// IMAGES
VMM.Element.css(".slider-item .layout-text-media .media .media-container img", "max-height", _media_height );
VMM.Element.css(".slider-item .layout-media .media .media-container img", "max-height", _media_height - 100 );
/* FIX FOR NON-WEBKIT BROWSERS
================================================== */
VMM.Element.css(".slider-item .layout-text-media .media .media-container img", "max-width", _media_width_with_text );
// NORMAL // NORMAL
VMM.Element.height(".slider-item .media .media-container .media-frame", _iframe_height); VMM.Element.height(".slider-item .media .media-container .media-frame", _iframe_height);
@ -387,12 +437,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Element.width(".slider-item .layout-text-media .media .media-container .soundcloud", _iframe_width); VMM.Element.width(".slider-item .layout-text-media .media .media-container .soundcloud", _iframe_width);
// MAPS // MAPS
VMM.Element.height(".slider-item .layout-text-media .media .media-container .map", _media_height);
VMM.Element.height(".slider-item .layout-media .media .media-container .map", _iframe_height_full+60); VMM.Element.height(".slider-item .layout-media .media .media-container .map", _iframe_height_full+60);
VMM.Element.height(".slider-item .layout-text-media .media .media-container .map", _iframe_height_full+120);
// MAPS // DOCS
VMM.Element.height(".slider-item .layout-text-media .media .media-container .doc", _media_height);
VMM.Element.height(".slider-item .layout-media .media .media-container .doc", _iframe_height_full+60); VMM.Element.height(".slider-item .layout-media .media .media-container .doc", _iframe_height_full+60);
VMM.Element.height(".slider-item .layout-text-media .media .media-container .doc", _iframe_height_full+120);
// MAX WIDTH // MAX WIDTH
VMM.Element.css(".slider-item .layout-text-media .media .media-container .media-frame", "max-width", config.slider.content.width ); VMM.Element.css(".slider-item .layout-text-media .media .media-container .media-frame", "max-width", config.slider.content.width );

265
source/js/VMM.Timeline.TimeNav.js

@ -12,6 +12,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var era_markers = []; var era_markers = [];
var markers = []; // HOLDS MARKER DOM OBJECTS var markers = []; // HOLDS MARKER DOM OBJECTS
var interval_array = []; var interval_array = [];
var interval_major_array = [];
var timespan = {}; var timespan = {};
var current_marker = 0; // CURRENT MARKER var current_marker = 0; // CURRENT MARKER
var _active = false; var _active = false;
@ -219,7 +220,12 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
if (config.multiplier <= 1) { if (config.multiplier <= 1) {
config.multiplier = config.multiplier - .25; config.multiplier = config.multiplier - .25;
} else { } else {
config.multiplier = config.multiplier - 1; if (config.multiplier > 5) {
config.multiplier = Math.round(config.multiplier - 4);
} else {
config.multiplier = Math.round(config.multiplier - 1);
}
} }
if (config.multiplier <= 0) { if (config.multiplier <= 0) {
config.multiplier = config.min_multiplier; config.multiplier = config.min_multiplier;
@ -231,9 +237,14 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
function onZoomOut() { function onZoomOut() {
VMM.DragSlider.cancelSlide(); VMM.DragSlider.cancelSlide();
if (config.multiplier < config.max_multiplier) { if (config.multiplier < config.max_multiplier) {
config.multiplier = config.multiplier + 1; if (config.multiplier > 4) {
if (config.multiplier == config.max_multiplier) { config.multiplier = Math.round(config.multiplier + 4);
} else {
config.multiplier = Math.round(config.multiplier + 1);
}
if (config.multiplier >= config.max_multiplier) {
config.multiplier = config.max_multiplier;
} }
refreshTimeline(); refreshTimeline();
} }
@ -375,19 +386,27 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
var positionOnTimeline = function(the_interval, first, last) { var positionOnTimeline = function(the_interval, first, last) {
var _type = the_interval.type; var _type = the_interval.type;
var _multiplier = the_interval.multiplier; var _multiplier = the_interval.multiplier;
var _first = getDateFractions(first); var _first = getDateFractions(first);
var _last = getDateFractions(last); var _last;
var tsd;
var ted;
/* CALCULATE POSITION ON TIMELINE /* CALCULATE POSITION ON TIMELINE
================================================== */ ================================================== */
var tsd = first.months; tsd = first.months;
var ted = last.months;
if (type.of(last) == "date") {
/* LAST
================================================== */
_last = getDateFractions(last);
ted = last.months;
if (_type == "millenium") { if (_type == "millenium") {
tsd = first.milleniums; tsd = first.milleniums;
@ -418,10 +437,46 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
ted = _last.minutes; ted = _last.minutes;
} }
_pos = ( tsd - interval.base ) * (config.interval_width / config.multiplier); _pos = ( tsd - interval.base ) * (config.interval_width / config.multiplier);
_pos_end = ( ted - interval.base ) * (config.interval_width / config.multiplier); _pos_end = ( ted - interval.base ) * (config.interval_width / config.multiplier);
} else {
if (_type == "millenium") {
tsd = first.milleniums;
ted = first.milleniums;
} else if (_type == "century") {
tsd = _first.centuries;
ted = _first.centuries;
} else if (_type == "decade") {
tsd = _first.decades;
ted = _first.decades;
} else if (_type == "year") {
tsd = _first.years;
ted = _first.years;
} else if (_type == "month") {
tsd = _first.months;
ted = _first.months;
} else if (_type == "week") {
tsd = _first.weeks;
ted = _first.weeks;
} else if (_type == "day") {
tsd = _first.days;
ted = _first.days;
} else if (_type == "hour") {
tsd = _first.hours;
ted = _first.hours;
} else if (_type == "minute") {
tsd = _first.minutes;
ted = _first.minutes;
}
_pos = ( tsd - interval.base ) * (config.interval_width / config.multiplier);
_pos_end = _pos;
}
return pos = {begin:_pos ,end:_pos_end}; return pos = {begin:_pos ,end:_pos_end};
} }
@ -473,8 +528,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
var calculateMultiplier = function() { var calculateMultiplier = function() {
var temp_multiplier = config.multiplier; var temp_multiplier = config.multiplier;
for(var i = 0; i < temp_multiplier; i++) { for(var i = 0; i < temp_multiplier; i++) {
@ -583,6 +636,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.Element.visible(_marker, false); VMM.Element.visible(_marker, false);
} }
} }
for(var j = 0; j < era_markers.length; j++) { for(var j = 0; j < era_markers.length; j++) {
@ -756,6 +811,75 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_calc.second.minor = 10; interval_calc.second.minor = 10;
} }
var rePositionInterval = function(the_intervals, is_animated) {
var _type = interval.type;
var _multiplier = interval.multiplier;
var last_position = 0;
var last_position_major = 0;
for(var i = 0; i < the_intervals.length; i++) {
var _interval = the_intervals[i].interval_element;
var _interval_date = the_intervals[i].interval_date;
var _interval_visible = the_intervals[i].interval_visible;
var _pos = positionOnTimeline(interval, _interval_date);
var pos = _pos.begin;
/* APPLY POSITION TO MARKER
================================================== */
if (is_animated) {
//VMM.Element.stop(_interval);
VMM.Element.animate(_interval, config.duration/2, config.ease, {"left": pos});
} else {
VMM.Element.css(_interval, "left", pos);
}
/* CONDENSE WHAT IS DISPLAYED
================================================== */
//VMM.Element.css(_interval, "display", "block");
var is_visible = true;
if ((pos - last_position) < 65 ) {
if ((pos - last_position) < 35 ) {
if (i%4 == 0) {
if (pos == 0) {
is_visible = false;
}
} else {
is_visible = false;
}
} else {
if (!VMM.Util.isEven(i)) {
is_visible = false;
}
}
}
if (_interval_visible) {
if (!is_visible) {
VMM.Element.animate(_interval, config.duration*2, config.ease, {"opacity": 0});
the_intervals[i].interval_visible = false;
}
} else {
if (is_visible) {
VMM.Element.animate(_interval, config.duration*2, config.ease, {"opacity": 100});
the_intervals[i].interval_visible = true;
}
}
last_position = pos;
}
var pos_offset = 50;
var interval_width = (last_position)+(pos_offset*6);
VMM.Element.width($timeintervalminor_minor, interval_width);
}
var positionInterval = function() { var positionInterval = function() {
VMM.attachElement($timeinterval, ""); VMM.attachElement($timeinterval, "");
@ -782,41 +906,41 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 100) * 100 ); interval.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 100) * 100 );
} }
interval.date.setFullYear(interval.date.getFullYear() + (inc_time * 100)); interval.date.setFullYear(interval.date.getFullYear() + (inc_time * 100));
_idd = Math.floor(interval.date.getFullYear() / 100) * 100; //_idd = Math.floor(interval.date.getFullYear() / 100) * 100;
} else if (interval.type == "decade") { } else if (interval.type == "decade") {
if (_first_run) { if (_first_run) {
interval.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 10) * 10 ); interval.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 10) * 10 );
} }
interval.date.setFullYear(interval.date.getFullYear() + (inc_time * 10)); interval.date.setFullYear(interval.date.getFullYear() + (inc_time * 10));
_idd = Math.floor(interval.date.getFullYear() / 10) * 10; //_idd = Math.floor(interval.date.getFullYear() / 10) * 10;
} else if (interval.type == "year") { } else if (interval.type == "year") {
if (_first_run) { if (_first_run) {
} }
interval.date.setFullYear(interval.date.getFullYear() + inc_time); interval.date.setFullYear(interval.date.getFullYear() + inc_time);
//_idd = interval.date.getFullYear(); //_idd = interval.date.getFullYear();
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} else if (interval.type == "month") { } else if (interval.type == "month") {
if (_first_run) { if (_first_run) {
interval.date.setMonth(data[0].startdate.getMonth()); interval.date.setMonth(data[0].startdate.getMonth());
} }
interval.date.setMonth(interval.date.getMonth() + inc_time); interval.date.setMonth(interval.date.getMonth() + inc_time);
//_idd = VMM.Util.date.month[interval.date.getMonth()] + ", " + interval.date.getFullYear() ; //_idd = VMM.Util.date.month[interval.date.getMonth()] + ", " + interval.date.getFullYear() ;
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} else if (interval.type == "week") { } else if (interval.type == "week") {
if (_first_run) { if (_first_run) {
interval.date.setMonth( data[0].startdate.getMonth() ); interval.date.setMonth( data[0].startdate.getMonth() );
interval.date.setDate( Math.floor(data[0].startdate.getDate() *7) ); interval.date.setDate( Math.floor(data[0].startdate.getDate() *7) );
} }
interval.date.setDate(interval.date.getDate() + (inc_time * 7) ); interval.date.setDate(interval.date.getDate() + (inc_time * 7) );
_idd = VMM.Util.date.day_abbr[interval.date.getDay()] + " " + VMM.Util.date.month_abbr[interval.date.getMonth()] + " " + interval.date.getDate(); //_idd = VMM.Util.date.day_abbr[interval.date.getDay()] + " " + VMM.Util.date.month_abbr[interval.date.getMonth()] + " " + interval.date.getDate();
} else if (interval.type == "day") { } else if (interval.type == "day") {
if (_first_run) { if (_first_run) {
interval.date.setMonth( data[0].startdate.getMonth() ); interval.date.setMonth( data[0].startdate.getMonth() );
interval.date.setDate( data[0].startdate.getDate() ); interval.date.setDate( data[0].startdate.getDate() );
} }
interval.date.setDate(interval.date.getDate() + inc_time); interval.date.setDate(interval.date.getDate() + inc_time);
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
//_idd = VMM.Util.date.day_abbr[interval.date.getDay()] + " " +VMM.Util.date.month[interval.date.getMonth()] + " " + interval.date.getDate(); //_idd = VMM.Util.date.day_abbr[interval.date.getDay()] + " " +VMM.Util.date.month[interval.date.getMonth()] + " " + interval.date.getDate();
} else if (interval.type == "hour") { } else if (interval.type == "hour") {
if (_first_run) { if (_first_run) {
@ -826,7 +950,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval.date.setHours(interval.date.getHours() + inc_time); interval.date.setHours(interval.date.getHours() + inc_time);
//_idd = VMM.Util.date.get12HRTime(interval.date, false); //interval.date.getHours() + ":00"; //_idd = VMM.Util.date.get12HRTime(interval.date, false); //interval.date.getHours() + ":00";
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} else if (interval.type == "minute") { } else if (interval.type == "minute") {
if (_first_run) { if (_first_run) {
interval.date.setMonth( data[0].startdate.getMonth() ); interval.date.setMonth( data[0].startdate.getMonth() );
@ -836,7 +960,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval.date.setMinutes(interval.date.getMinutes() + inc_time); interval.date.setMinutes(interval.date.getMinutes() + inc_time);
//_idd = interval.date.getHours() + ":" + VMM.Util.doubledigit(interval.date.getMinutes()); //_idd = interval.date.getHours() + ":" + VMM.Util.doubledigit(interval.date.getMinutes());
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} else if (interval.type == "second") { } else if (interval.type == "second") {
if (_first_run) { if (_first_run) {
interval.date.setMonth( data[0].startdate.getMonth() ); interval.date.setMonth( data[0].startdate.getMonth() );
@ -847,9 +971,9 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval.date.setSeconds(interval.date.getSeconds() + inc_time); interval.date.setSeconds(interval.date.getSeconds() + inc_time);
//_idd = interval.date.getHours() + ":" + VMM.Util.doubledigit(interval.date.getMinutes()) + ":" + VMM.Util.doubledigit(interval.date.getSeconds()); //_idd = interval.date.getHours() + ":" + VMM.Util.doubledigit(interval.date.getMinutes()) + ":" + VMM.Util.doubledigit(interval.date.getSeconds());
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} }
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
inc_time = 1; inc_time = 1;
if (_first_run) { if (_first_run) {
@ -857,40 +981,62 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
_first_run = false; _first_run = false;
var _pos = positionOnTimeline(interval, interval.date, interval.date); var _pos = positionOnTimeline(interval, interval.date);
var pos = _pos.begin; var pos = _pos.begin;
$interval_date = VMM.appendAndGetElement($timeinterval, "<div>", "_idd"); //$interval_date = VMM.appendAndGetElement($timeinterval, "<div>", "_idd");
VMM.appendElement($interval_date, _idd);
VMM.Element.css($interval_date, "left", pos); var _interval_element = VMM.appendAndGetElement($timeinterval, "<div>", "_idd");
VMM.Element.css($interval_date, "text-indent", -(VMM.Element.width($interval_date)/2)); var _interval_visible = false;
VMM.appendElement(_interval_element, _idd);
//VMM.Element.css(_interval_element, "left", pos);
VMM.Element.css(_interval_element, "text-indent", -(VMM.Element.width(_interval_element)/2));
VMM.Element.css(_interval_element, "opacity", "0");
/*
if ((pos - _last_pos) < 65 ) { if ((pos - _last_pos) < 65 ) {
if ((pos - _last_pos) < 35 ) { if ((pos - _last_pos) < 35 ) {
if (i%4 == 0) { if (i%4 == 0) {
if (pos == 0) { if (pos == 0) {
VMM.Element.css($interval_date, "display", "none"); VMM.Element.css(_interval_element, "display", "none");
_interval_visible = false;
} else { } else {
VMM.Element.css($interval_date, "display", ""); VMM.Element.css(_interval_element, "display", "");
} }
} else { } else {
VMM.Element.css($interval_date, "display", "none"); VMM.Element.css(_interval_element, "display", "none");
_interval_visible = false;
} }
} else { } else {
if (VMM.Util.isEven(i)) { if (VMM.Util.isEven(i)) {
VMM.Element.css($interval_date, "display", "none"); VMM.Element.css(_interval_element, "display", "none");
_interval_visible = false;
} else { } else {
VMM.Element.css($interval_date, "display", ""); VMM.Element.css(_interval_element, "display", "");
} }
} }
} else { } else {
VMM.Element.css($interval_date, "display", ""); VMM.Element.css(_interval_element, "display", "");
} }
*/
_last_pos = pos; _last_pos = pos;
/* ADD INTERVAL OBJ TO ARRAY FOR RETRIEVAL LATER
================================================== */
var _interval_date = new Date(interval.date);
var _interval_obj = {
interval_element: _interval_element,
interval_date: _interval_date,
interval_visible: _interval_visible,
type: "interval"
};
interval_array.push(_interval_obj);
} }
_first_run = true; _first_run = true;
@ -905,26 +1051,26 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_major.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 100) * 100 ); interval_major.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 100) * 100 );
} }
interval_major.date.setFullYear(interval_major.date.getFullYear() + (inc_time_major * 100)); interval_major.date.setFullYear(interval_major.date.getFullYear() + (inc_time_major * 100));
_idd = Math.floor(interval_major.date.getFullYear() / 100) * 100; //_idd = Math.floor(interval_major.date.getFullYear() / 100) * 100;
} else if (interval_major.type == "decade") { } else if (interval_major.type == "decade") {
if (_first_run) { if (_first_run) {
interval_major.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 10) * 10 ); interval_major.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 10) * 10 );
} }
interval_major.date.setFullYear(interval_major.date.getFullYear() + (inc_time_major * 10)); interval_major.date.setFullYear(interval_major.date.getFullYear() + (inc_time_major * 10));
_idd = Math.floor(interval_major.date.getFullYear() / 10) * 10; //_idd = Math.floor(interval_major.date.getFullYear() / 10) * 10;
} else if (interval_major.type == "year") { } else if (interval_major.type == "year") {
if (_first_run) { if (_first_run) {
} }
interval_major.date.setFullYear(interval_major.date.getFullYear() + inc_time_major); interval_major.date.setFullYear(interval_major.date.getFullYear() + inc_time_major);
_idd = interval_major.date.getFullYear(); //_idd = interval_major.date.getFullYear();
//_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "month") { } else if (interval_major.type == "month") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth(data[0].startdate.getMonth()); interval_major.date.setMonth(data[0].startdate.getMonth());
} }
interval_major.date.setMonth(interval_major.date.getMonth() + inc_time_major); interval_major.date.setMonth(interval_major.date.getMonth() + inc_time_major);
_idd = VMM.Util.date.month[interval_major.date.getMonth()] + " " + interval_major.date.getFullYear(); //_idd = VMM.Util.date.month[interval_major.date.getMonth()] + " " + interval_major.date.getFullYear();
//_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "week") { } else if (interval_major.type == "week") {
if (_first_run) { if (_first_run) {
@ -932,7 +1078,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_major.date.setDate( Math.floor(data[0].startdate.getDate() *7) ); interval_major.date.setDate( Math.floor(data[0].startdate.getDate() *7) );
} }
interval_major.date.setDate(interval_major.date.getDate() + (inc_time_major * 7) ); interval_major.date.setDate(interval_major.date.getDate() + (inc_time_major * 7) );
_idd = VMM.Util.date.day_abbr[interval_major.date.getDay()] + " " + VMM.Util.date.month_abbr[interval_major.date.getMonth()] + " " + interval_major.date.getDate(); //_idd = VMM.Util.date.day_abbr[interval_major.date.getDay()] + " " + VMM.Util.date.month_abbr[interval_major.date.getMonth()] + " " + interval_major.date.getDate();
} else if (interval_major.type == "day") { } else if (interval_major.type == "day") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth( data[0].startdate.getMonth() ); interval_major.date.setMonth( data[0].startdate.getMonth() );
@ -941,7 +1087,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_major.date.setDate(interval_major.date.getDate() + inc_time_major); interval_major.date.setDate(interval_major.date.getDate() + inc_time_major);
//_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
//_idd = VMM.Util.date.day[interval_major.date.getDay()] + " " + VMM.Util.date.month_abbr[interval_major.date.getMonth()] + " " + interval_major.date.getDate(); //_idd = VMM.Util.date.day[interval_major.date.getDay()] + " " + VMM.Util.date.month_abbr[interval_major.date.getMonth()] + " " + interval_major.date.getDate();
_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "hour") { } else if (interval_major.type == "hour") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth( data[0].startdate.getMonth() ); interval_major.date.setMonth( data[0].startdate.getMonth() );
@ -950,7 +1096,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval_major.date.setHours(interval_major.date.getHours() + inc_time_major); interval_major.date.setHours(interval_major.date.getHours() + inc_time_major);
//_idd = VMM.Util.date.get12HRTime(interval_major.date, false); //interval_major.date.getHours() + ":00"; //_idd = VMM.Util.date.get12HRTime(interval_major.date, false); //interval_major.date.getHours() + ":00";
_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "minute") { } else if (interval_major.type == "minute") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth( data[0].startdate.getMonth() ); interval_major.date.setMonth( data[0].startdate.getMonth() );
@ -960,7 +1106,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval_major.date.setMinutes(interval_major.date.getMinutes() + inc_time_major); interval_major.date.setMinutes(interval_major.date.getMinutes() + inc_time_major);
//_idd = interval_major.date.getHours() + ":" + VMM.Util.doubledigit(interval_major.date.getMinutes()); //_idd = interval_major.date.getHours() + ":" + VMM.Util.doubledigit(interval_major.date.getMinutes());
_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "second") { } else if (interval_major.type == "second") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth( data[0].startdate.getMonth() ); interval_major.date.setMonth( data[0].startdate.getMonth() );
@ -971,9 +1117,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval_major.date.setSeconds(interval_major.date.getSeconds() + inc_time_major); interval_major.date.setSeconds(interval_major.date.getSeconds() + inc_time_major);
//_idd = interval_major.date.getHours() + ":" + VMM.Util.doubledigit(interval_major.date.getMinutes()) + ":" + VMM.Util.doubledigit(interval_major.date.getSeconds()); //_idd = interval_major.date.getHours() + ":" + VMM.Util.doubledigit(interval_major.date.getMinutes()) + ":" + VMM.Util.doubledigit(interval_major.date.getSeconds());
_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} }
trace("interval_major.type " + interval_major.type); trace("interval_major.type " + interval_major.type);
_idd = VMM.Util.date.prettyDate(interval_major.date, false, interval_major.type);
inc_time_major = 1; inc_time_major = 1;
@ -983,15 +1130,15 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
CREATE A DATE CREATE A DATE
//================================================== */ //================================================== */
var _pos = positionOnTimeline(interval, interval_major.date, interval_major.date); var _pos = positionOnTimeline(interval, interval_major.date);
var pos = _pos.begin; var pos = _pos.begin;
$interval_date = VMM.appendAndGetElement($timeintervalmajor, "<div>", "major"); //$interval_date = VMM.appendAndGetElement($timeintervalmajor, "<div>", "major");
VMM.appendElement($interval_date, _idd); _interval_major_element = VMM.appendAndGetElement($timeintervalmajor, "<div>", "major");
VMM.appendElement(_interval_major_element, _idd);
VMM.Element.css($interval_date, "left", pos); //VMM.Element.css(_interval_major_element, "left", pos);
VMM.Element.css($interval_date, "left", pos); VMM.Element.css(_interval_major_element, "text-indent", -(VMM.Element.width(_interval_major_element)/2));
VMM.Element.css($interval_date, "text-indent", -(VMM.Element.width($interval_date)/2));
if (_first_run) { if (_first_run) {
_major_first_pos = pos; _major_first_pos = pos;
@ -1001,6 +1148,20 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
_last_pos_major = pos; _last_pos_major = pos;
_major_last_pos = pos; _major_last_pos = pos;
/* ADD INTERVAL MAJOR OBJ TO ARRAY FOR RETRIEVAL LATER
================================================== */
var _interval_major_date = new Date(interval_major.date);
var _interval_major_obj = {
interval_element: _interval_major_element,
interval_date: _interval_major_date,
interval_visible: true,
type: "interval major"
};
interval_major_array.push(_interval_major_obj);
} }
VMM.Element.width($content, interval.number * (config.interval_width / config.multiplier) ); VMM.Element.width($content, interval.number * (config.interval_width / config.multiplier) );
@ -1016,12 +1177,16 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.Element.width($timeintervalminor_minor, _minor_width); VMM.Element.width($timeintervalminor_minor, _minor_width);
} }
rePositionInterval(interval_array, true);
rePositionInterval(interval_major_array, true);
//VMM.Element.css($timeintervalminor_minor, "left", _major_first_pos - _minor_pos_offset); //VMM.Element.css($timeintervalminor_minor, "left", _major_first_pos - _minor_pos_offset);
config.timeline_width = VMM.Element.width($timeinterval); config.timeline_width = VMM.Element.width($timeinterval);
} }
var buildInterval = function() { var buildInterval = function() {
@ -1224,10 +1389,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}; };
var refreshTimeline = function() { var refreshTimeline = function() {
trace("config.multiplier " + config.multiplier);
positionMarkers(true); positionMarkers(true);
positionInterval(); rePositionInterval(interval_array, true);
//positionMarkers(true); rePositionInterval(interval_major_array, true);
//reSize();
}; };

135
source/js/VMM.Timeline.js

@ -222,7 +222,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
function onComponentLoaded(e) { function onComponentLoaded(e) {
config.loaded.percentloaded = config.loaded.percentloaded + 25; config.loaded.percentloaded = config.loaded.percentloaded + 25;
showMessege("Loading Timeline " + config.loaded.percentloaded);
if (config.loaded.slider && config.loaded.timenav) { if (config.loaded.slider && config.loaded.timenav) {
hideMessege(); hideMessege();
} }
@ -250,6 +250,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
VMM.Util.date.setLanguage(VMM.Timeline.Config.language); VMM.Util.date.setLanguage(VMM.Timeline.Config.language);
VMM.bindEvent(global, onDataReady, "DATAREADY"); VMM.bindEvent(global, onDataReady, "DATAREADY");
VMM.bindEvent(global, showMessege, "MESSEGE");
/* GET DATA /* GET DATA
================================================== */ ================================================== */
@ -285,18 +286,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* MESSEGES /* MESSEGES
================================================== */ ================================================== */
var showMessege = function(msg) {
//VMM.Element.append($timeline, $feedback);
//VMM.attachElement($messege, msg);
//VMM.Element.animate($feedback, config.duration, config.ease, {"opacity": 1}); var showMessege = function(e, msg) {
$messege = VMM.appendAndGetElement($feedback, "<div>", "messege", msg);
}; };
//VMM.Element.animate(element, duration, ease, att, callback_function);
var hideMessege = function() {
var hideMessege = function() {
VMM.Element.animate($feedback, config.duration, config.ease*4, {"opacity": 0}, detachMessege); VMM.Element.animate($feedback, config.duration, config.ease*4, {"opacity": 0}, detachMessege);
}; };
var detachMessege = function() { var detachMessege = function() {
@ -446,48 +443,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
VMM.Element.show("div.nav-previous"); VMM.Element.show("div.nav-previous");
VMM.Element.height(".slider-container-mask", config.feature.height); VMM.Element.height(".slider-container-mask", config.feature.height);
} }
/* CHECK FOR TABLET
================================================== */
if (config.width < 820) {
// TABLET OR MOBILE
//VMM.Element.width(".slider-item .media", "100%");
//VMM.Element.width(".slider-item .text", "100%");
//VMM.Element.css(".slider-item .container", "max-width", "100%");
//VMM.Element.width(".slider-item .media .media-container .media-frame", (config.feature_width - config.spacing) );
//VMM.Element.css(".slider-item .media .media-container", "margin-bottom", 5);
if (config.width < 500) {
// MOBILE
//VMM.Element.height(".slider-item .media", Math.round(config.height/1.5));
//VMM.Element.css(".slider-item .media .media-container", "max-height", Math.round(config.height/1.5) - 50);
//VMM.Element.height(".slider-item .media .media-container .media-frame", Math.round(config.height/1.5) - 60);
} else {
// TABLET
//VMM.Element.height(".slider-item .media", Math.round(config.feature_height/1.5));
//VMM.Element.css(".slider-item .media .media-container", "max-height", Math.round(config.feature_height/1.5) - 50);
//VMM.Element.height(".slider-item .media .media-container .media-frame", Math.round(config.feature_height/1.5) - 60);
}
} else {
// DESKTOP
//VMM.Element.width(".slider-item .layout-media .media", "100%");
//VMM.Element.width(".slider-item .layout-text-media .media", "75%");
//VMM.Element.width(".slider-item .layout-text-media .text", "25%");
//VMM.Element.width(".slider-item .layout-text .text", "100%");
//VMM.Element.css(".slider-item .layout-text-media .container", "max-width", 200);
//VMM.Element.height(".slider-item .media", config.feature_height);
//VMM.Element.height(".slider-item .layout-text-media .media .media-container .media-frame", config.feature_height - 60);
//VMM.Element.height(".slider-item .layout-media .media .media-container .media-frame", config.feature_height - 160);
//VMM.Element.width(".slider-item .media .media-container .media-frame", Math.round(((config.feature_width/4) * 3) - config.spacing) );
//VMM.Element.css(".slider-item .media .media-container", "max-height", config.feature_height- 50);
//VMM.Element.css(".slider-item .media .media-container", "margin-bottom", 5);
}
}; };
@ -495,19 +450,23 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
var buildDates = function() { var buildDates = function() {
updateSize(); updateSize();
//$messege = VMM.appendAndGetElement($feedback, "<div>", "messege", "Building Dates");
VMM.fireEvent(global, "MESSEGE", "Building Dates");
/* CREATE START PAGE IF AVAILABLE /* CREATE START PAGE IF AVAILABLE
================================================== */ ================================================== */
/*
if (data.headline != null && data.headline != "" && data.text != null && data.text != "") { if (data.headline != null && data.headline != "" && data.text != null && data.text != "") {
trace("HAS STARTPAGE"); trace("HAS STARTPAGE");
var _date = {}; var _date = {};
if (data.type == "google spreadsheet") { if (data.type == "google spreadsheet") {
trace("google spreadsheet startpage date " + data.startDate); trace("google spreadsheet startpage date " + data.startDate);
_date.startdate = new Date(Date.parse(data.startDate)); _date.startdate = new Date(Date.parse(data.startDate));
trace(_date.startdate);
} else { } else {
_date.startdate = VMM.Util.parseDate(data.startDate); _date.startdate = VMM.Util.parseDate(data.startDate);
} }
_date.uniqueid = VMM.Util.unique_ID(5); _date.uniqueid = VMM.Util.unique_ID(5);
_date.enddate = _date.startdate; _date.enddate = _date.startdate;
_date.title = data.headline; _date.title = data.headline;
@ -518,10 +477,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
_date.asset = data.asset; _date.asset = data.asset;
_date.fulldate = _date.startdate.getTime(); _date.fulldate = _date.startdate.getTime();
_date.content = buildSlide(_date, _date.startdate); _date.content = buildSlide(_date, _date.startdate);
if (_date.content != null && _date.content != "") { if (_date.content != null && _date.content != "" || _date.title != null && _date.title != "") {
_dates.push(_date); _dates.push(_date);
} }
} }
*/
for(var i = 0; i < data.date.length; i++) { for(var i = 0; i < data.date.length; i++) {
@ -583,24 +543,73 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* CUSTOM SORT /* CUSTOM SORT
================================================== */ ================================================== */
//VMM.Util.customSort(a,b);
/*
for(var j = 0; j < _dates.length; j++) {
trace(_dates[j].startdate);
}
trace("============================");
*/
//_dates.reverse(VMM.Util.customSort(_dates.fulldate,_dates.fulldate));
_dates.sort(function(a, b){ _dates.sort(function(a, b){
return a.fulldate - b.fulldate return a.fulldate - b.fulldate
}); });
//_dates.reverse()
/* CREATE START PAGE IF AVAILABLE
================================================== */
if (data.headline != null && data.headline != "" && data.text != null && data.text != "") {
trace("HAS STARTPAGE");
var _date = {};
if (data.type == "google spreadsheet") {
trace("google spreadsheet startpage date " + data.startDate);
//_date.startdate = new Date(Date.parse(data.startDate));
} else {
_date.startdate = VMM.Util.parseDate(data.startDate);
}
_date.startdate = new Date(_dates[0].startdate);
var td = _dates[0].startdate;
var td_num = 0;
/* /*
for(var k = 0; k < _dates.length; k++) { if (_dates[0].startdate.getDate() > 1) {
trace(_dates[k].startdate); _date.startdate.setDate(td.getDate() - 1);
} else if (_dates[0].startdate.getHours() > 0) {
_date.startdate.setHours(td.getHours() - 1);
} }
*/ */
trace(td);
if (td.getMonth() === 0 && td.getDate() == 1 && td.getHours() === 0 && td.getMinutes() === 0 ) {
// trace("YEAR ONLY");
_date.startdate.setFullYear(td.getFullYear() - 1);
} else if (td.getDate() <= 1 && td.getHours() === 0 && td.getMinutes() === 0) {
// trace("YEAR MONTH");
_date.startdate.setMonth(td.getMonth() - 1);
} else if (td.getHours() === 0 && td.getMinutes() === 0) {
// trace("YEAR MONTH DAY");
_date.startdate.setDate(td.getDate() - 1);
} else if (td.getMinutes() === 0) {
// trace("YEAR MONTH DAY HOUR");
_date.startdate.setHours(td.getHours() - 1);
} else {
// trace("YEAR MONTH DAY HOUR MINUTE");
_date.startdate.setMinutes(td.getMinutes() - 1);
}
trace(td);
_date.uniqueid = VMM.Util.unique_ID(5);
_date.enddate = _date.startdate;
_date.title = data.headline;
_date.headline = data.headline;
_date.text = data.text;
_date.type = "start";
_date.date = VMM.Util.date.prettyDate(data.startDate);
_date.asset = data.asset;
_date.fulldate = _date.startdate.getTime();
_date.content = buildSlide(_date, _date.startdate);
if (_date.content != null && _date.content != "" || _date.title != null && _date.title != "") {
_dates.push(_date);
}
}
/* CUSTOM SORT
================================================== */
_dates.sort(function(a, b){
return a.fulldate - b.fulldate
});
onDatesProcessed(); onDatesProcessed();
} }

6
source/js/VMM.Util.js

@ -143,8 +143,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
month: "mmmm yyyy", month: "mmmm yyyy",
full_short: "mmm d", full_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "hh:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "hh:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
}, },
@ -203,7 +203,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
} else { } else {
// trace("YEAR MONTH DAY HOUR MINUTE"); // trace("YEAR MONTH DAY HOUR MINUTE");
if (is_abbr){ if (is_abbr){
_date = dateFormat(d, VMM.Util.date.dateformats.full_long); _date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_short);
} else { } else {
_date = dateFormat(d, VMM.Util.date.dateformats.full_long); _date = dateFormat(d, VMM.Util.date.dateformats.full_long);
} }

4
source/js/locale/en.js

@ -15,8 +15,8 @@ if(typeof VMM != 'undefined') {
month: "mmmm yyyy", month: "mmmm yyyy",
full_short: "mmm d", full_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "hh:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "hh:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
}, },

5
timeline-min.js vendored

File diff suppressed because one or more lines are too long

486
timeline.js

@ -2776,28 +2776,78 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Element.css(".slider-item", "width", config.slider.content.width ); VMM.Element.css(".slider-item", "width", config.slider.content.width );
VMM.Element.height(".slider-item", config.slider.height); VMM.Element.height(".slider-item", config.slider.height);
VMM.Element.css(".slider-item .layout-text-media .media .media-container img", "max-height", config.slider.height - 50 );
VMM.Element.css(".slider-item .layout-media .media .media-container img", "max-height", config.slider.height - 150 ); /* RESIZE IFRAME MEDIA ELEMENTS
================================================== */
//var _iframe_height = Math.round(config.height) - 60;
var _iframe_height_full = Math.round(config.slider.height) - 160;
//var _iframe_width = Math.round((_iframe_height / 9) * 16);
var _iframe_width_full = Math.round((_iframe_height_full / 9) * 16);
var _iframe_width = (config.slider.content.width/100)*60 ;
var _iframe_height = Math.round((_iframe_width / 16) * 9) + 25;
/* MEDIA HEIGHT
================================================== */
var _media_height = Math.round(config.slider.height) - 160;
//var _text_height = config.slider.height;
var _media_width_with_text = ((config.slider.content.width/100) * 60);
/* FIX FOR NON-WEBKIT BROWSERS /* FIX FOR NON-WEBKIT BROWSERS
================================================== */ ================================================== */
VMM.Element.css(".slider-item .layout-text-media .media .media-container img", "max-width", ((config.slider.content.width/100) * 60) );
VMM.Element.css(".slider-item .layout-text-media .media .media-container .twitter .avatar img", "max-width", 32 ); VMM.Element.css(".slider-item .layout-text-media .media .media-container .twitter .avatar img", "max-width", 32 );
VMM.Element.css(".slider-item .layout-text-media .media .media-container .twitter .avatar img", "max-height", 32 ); VMM.Element.css(".slider-item .layout-text-media .media .media-container .twitter .avatar img", "max-height", 32 );
/* SOUNDCLOUD /* SOUNDCLOUD
================================================== */ ================================================== */
VMM.Element.css(".slider-item .media .media-container .soundcloud", "max-height", 168 ); VMM.Element.css(".slider-item .media .media-container .soundcloud", "max-height", 168 );
/* RESIZE IFRAME MEDIA ELEMENTS /* HANDLE SMALLER SIZES
================================================== */ ================================================== */
//var _iframe_height = Math.round(config.height) - 60; if (config.width <= 650) {
var _iframe_height_full = Math.round(config.slider.height) - 160; _media_height = ((config.slider.height/100) * 40 ) - 40;
//var _iframe_width = Math.round((_iframe_height / 9) * 16); //_text_height = (config.slider.height/100) * 60;
var _iframe_width_full = Math.round((_iframe_height_full / 9) * 16); _iframe_width = config.slider.content.width;
_media_width_with_text = config.slider.content.width;
var _iframe_width = (config.slider.content.width/100)*60 ; VMM.Element.css(".slider-item .layout-text-media .text", "width", "100%" );
var _iframe_height = Math.round((_iframe_width / 16) * 9) + 25; VMM.Element.css(".slider-item .layout-text-media .text", "display", "block" );
VMM.Element.css(".slider-item .layout-text-media .media", "float", "none" );
//VMM.Element.css(".slider-item .layout-text-media .media", "width", "100%" );
VMM.Element.css(".slider-item .media blockquote p", "line-height", "18px" );
VMM.Element.css(".slider-item .media blockquote p", "font-size", "16px" );
VMM.Element.css(".slider-item .layout-text-media", "height", config.slider.height );
VMM.Element.css(".slider-item .layout-text-media", "overflow", "auto" );
VMM.Element.css(".slider-item .layout-text-media", "display", "block" );
} else {
_media_height = config.slider.height - 40;
//_text_height = config.slider.height;
_iframe_width = (config.slider.content.width/100)*60 ;
_media_width_with_text = ((config.slider.content.width/100) * 60);
VMM.Element.css(".slider-item .layout-text-media .text", "width", "40%" );
VMM.Element.css(".slider-item .layout-text-media .text", "display", "table-cell" );
VMM.Element.css(".slider-item .layout-text-media .media", "float", "left" );
//VMM.Element.css(".slider-item .layout-text-media .media", "width", "60%" );
VMM.Element.css(".slider-item .layout-text-media", "display", "table" );
}
// TEXT
//VMM.Element.css(".slider-item .layout-text-media .text", "max-height", _text_height );
//VMM.Element.css(".slider-item .layout-text-media .text", "overflow", "auto" );
// IMAGES
VMM.Element.css(".slider-item .layout-text-media .media .media-container img", "max-height", _media_height );
VMM.Element.css(".slider-item .layout-media .media .media-container img", "max-height", _media_height - 100 );
/* FIX FOR NON-WEBKIT BROWSERS
================================================== */
VMM.Element.css(".slider-item .layout-text-media .media .media-container img", "max-width", _media_width_with_text );
// NORMAL // NORMAL
VMM.Element.height(".slider-item .media .media-container .media-frame", _iframe_height); VMM.Element.height(".slider-item .media .media-container .media-frame", _iframe_height);
@ -2813,12 +2863,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Element.width(".slider-item .layout-text-media .media .media-container .soundcloud", _iframe_width); VMM.Element.width(".slider-item .layout-text-media .media .media-container .soundcloud", _iframe_width);
// MAPS // MAPS
VMM.Element.height(".slider-item .layout-text-media .media .media-container .map", _media_height);
VMM.Element.height(".slider-item .layout-media .media .media-container .map", _iframe_height_full+60); VMM.Element.height(".slider-item .layout-media .media .media-container .map", _iframe_height_full+60);
VMM.Element.height(".slider-item .layout-text-media .media .media-container .map", _iframe_height_full+120);
// MAPS // DOCS
VMM.Element.height(".slider-item .layout-text-media .media .media-container .doc", _media_height);
VMM.Element.height(".slider-item .layout-media .media .media-container .doc", _iframe_height_full+60); VMM.Element.height(".slider-item .layout-media .media .media-container .doc", _iframe_height_full+60);
VMM.Element.height(".slider-item .layout-text-media .media .media-container .doc", _iframe_height_full+120);
// MAX WIDTH // MAX WIDTH
VMM.Element.css(".slider-item .layout-text-media .media .media-container .media-frame", "max-width", config.slider.content.width ); VMM.Element.css(".slider-item .layout-text-media .media .media-container .media-frame", "max-width", config.slider.content.width );
@ -3152,8 +3202,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
month: "mmmm yyyy", month: "mmmm yyyy",
full_short: "mmm d", full_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "hh:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "hh:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
}, },
@ -3212,7 +3262,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
} else { } else {
// trace("YEAR MONTH DAY HOUR MINUTE"); // trace("YEAR MONTH DAY HOUR MINUTE");
if (is_abbr){ if (is_abbr){
_date = dateFormat(d, VMM.Util.date.dateformats.full_long); _date = dateFormat(d, VMM.Util.date.dateformats.time_no_seconds_short);
} else { } else {
_date = dateFormat(d, VMM.Util.date.dateformats.full_long); _date = dateFormat(d, VMM.Util.date.dateformats.full_long);
} }
@ -4689,8 +4739,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Language == 'undefined') {
month: "mmmm yyyy", month: "mmmm yyyy",
full_short: "mmm d", full_short: "mmm d",
full: "mmmm d',' yyyy", full: "mmmm d',' yyyy",
time_no_seconds_short: "hh:MM TT", time_no_seconds_short: "h:MM TT",
time_no_seconds_small_date: "hh:MM TT'<br/><small>'mmmm d',' yyyy'</small>'", time_no_seconds_small_date: "dddd', 'h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT", full_long: "dddd',' mmm d',' yyyy 'at' hh:MM TT",
full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'", full_long_small_date: "hh:MM TT'<br/><small>'dddd',' mmm d',' yyyy'</small>'",
}, },
@ -4931,7 +4981,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
function onComponentLoaded(e) { function onComponentLoaded(e) {
config.loaded.percentloaded = config.loaded.percentloaded + 25; config.loaded.percentloaded = config.loaded.percentloaded + 25;
showMessege("Loading Timeline " + config.loaded.percentloaded);
if (config.loaded.slider && config.loaded.timenav) { if (config.loaded.slider && config.loaded.timenav) {
hideMessege(); hideMessege();
} }
@ -4959,6 +5009,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
VMM.Util.date.setLanguage(VMM.Timeline.Config.language); VMM.Util.date.setLanguage(VMM.Timeline.Config.language);
VMM.bindEvent(global, onDataReady, "DATAREADY"); VMM.bindEvent(global, onDataReady, "DATAREADY");
VMM.bindEvent(global, showMessege, "MESSEGE");
/* GET DATA /* GET DATA
================================================== */ ================================================== */
@ -4994,18 +5045,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* MESSEGES /* MESSEGES
================================================== */ ================================================== */
var showMessege = function(msg) {
//VMM.Element.append($timeline, $feedback);
//VMM.attachElement($messege, msg);
//VMM.Element.animate($feedback, config.duration, config.ease, {"opacity": 1}); var showMessege = function(e, msg) {
$messege = VMM.appendAndGetElement($feedback, "<div>", "messege", msg);
}; };
//VMM.Element.animate(element, duration, ease, att, callback_function);
var hideMessege = function() {
var hideMessege = function() {
VMM.Element.animate($feedback, config.duration, config.ease*4, {"opacity": 0}, detachMessege); VMM.Element.animate($feedback, config.duration, config.ease*4, {"opacity": 0}, detachMessege);
}; };
var detachMessege = function() { var detachMessege = function() {
@ -5155,48 +5202,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
VMM.Element.show("div.nav-previous"); VMM.Element.show("div.nav-previous");
VMM.Element.height(".slider-container-mask", config.feature.height); VMM.Element.height(".slider-container-mask", config.feature.height);
} }
/* CHECK FOR TABLET
================================================== */
if (config.width < 820) {
// TABLET OR MOBILE
//VMM.Element.width(".slider-item .media", "100%");
//VMM.Element.width(".slider-item .text", "100%");
//VMM.Element.css(".slider-item .container", "max-width", "100%");
//VMM.Element.width(".slider-item .media .media-container .media-frame", (config.feature_width - config.spacing) );
//VMM.Element.css(".slider-item .media .media-container", "margin-bottom", 5);
if (config.width < 500) {
// MOBILE
//VMM.Element.height(".slider-item .media", Math.round(config.height/1.5));
//VMM.Element.css(".slider-item .media .media-container", "max-height", Math.round(config.height/1.5) - 50);
//VMM.Element.height(".slider-item .media .media-container .media-frame", Math.round(config.height/1.5) - 60);
} else {
// TABLET
//VMM.Element.height(".slider-item .media", Math.round(config.feature_height/1.5));
//VMM.Element.css(".slider-item .media .media-container", "max-height", Math.round(config.feature_height/1.5) - 50);
//VMM.Element.height(".slider-item .media .media-container .media-frame", Math.round(config.feature_height/1.5) - 60);
}
} else {
// DESKTOP
//VMM.Element.width(".slider-item .layout-media .media", "100%");
//VMM.Element.width(".slider-item .layout-text-media .media", "75%");
//VMM.Element.width(".slider-item .layout-text-media .text", "25%");
//VMM.Element.width(".slider-item .layout-text .text", "100%");
//VMM.Element.css(".slider-item .layout-text-media .container", "max-width", 200);
//VMM.Element.height(".slider-item .media", config.feature_height);
//VMM.Element.height(".slider-item .layout-text-media .media .media-container .media-frame", config.feature_height - 60);
//VMM.Element.height(".slider-item .layout-media .media .media-container .media-frame", config.feature_height - 160);
//VMM.Element.width(".slider-item .media .media-container .media-frame", Math.round(((config.feature_width/4) * 3) - config.spacing) );
//VMM.Element.css(".slider-item .media .media-container", "max-height", config.feature_height- 50);
//VMM.Element.css(".slider-item .media .media-container", "margin-bottom", 5);
}
}; };
@ -5204,19 +5209,23 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
var buildDates = function() { var buildDates = function() {
updateSize(); updateSize();
//$messege = VMM.appendAndGetElement($feedback, "<div>", "messege", "Building Dates");
VMM.fireEvent(global, "MESSEGE", "Building Dates");
/* CREATE START PAGE IF AVAILABLE /* CREATE START PAGE IF AVAILABLE
================================================== */ ================================================== */
/*
if (data.headline != null && data.headline != "" && data.text != null && data.text != "") { if (data.headline != null && data.headline != "" && data.text != null && data.text != "") {
trace("HAS STARTPAGE"); trace("HAS STARTPAGE");
var _date = {}; var _date = {};
if (data.type == "google spreadsheet") { if (data.type == "google spreadsheet") {
trace("google spreadsheet startpage date " + data.startDate); trace("google spreadsheet startpage date " + data.startDate);
_date.startdate = new Date(Date.parse(data.startDate)); _date.startdate = new Date(Date.parse(data.startDate));
trace(_date.startdate);
} else { } else {
_date.startdate = VMM.Util.parseDate(data.startDate); _date.startdate = VMM.Util.parseDate(data.startDate);
} }
_date.uniqueid = VMM.Util.unique_ID(5); _date.uniqueid = VMM.Util.unique_ID(5);
_date.enddate = _date.startdate; _date.enddate = _date.startdate;
_date.title = data.headline; _date.title = data.headline;
@ -5227,10 +5236,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
_date.asset = data.asset; _date.asset = data.asset;
_date.fulldate = _date.startdate.getTime(); _date.fulldate = _date.startdate.getTime();
_date.content = buildSlide(_date, _date.startdate); _date.content = buildSlide(_date, _date.startdate);
if (_date.content != null && _date.content != "") { if (_date.content != null && _date.content != "" || _date.title != null && _date.title != "") {
_dates.push(_date); _dates.push(_date);
} }
} }
*/
for(var i = 0; i < data.date.length; i++) { for(var i = 0; i < data.date.length; i++) {
@ -5292,24 +5302,73 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* CUSTOM SORT /* CUSTOM SORT
================================================== */ ================================================== */
//VMM.Util.customSort(a,b);
/*
for(var j = 0; j < _dates.length; j++) {
trace(_dates[j].startdate);
}
trace("============================");
*/
//_dates.reverse(VMM.Util.customSort(_dates.fulldate,_dates.fulldate));
_dates.sort(function(a, b){ _dates.sort(function(a, b){
return a.fulldate - b.fulldate return a.fulldate - b.fulldate
}); });
//_dates.reverse()
/* CREATE START PAGE IF AVAILABLE
================================================== */
if (data.headline != null && data.headline != "" && data.text != null && data.text != "") {
trace("HAS STARTPAGE");
var _date = {};
if (data.type == "google spreadsheet") {
trace("google spreadsheet startpage date " + data.startDate);
//_date.startdate = new Date(Date.parse(data.startDate));
} else {
_date.startdate = VMM.Util.parseDate(data.startDate);
}
_date.startdate = new Date(_dates[0].startdate);
var td = _dates[0].startdate;
var td_num = 0;
/* /*
for(var k = 0; k < _dates.length; k++) { if (_dates[0].startdate.getDate() > 1) {
trace(_dates[k].startdate); _date.startdate.setDate(td.getDate() - 1);
} else if (_dates[0].startdate.getHours() > 0) {
_date.startdate.setHours(td.getHours() - 1);
} }
*/ */
trace(td);
if (td.getMonth() === 0 && td.getDate() == 1 && td.getHours() === 0 && td.getMinutes() === 0 ) {
// trace("YEAR ONLY");
_date.startdate.setFullYear(td.getFullYear() - 1);
} else if (td.getDate() <= 1 && td.getHours() === 0 && td.getMinutes() === 0) {
// trace("YEAR MONTH");
_date.startdate.setMonth(td.getMonth() - 1);
} else if (td.getHours() === 0 && td.getMinutes() === 0) {
// trace("YEAR MONTH DAY");
_date.startdate.setDate(td.getDate() - 1);
} else if (td.getMinutes() === 0) {
// trace("YEAR MONTH DAY HOUR");
_date.startdate.setHours(td.getHours() - 1);
} else {
// trace("YEAR MONTH DAY HOUR MINUTE");
_date.startdate.setMinutes(td.getMinutes() - 1);
}
trace(td);
_date.uniqueid = VMM.Util.unique_ID(5);
_date.enddate = _date.startdate;
_date.title = data.headline;
_date.headline = data.headline;
_date.text = data.text;
_date.type = "start";
_date.date = VMM.Util.date.prettyDate(data.startDate);
_date.asset = data.asset;
_date.fulldate = _date.startdate.getTime();
_date.content = buildSlide(_date, _date.startdate);
if (_date.content != null && _date.content != "" || _date.title != null && _date.title != "") {
_dates.push(_date);
}
}
/* CUSTOM SORT
================================================== */
_dates.sort(function(a, b){
return a.fulldate - b.fulldate
});
onDatesProcessed(); onDatesProcessed();
} }
@ -5338,6 +5397,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var era_markers = []; var era_markers = [];
var markers = []; // HOLDS MARKER DOM OBJECTS var markers = []; // HOLDS MARKER DOM OBJECTS
var interval_array = []; var interval_array = [];
var interval_major_array = [];
var timespan = {}; var timespan = {};
var current_marker = 0; // CURRENT MARKER var current_marker = 0; // CURRENT MARKER
var _active = false; var _active = false;
@ -5545,7 +5605,12 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
if (config.multiplier <= 1) { if (config.multiplier <= 1) {
config.multiplier = config.multiplier - .25; config.multiplier = config.multiplier - .25;
} else { } else {
config.multiplier = config.multiplier - 1; if (config.multiplier > 5) {
config.multiplier = Math.round(config.multiplier - 4);
} else {
config.multiplier = Math.round(config.multiplier - 1);
}
} }
if (config.multiplier <= 0) { if (config.multiplier <= 0) {
config.multiplier = config.min_multiplier; config.multiplier = config.min_multiplier;
@ -5557,9 +5622,14 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
function onZoomOut() { function onZoomOut() {
VMM.DragSlider.cancelSlide(); VMM.DragSlider.cancelSlide();
if (config.multiplier < config.max_multiplier) { if (config.multiplier < config.max_multiplier) {
config.multiplier = config.multiplier + 1; if (config.multiplier > 4) {
if (config.multiplier == config.max_multiplier) { config.multiplier = Math.round(config.multiplier + 4);
} else {
config.multiplier = Math.round(config.multiplier + 1);
}
if (config.multiplier >= config.max_multiplier) {
config.multiplier = config.max_multiplier;
} }
refreshTimeline(); refreshTimeline();
} }
@ -5701,19 +5771,27 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
var positionOnTimeline = function(the_interval, first, last) { var positionOnTimeline = function(the_interval, first, last) {
var _type = the_interval.type; var _type = the_interval.type;
var _multiplier = the_interval.multiplier; var _multiplier = the_interval.multiplier;
var _first = getDateFractions(first); var _first = getDateFractions(first);
var _last = getDateFractions(last); var _last;
var tsd;
var ted;
/* CALCULATE POSITION ON TIMELINE /* CALCULATE POSITION ON TIMELINE
================================================== */ ================================================== */
var tsd = first.months; tsd = first.months;
var ted = last.months;
if (type.of(last) == "date") {
/* LAST
================================================== */
_last = getDateFractions(last);
ted = last.months;
if (_type == "millenium") { if (_type == "millenium") {
tsd = first.milleniums; tsd = first.milleniums;
@ -5744,10 +5822,46 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
ted = _last.minutes; ted = _last.minutes;
} }
_pos = ( tsd - interval.base ) * (config.interval_width / config.multiplier); _pos = ( tsd - interval.base ) * (config.interval_width / config.multiplier);
_pos_end = ( ted - interval.base ) * (config.interval_width / config.multiplier); _pos_end = ( ted - interval.base ) * (config.interval_width / config.multiplier);
} else {
if (_type == "millenium") {
tsd = first.milleniums;
ted = first.milleniums;
} else if (_type == "century") {
tsd = _first.centuries;
ted = _first.centuries;
} else if (_type == "decade") {
tsd = _first.decades;
ted = _first.decades;
} else if (_type == "year") {
tsd = _first.years;
ted = _first.years;
} else if (_type == "month") {
tsd = _first.months;
ted = _first.months;
} else if (_type == "week") {
tsd = _first.weeks;
ted = _first.weeks;
} else if (_type == "day") {
tsd = _first.days;
ted = _first.days;
} else if (_type == "hour") {
tsd = _first.hours;
ted = _first.hours;
} else if (_type == "minute") {
tsd = _first.minutes;
ted = _first.minutes;
}
_pos = ( tsd - interval.base ) * (config.interval_width / config.multiplier);
_pos_end = _pos;
}
return pos = {begin:_pos ,end:_pos_end}; return pos = {begin:_pos ,end:_pos_end};
} }
@ -5799,8 +5913,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
var calculateMultiplier = function() { var calculateMultiplier = function() {
var temp_multiplier = config.multiplier; var temp_multiplier = config.multiplier;
for(var i = 0; i < temp_multiplier; i++) { for(var i = 0; i < temp_multiplier; i++) {
@ -5909,6 +6021,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.Element.visible(_marker, false); VMM.Element.visible(_marker, false);
} }
} }
for(var j = 0; j < era_markers.length; j++) { for(var j = 0; j < era_markers.length; j++) {
@ -6082,6 +6196,75 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_calc.second.minor = 10; interval_calc.second.minor = 10;
} }
var rePositionInterval = function(the_intervals, is_animated) {
var _type = interval.type;
var _multiplier = interval.multiplier;
var last_position = 0;
var last_position_major = 0;
for(var i = 0; i < the_intervals.length; i++) {
var _interval = the_intervals[i].interval_element;
var _interval_date = the_intervals[i].interval_date;
var _interval_visible = the_intervals[i].interval_visible;
var _pos = positionOnTimeline(interval, _interval_date);
var pos = _pos.begin;
/* APPLY POSITION TO MARKER
================================================== */
if (is_animated) {
//VMM.Element.stop(_interval);
VMM.Element.animate(_interval, config.duration/2, config.ease, {"left": pos});
} else {
VMM.Element.css(_interval, "left", pos);
}
/* CONDENSE WHAT IS DISPLAYED
================================================== */
//VMM.Element.css(_interval, "display", "block");
var is_visible = true;
if ((pos - last_position) < 65 ) {
if ((pos - last_position) < 35 ) {
if (i%4 == 0) {
if (pos == 0) {
is_visible = false;
}
} else {
is_visible = false;
}
} else {
if (!VMM.Util.isEven(i)) {
is_visible = false;
}
}
}
if (_interval_visible) {
if (!is_visible) {
VMM.Element.animate(_interval, config.duration*2, config.ease, {"opacity": 0});
the_intervals[i].interval_visible = false;
}
} else {
if (is_visible) {
VMM.Element.animate(_interval, config.duration*2, config.ease, {"opacity": 100});
the_intervals[i].interval_visible = true;
}
}
last_position = pos;
}
var pos_offset = 50;
var interval_width = (last_position)+(pos_offset*6);
VMM.Element.width($timeintervalminor_minor, interval_width);
}
var positionInterval = function() { var positionInterval = function() {
VMM.attachElement($timeinterval, ""); VMM.attachElement($timeinterval, "");
@ -6108,41 +6291,41 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 100) * 100 ); interval.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 100) * 100 );
} }
interval.date.setFullYear(interval.date.getFullYear() + (inc_time * 100)); interval.date.setFullYear(interval.date.getFullYear() + (inc_time * 100));
_idd = Math.floor(interval.date.getFullYear() / 100) * 100; //_idd = Math.floor(interval.date.getFullYear() / 100) * 100;
} else if (interval.type == "decade") { } else if (interval.type == "decade") {
if (_first_run) { if (_first_run) {
interval.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 10) * 10 ); interval.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 10) * 10 );
} }
interval.date.setFullYear(interval.date.getFullYear() + (inc_time * 10)); interval.date.setFullYear(interval.date.getFullYear() + (inc_time * 10));
_idd = Math.floor(interval.date.getFullYear() / 10) * 10; //_idd = Math.floor(interval.date.getFullYear() / 10) * 10;
} else if (interval.type == "year") { } else if (interval.type == "year") {
if (_first_run) { if (_first_run) {
} }
interval.date.setFullYear(interval.date.getFullYear() + inc_time); interval.date.setFullYear(interval.date.getFullYear() + inc_time);
//_idd = interval.date.getFullYear(); //_idd = interval.date.getFullYear();
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} else if (interval.type == "month") { } else if (interval.type == "month") {
if (_first_run) { if (_first_run) {
interval.date.setMonth(data[0].startdate.getMonth()); interval.date.setMonth(data[0].startdate.getMonth());
} }
interval.date.setMonth(interval.date.getMonth() + inc_time); interval.date.setMonth(interval.date.getMonth() + inc_time);
//_idd = VMM.Util.date.month[interval.date.getMonth()] + ", " + interval.date.getFullYear() ; //_idd = VMM.Util.date.month[interval.date.getMonth()] + ", " + interval.date.getFullYear() ;
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} else if (interval.type == "week") { } else if (interval.type == "week") {
if (_first_run) { if (_first_run) {
interval.date.setMonth( data[0].startdate.getMonth() ); interval.date.setMonth( data[0].startdate.getMonth() );
interval.date.setDate( Math.floor(data[0].startdate.getDate() *7) ); interval.date.setDate( Math.floor(data[0].startdate.getDate() *7) );
} }
interval.date.setDate(interval.date.getDate() + (inc_time * 7) ); interval.date.setDate(interval.date.getDate() + (inc_time * 7) );
_idd = VMM.Util.date.day_abbr[interval.date.getDay()] + " " + VMM.Util.date.month_abbr[interval.date.getMonth()] + " " + interval.date.getDate(); //_idd = VMM.Util.date.day_abbr[interval.date.getDay()] + " " + VMM.Util.date.month_abbr[interval.date.getMonth()] + " " + interval.date.getDate();
} else if (interval.type == "day") { } else if (interval.type == "day") {
if (_first_run) { if (_first_run) {
interval.date.setMonth( data[0].startdate.getMonth() ); interval.date.setMonth( data[0].startdate.getMonth() );
interval.date.setDate( data[0].startdate.getDate() ); interval.date.setDate( data[0].startdate.getDate() );
} }
interval.date.setDate(interval.date.getDate() + inc_time); interval.date.setDate(interval.date.getDate() + inc_time);
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
//_idd = VMM.Util.date.day_abbr[interval.date.getDay()] + " " +VMM.Util.date.month[interval.date.getMonth()] + " " + interval.date.getDate(); //_idd = VMM.Util.date.day_abbr[interval.date.getDay()] + " " +VMM.Util.date.month[interval.date.getMonth()] + " " + interval.date.getDate();
} else if (interval.type == "hour") { } else if (interval.type == "hour") {
if (_first_run) { if (_first_run) {
@ -6152,7 +6335,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval.date.setHours(interval.date.getHours() + inc_time); interval.date.setHours(interval.date.getHours() + inc_time);
//_idd = VMM.Util.date.get12HRTime(interval.date, false); //interval.date.getHours() + ":00"; //_idd = VMM.Util.date.get12HRTime(interval.date, false); //interval.date.getHours() + ":00";
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} else if (interval.type == "minute") { } else if (interval.type == "minute") {
if (_first_run) { if (_first_run) {
interval.date.setMonth( data[0].startdate.getMonth() ); interval.date.setMonth( data[0].startdate.getMonth() );
@ -6162,7 +6345,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval.date.setMinutes(interval.date.getMinutes() + inc_time); interval.date.setMinutes(interval.date.getMinutes() + inc_time);
//_idd = interval.date.getHours() + ":" + VMM.Util.doubledigit(interval.date.getMinutes()); //_idd = interval.date.getHours() + ":" + VMM.Util.doubledigit(interval.date.getMinutes());
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} else if (interval.type == "second") { } else if (interval.type == "second") {
if (_first_run) { if (_first_run) {
interval.date.setMonth( data[0].startdate.getMonth() ); interval.date.setMonth( data[0].startdate.getMonth() );
@ -6173,9 +6356,9 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval.date.setSeconds(interval.date.getSeconds() + inc_time); interval.date.setSeconds(interval.date.getSeconds() + inc_time);
//_idd = interval.date.getHours() + ":" + VMM.Util.doubledigit(interval.date.getMinutes()) + ":" + VMM.Util.doubledigit(interval.date.getSeconds()); //_idd = interval.date.getHours() + ":" + VMM.Util.doubledigit(interval.date.getMinutes()) + ":" + VMM.Util.doubledigit(interval.date.getSeconds());
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type); //_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
} }
_idd = VMM.Util.date.prettyDate(interval.date, true, interval.type);
inc_time = 1; inc_time = 1;
if (_first_run) { if (_first_run) {
@ -6183,40 +6366,62 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
_first_run = false; _first_run = false;
var _pos = positionOnTimeline(interval, interval.date, interval.date); var _pos = positionOnTimeline(interval, interval.date);
var pos = _pos.begin; var pos = _pos.begin;
$interval_date = VMM.appendAndGetElement($timeinterval, "<div>", "_idd"); //$interval_date = VMM.appendAndGetElement($timeinterval, "<div>", "_idd");
VMM.appendElement($interval_date, _idd);
VMM.Element.css($interval_date, "left", pos); var _interval_element = VMM.appendAndGetElement($timeinterval, "<div>", "_idd");
VMM.Element.css($interval_date, "text-indent", -(VMM.Element.width($interval_date)/2)); var _interval_visible = false;
VMM.appendElement(_interval_element, _idd);
//VMM.Element.css(_interval_element, "left", pos);
VMM.Element.css(_interval_element, "text-indent", -(VMM.Element.width(_interval_element)/2));
VMM.Element.css(_interval_element, "opacity", "0");
/*
if ((pos - _last_pos) < 65 ) { if ((pos - _last_pos) < 65 ) {
if ((pos - _last_pos) < 35 ) { if ((pos - _last_pos) < 35 ) {
if (i%4 == 0) { if (i%4 == 0) {
if (pos == 0) { if (pos == 0) {
VMM.Element.css($interval_date, "display", "none"); VMM.Element.css(_interval_element, "display", "none");
_interval_visible = false;
} else { } else {
VMM.Element.css($interval_date, "display", ""); VMM.Element.css(_interval_element, "display", "");
} }
} else { } else {
VMM.Element.css($interval_date, "display", "none"); VMM.Element.css(_interval_element, "display", "none");
_interval_visible = false;
} }
} else { } else {
if (VMM.Util.isEven(i)) { if (VMM.Util.isEven(i)) {
VMM.Element.css($interval_date, "display", "none"); VMM.Element.css(_interval_element, "display", "none");
_interval_visible = false;
} else { } else {
VMM.Element.css($interval_date, "display", ""); VMM.Element.css(_interval_element, "display", "");
} }
} }
} else { } else {
VMM.Element.css($interval_date, "display", ""); VMM.Element.css(_interval_element, "display", "");
} }
*/
_last_pos = pos; _last_pos = pos;
/* ADD INTERVAL OBJ TO ARRAY FOR RETRIEVAL LATER
================================================== */
var _interval_date = new Date(interval.date);
var _interval_obj = {
interval_element: _interval_element,
interval_date: _interval_date,
interval_visible: _interval_visible,
type: "interval"
};
interval_array.push(_interval_obj);
} }
_first_run = true; _first_run = true;
@ -6231,26 +6436,26 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_major.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 100) * 100 ); interval_major.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 100) * 100 );
} }
interval_major.date.setFullYear(interval_major.date.getFullYear() + (inc_time_major * 100)); interval_major.date.setFullYear(interval_major.date.getFullYear() + (inc_time_major * 100));
_idd = Math.floor(interval_major.date.getFullYear() / 100) * 100; //_idd = Math.floor(interval_major.date.getFullYear() / 100) * 100;
} else if (interval_major.type == "decade") { } else if (interval_major.type == "decade") {
if (_first_run) { if (_first_run) {
interval_major.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 10) * 10 ); interval_major.date.setFullYear( Math.floor(data[0].startdate.getFullYear() / 10) * 10 );
} }
interval_major.date.setFullYear(interval_major.date.getFullYear() + (inc_time_major * 10)); interval_major.date.setFullYear(interval_major.date.getFullYear() + (inc_time_major * 10));
_idd = Math.floor(interval_major.date.getFullYear() / 10) * 10; //_idd = Math.floor(interval_major.date.getFullYear() / 10) * 10;
} else if (interval_major.type == "year") { } else if (interval_major.type == "year") {
if (_first_run) { if (_first_run) {
} }
interval_major.date.setFullYear(interval_major.date.getFullYear() + inc_time_major); interval_major.date.setFullYear(interval_major.date.getFullYear() + inc_time_major);
_idd = interval_major.date.getFullYear(); //_idd = interval_major.date.getFullYear();
//_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "month") { } else if (interval_major.type == "month") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth(data[0].startdate.getMonth()); interval_major.date.setMonth(data[0].startdate.getMonth());
} }
interval_major.date.setMonth(interval_major.date.getMonth() + inc_time_major); interval_major.date.setMonth(interval_major.date.getMonth() + inc_time_major);
_idd = VMM.Util.date.month[interval_major.date.getMonth()] + " " + interval_major.date.getFullYear(); //_idd = VMM.Util.date.month[interval_major.date.getMonth()] + " " + interval_major.date.getFullYear();
//_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "week") { } else if (interval_major.type == "week") {
if (_first_run) { if (_first_run) {
@ -6258,7 +6463,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_major.date.setDate( Math.floor(data[0].startdate.getDate() *7) ); interval_major.date.setDate( Math.floor(data[0].startdate.getDate() *7) );
} }
interval_major.date.setDate(interval_major.date.getDate() + (inc_time_major * 7) ); interval_major.date.setDate(interval_major.date.getDate() + (inc_time_major * 7) );
_idd = VMM.Util.date.day_abbr[interval_major.date.getDay()] + " " + VMM.Util.date.month_abbr[interval_major.date.getMonth()] + " " + interval_major.date.getDate(); //_idd = VMM.Util.date.day_abbr[interval_major.date.getDay()] + " " + VMM.Util.date.month_abbr[interval_major.date.getMonth()] + " " + interval_major.date.getDate();
} else if (interval_major.type == "day") { } else if (interval_major.type == "day") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth( data[0].startdate.getMonth() ); interval_major.date.setMonth( data[0].startdate.getMonth() );
@ -6267,7 +6472,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_major.date.setDate(interval_major.date.getDate() + inc_time_major); interval_major.date.setDate(interval_major.date.getDate() + inc_time_major);
//_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
//_idd = VMM.Util.date.day[interval_major.date.getDay()] + " " + VMM.Util.date.month_abbr[interval_major.date.getMonth()] + " " + interval_major.date.getDate(); //_idd = VMM.Util.date.day[interval_major.date.getDay()] + " " + VMM.Util.date.month_abbr[interval_major.date.getMonth()] + " " + interval_major.date.getDate();
_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "hour") { } else if (interval_major.type == "hour") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth( data[0].startdate.getMonth() ); interval_major.date.setMonth( data[0].startdate.getMonth() );
@ -6276,7 +6481,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval_major.date.setHours(interval_major.date.getHours() + inc_time_major); interval_major.date.setHours(interval_major.date.getHours() + inc_time_major);
//_idd = VMM.Util.date.get12HRTime(interval_major.date, false); //interval_major.date.getHours() + ":00"; //_idd = VMM.Util.date.get12HRTime(interval_major.date, false); //interval_major.date.getHours() + ":00";
_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "minute") { } else if (interval_major.type == "minute") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth( data[0].startdate.getMonth() ); interval_major.date.setMonth( data[0].startdate.getMonth() );
@ -6286,7 +6491,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval_major.date.setMinutes(interval_major.date.getMinutes() + inc_time_major); interval_major.date.setMinutes(interval_major.date.getMinutes() + inc_time_major);
//_idd = interval_major.date.getHours() + ":" + VMM.Util.doubledigit(interval_major.date.getMinutes()); //_idd = interval_major.date.getHours() + ":" + VMM.Util.doubledigit(interval_major.date.getMinutes());
_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} else if (interval_major.type == "second") { } else if (interval_major.type == "second") {
if (_first_run) { if (_first_run) {
interval_major.date.setMonth( data[0].startdate.getMonth() ); interval_major.date.setMonth( data[0].startdate.getMonth() );
@ -6297,9 +6502,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
interval_major.date.setSeconds(interval_major.date.getSeconds() + inc_time_major); interval_major.date.setSeconds(interval_major.date.getSeconds() + inc_time_major);
//_idd = interval_major.date.getHours() + ":" + VMM.Util.doubledigit(interval_major.date.getMinutes()) + ":" + VMM.Util.doubledigit(interval_major.date.getSeconds()); //_idd = interval_major.date.getHours() + ":" + VMM.Util.doubledigit(interval_major.date.getMinutes()) + ":" + VMM.Util.doubledigit(interval_major.date.getSeconds());
_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type); //_idd = VMM.Util.date.prettyDate(interval_major.date, true, interval_major.type);
} }
trace("interval_major.type " + interval_major.type); trace("interval_major.type " + interval_major.type);
_idd = VMM.Util.date.prettyDate(interval_major.date, false, interval_major.type);
inc_time_major = 1; inc_time_major = 1;
@ -6309,15 +6515,15 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
CREATE A DATE CREATE A DATE
//================================================== */ //================================================== */
var _pos = positionOnTimeline(interval, interval_major.date, interval_major.date); var _pos = positionOnTimeline(interval, interval_major.date);
var pos = _pos.begin; var pos = _pos.begin;
$interval_date = VMM.appendAndGetElement($timeintervalmajor, "<div>", "major"); //$interval_date = VMM.appendAndGetElement($timeintervalmajor, "<div>", "major");
VMM.appendElement($interval_date, _idd); _interval_major_element = VMM.appendAndGetElement($timeintervalmajor, "<div>", "major");
VMM.appendElement(_interval_major_element, _idd);
VMM.Element.css($interval_date, "left", pos); //VMM.Element.css(_interval_major_element, "left", pos);
VMM.Element.css($interval_date, "left", pos); VMM.Element.css(_interval_major_element, "text-indent", -(VMM.Element.width(_interval_major_element)/2));
VMM.Element.css($interval_date, "text-indent", -(VMM.Element.width($interval_date)/2));
if (_first_run) { if (_first_run) {
_major_first_pos = pos; _major_first_pos = pos;
@ -6327,6 +6533,20 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
_last_pos_major = pos; _last_pos_major = pos;
_major_last_pos = pos; _major_last_pos = pos;
/* ADD INTERVAL MAJOR OBJ TO ARRAY FOR RETRIEVAL LATER
================================================== */
var _interval_major_date = new Date(interval_major.date);
var _interval_major_obj = {
interval_element: _interval_major_element,
interval_date: _interval_major_date,
interval_visible: true,
type: "interval major"
};
interval_major_array.push(_interval_major_obj);
} }
VMM.Element.width($content, interval.number * (config.interval_width / config.multiplier) ); VMM.Element.width($content, interval.number * (config.interval_width / config.multiplier) );
@ -6342,12 +6562,16 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.Element.width($timeintervalminor_minor, _minor_width); VMM.Element.width($timeintervalminor_minor, _minor_width);
} }
rePositionInterval(interval_array, true);
rePositionInterval(interval_major_array, true);
//VMM.Element.css($timeintervalminor_minor, "left", _major_first_pos - _minor_pos_offset); //VMM.Element.css($timeintervalminor_minor, "left", _major_first_pos - _minor_pos_offset);
config.timeline_width = VMM.Element.width($timeinterval); config.timeline_width = VMM.Element.width($timeinterval);
} }
var buildInterval = function() { var buildInterval = function() {
@ -6550,10 +6774,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}; };
var refreshTimeline = function() { var refreshTimeline = function() {
trace("config.multiplier " + config.multiplier);
positionMarkers(true); positionMarkers(true);
positionInterval(); rePositionInterval(interval_array, true);
//positionMarkers(true); rePositionInterval(interval_major_array, true);
//reSize();
}; };

Loading…
Cancel
Save