Browse Source

Major optimizations for timeline zooming, especially dealing with large timelines.

pull/127/merge
Zach Wise 13 years ago
parent
commit
a20574a203
  1. 575
      source/js/VMM.Timeline.TimeNav.js

575
source/js/VMM.Timeline.TimeNav.js

@ -7,7 +7,17 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
trace("VMM.Timeline.TimeNav");
var events = {}, timespan = {}, layout = parent;
var data = [], era_markers = [], markers = [], interval_array = [], interval_major_array = [], eras, content, tags = [];
var timeouts = {
interval_position: ""
};
var data = [], era_markers = [], markers = [], interval_array = [], interval_major_array = [], eras, content, tags = [];
var timenav_pos = {
left:"",
visible: {
left:"",
right:""
}
};
var current_marker = 0;
var _active = false;
@ -159,8 +169,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var refreshTimeline = function() {
trace("config.nav.multiplier " + config.nav.multiplier.current);
positionMarkers(true);
positionInterval(interval_array, true, true);
positionInterval(interval_major_array, true);
positionInterval($timeinterval, interval_array, true, true);
positionInterval($timeintervalmajor, interval_major_array, true);
};
/* MARKER EVENTS
@ -176,13 +186,16 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
};
var goToMarker = function(n, ease, duration, fast, firstrun) {
var _ease = config.ease,
_duration = config.duration,
is_last = false,
is_first = false;
current_marker = n;
var _ease = config.ease;
var _duration = config.duration;
var is_last = false;
var is_first = false;
var _pos = VMM.Lib.position(markers[current_marker].marker);
timenav_pos.left = (config.width/2) - VMM.Lib.position(markers[current_marker].marker).left;
timenav_pos.visible.left = Math.abs(timenav_pos.left) - 100;
timenav_pos.visible.right = Math.abs(timenav_pos.left) + config.width + 100;
if (current_marker == 0) {
is_first = true;
@ -207,7 +220,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// ANIMATE MARKER
VMM.Lib.stop($timenav);
VMM.Lib.animate($timenav, _duration, _ease, {"left": (config.width/2) - (_pos.left)});
VMM.Lib.animate($timenav, _duration, _ease, {"left": timenav_pos.left});
}
@ -220,16 +233,16 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
/* CALCULATIONS
================================================== */
var averageMarkerPositionDistance = function() {
var last_pos = 0;
var pos = 0;
var pos_dif = 0;
var mp_diff = [];
var last_pos = 0,
pos = 0,
pos_dif = 0,
mp_diff = [];
for(var i = 0; i < markers.length; i++) {
if (data[i].type == "start") {
} else {
var _pos = positionOnTimeline(interval, data[i].startdate, data[i].enddate);
var _pos = positionOnTimeline(interval, markers[i].relative_pos),
last_pos = pos;
pos = _pos.begin;
pos_dif = pos - last_pos;
@ -442,134 +455,113 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
/* POSITION
================================================== */
var positionOnTimeline = function(the_interval, first, last) {
var _type = the_interval.type;
var _multiplier = the_interval.multiplier;
var positionRelative = function(_interval, first, last) {
var _first,
_last,
_type = _interval.type,
timerelative = {start: "", end: "", type: _type};
var _first = getDateFractions(first);
var _last;
var tsd;
var ted;
/* CALCULATE POSITION ON TIMELINE
/* FIRST
================================================== */
tsd = first.months;
_first = getDateFractions(first);
timerelative.start = first.months;
if (_type == "eon") {
timerelative.start = _first.eons;
} else if (_type == "era") {
timerelative.start = _first.eras;
} else if (_type == "epoch") {
timerelative.start = _first.epochs;
} else if (_type == "age") {
timerelative.start = _first.ages;
} else if (_type == "millenium") {
timerelative.start = first.milleniums;
} else if (_type == "century") {
timerelative.start = _first.centuries;
} else if (_type == "decade") {
timerelative.start = _first.decades;
} else if (_type == "year") {
timerelative.start = _first.years;
} else if (_type == "month") {
timerelative.start = _first.months;
} else if (_type == "week") {
timerelative.start = _first.weeks;
} else if (_type == "day") {
timerelative.start = _first.days;
} else if (_type == "hour") {
timerelative.start = _first.hours;
} else if (_type == "minute") {
timerelative.start = _first.minutes;
}
/* LAST
================================================== */
if (type.of(last) == "date") {
/* LAST
================================================== */
_last = getDateFractions(last);
ted = last.months;
timerelative.end = last.months;
if (_type == "eon") {
tsd = _first.eons;
ted = _last.eons;
timerelative.end = _last.eons;
} else if (_type == "era") {
tsd = _first.eras;
ted = _last.eras;
timerelative.end = _last.eras;
} else if (_type == "epoch") {
tsd = _first.epochs;
ted = _last.epochs;
timerelative.end = _last.epochs;
} else if (_type == "age") {
tsd = _first.ages;
ted = _last.ages;
timerelative.end = _last.ages;
} else if (_type == "millenium") {
tsd = first.milleniums;
ted = last.milleniums;
timerelative.end = last.milleniums;
} else if (_type == "century") {
tsd = _first.centuries;
ted = _last.centuries;
timerelative.end = _last.centuries;
} else if (_type == "decade") {
tsd = _first.decades;
ted = _last.decades;
timerelative.end = _last.decades;
} else if (_type == "year") {
tsd = _first.years;
ted = _last.years;
timerelative.end = _last.years;
} else if (_type == "month") {
tsd = _first.months;
ted = _last.months;
timerelative.end = _last.months;
} else if (_type == "week") {
tsd = _first.weeks;
ted = _last.weeks;
timerelative.end = _last.weeks;
} else if (_type == "day") {
tsd = _first.days;
ted = _last.days;
timerelative.end = _last.days;
} else if (_type == "hour") {
tsd = _first.hours;
ted = _last.hours;
timerelative.end = _last.hours;
} else if (_type == "minute") {
tsd = _first.minutes;
ted = _last.minutes;
timerelative.end = _last.minutes;
}
_pos = ( tsd - interval.base ) * (config.nav.interval_width / config.nav.multiplier.current);
_pos_end = ( ted - interval.base ) * (config.nav.interval_width / config.nav.multiplier.current);
} else {
if (_type == "eon") {
tsd = _first.eons;
ted = _first.eons;
} else if (_type == "era") {
tsd = _first.eras;
ted = _first.eras;
} else if (_type == "epoch") {
tsd = _first.epochs;
ted = _first.epochs;
} else if (_type == "age") {
tsd = _first.ages;
ted = _first.ages;
} 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.nav.interval_width / config.nav.multiplier.current);
_pos_end = _pos;
timerelative.end = timerelative.start;
}
return pos = {begin:_pos ,end:_pos_end};
return timerelative
}
var positionOnTimeline = function(the_interval, timerelative) {
return {
begin: (timerelative.start - interval.base) * (config.nav.interval_width / config.nav.multiplier.current),
end: (timerelative.end - interval.base) * (config.nav.interval_width / config.nav.multiplier.current)
};
}
var positionMarkers = function(is_animated) {
var _type = interval.type;
var _multiplier = interval.multiplier;
// ROWS
var row = 2; //row
var lpos = 0; // last marker pos;
var row_depth = 0;
var _line_last_height_pos = 150;
var _line_height = 6;
var cur_mark = 0;
var _type = interval.type,
_multiplier = interval.multiplier,
row = 2,
lpos = 0,
row_depth = 0,
_line_last_height_pos = 150,
_line_height = 6,
cur_mark = 0,
in_view_margin = config.width,
in_view = {
left: timenav_pos.visible.left - in_view_margin,
right: timenav_pos.visible.right + in_view_margin
};
config.nav.minor_width = config.width;
VMM.Lib.removeClass(".flag", "row1");
VMM.Lib.removeClass(".flag", "row2");
@ -577,26 +569,40 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
for(var i = 0; i < markers.length; i++) {
var _line; // EVENT LENGTH
var _marker = markers[i].marker;
var _marker_flag = markers[i].flag;
var _marker_line_event = markers[i].lineevent;
var _pos = positionOnTimeline(interval, data[i].startdate, data[i].enddate);
var _pos_offset = -2;
var _line,
_marker = markers[i].marker,
_marker_flag = markers[i].flag,
_marker_line_event = markers[i].lineevent,
_pos = positionOnTimeline(interval, markers[i].relative_pos),
_pos_offset = -2,
is_in_view = false;
pos = _pos.begin;
_pos_end = _pos.end;
pos = _pos.begin;
_pos_end = _pos.end;
// COMPENSATE FOR DATES BEING POITIONED IN THE MIDDLE
pos = Math.round(pos + _pos_offset);
_pos_end = Math.round(_pos_end + _pos_offset);
_line = Math.round(_pos_end - pos);
pos = Math.round(pos + _pos_offset);
_pos_end = Math.round(_pos_end + _pos_offset);
_line = Math.round(_pos_end - pos);
if (current_marker == i) {
timenav_pos.left = (config.width/2) - pos;
timenav_pos.visible.left = Math.abs(timenav_pos.left);
timenav_pos.visible.right = Math.abs(timenav_pos.left) + config.width;
in_view.left = timenav_pos.visible.left - in_view_margin;
in_view.right = timenav_pos.visible.right + in_view_margin;
}
if (Math.abs(pos) >= in_view.left && Math.abs(pos) <= in_view.right ) {
is_in_view = true;
}
// APPLY POSITION TO MARKER
if (is_animated) {
VMM.Lib.stop(_marker);
VMM.Lib.animate(_marker, config.duration/2, config.ease, {"left": pos});
} else {
VMM.Lib.stop(_marker);
VMM.Lib.css(_marker, "left", pos);
}
@ -643,10 +649,11 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// SET LAST MARKER POSITION
lpos = pos;
if (is_animated) {
if (is_animated && is_in_view) {
VMM.Lib.stop(_marker_flag);
VMM.Lib.animate(_marker_flag, config.duration, config.ease, {"top": config.nav.rows[row]});
} else {
VMM.Lib.stop(_marker_flag);
VMM.Lib.css(_marker_flag, "top", config.nav.rows[row]);
}
@ -655,16 +662,23 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.Lib.visible(_marker, false);
}
if (pos > config.nav.minor_width) {
config.nav.minor_width = pos;
}
if (pos < config.nav.minor_left) {
config.nav.minor_left = pos;
}
}
for(var j = 0; j < era_markers.length; j++) {
var _line;
var era = era_markers[j];
var era_elem = era.content;
var pos = positionOnTimeline(interval, era.startdate, era.enddate);
var era_length = pos.end - pos.begin;
var era_height = 25;
var _line,
era = era_markers[j],
era_elem = era.content,
pos = positionOnTimeline(interval, era.relative_pos),
era_length = pos.end - pos.begin,
era_height = 25;
// APPLY POSITION TO MARKER
VMM.Lib.css(era_elem, "left", pos.begin);
VMM.Lib.css(era_elem, "width", era_length);
@ -674,103 +688,174 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// ANIMATE THE TIMELINE TO ADJUST TO CHANGES
VMM.Lib.stop($timenav);
VMM.Lib.animate($timenav, config.duration/2, config.ease, {"left": (config.width/2) - (cur_mark)});
//VMM.Lib.delay_animate(config.duration, $timenav, config.duration/2, config.ease, {"left": (config.width/2) - (cur_mark)});
}
var positionInterval = function(the_intervals, is_animated, is_minor) {
var positionInterval = function(the_main_element, the_intervals, is_animated, is_minor) {
var _type = interval.type,
_multiplier = interval.multiplier,
last_position = 0,
last_position_major = 0,
//in_view_margin = (config.nav.minor_width/config.nav.multiplier.current)/2,
in_view_margin = config.width,
in_view = {
left: timenav_pos.visible.left - in_view_margin,
right: timenav_pos.visible.right + in_view_margin
}
not_too_many = true;
config.nav.minor_left = 0;
if (the_intervals.length > 100) {
not_too_many = false;
trace("TOO MANY " + the_intervals.length);
}
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;
var is_visible = true;
var pos_offset = 50;
var _interval = the_intervals[i].interval_element,
_interval_date = the_intervals[i].interval_date,
_interval_visible = the_intervals[i].interval_visible,
_pos = positionOnTimeline(interval, the_intervals[i].relative_pos),
pos = _pos.begin,
_animation = the_intervals[i].animation,
is_visible = true,
is_in_view = false,
pos_offset = 50;
// APPLY POSITION TO MARKER
if (is_animated) {
VMM.Lib.animate(_interval, config.duration/2, config.ease, {"left": pos});
} else {
VMM.Lib.css(_interval, "left", pos);
_animation.pos = pos;
_animation.animate = false;
if (Math.abs(pos) >= in_view.left && Math.abs(pos) <= in_view.right ) {
is_in_view = true;
}
// CONDENSE WHAT IS DISPLAYED
if (config.nav.multiplier.current > 16 && is_minor) {
is_visible = false;
} else {
if ((pos - last_position) < 65 ) {
if ((pos - last_position) < 35 ) {
if (i%4 == 0) {
if (pos == 0) {
if (true) {
// CONDENSE WHAT IS DISPLAYED
if (config.nav.multiplier.current > 16 && is_minor) {
is_visible = false;
} else {
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 {
is_visible = false;
}
} else {
if (!VMM.Util.isEven(i)) {
is_visible = false;
if (!VMM.Util.isEven(i)) {
is_visible = false;
}
}
}
}
}
if (_interval_visible) {
if (!is_visible) {
if (is_animated) {
VMM.Lib.animate(_interval, config.duration*2, config.ease, {"opacity": 0});
} else {
VMM.Lib.css(_interval, "opacity", 0);
if (is_visible) {
if (the_intervals[i].is_detached) {
VMM.Lib.append(the_main_element, _interval);
the_intervals[i].is_detached = false;
}
the_intervals[i].interval_visible = false;
} else {
the_intervals[i].is_detached = true;
VMM.Lib.detach(_interval);
}
} else {
if (is_visible) {
if (is_animated) {
VMM.Lib.animate(_interval, config.duration*2, config.ease, {"opacity": 100});
if (_interval_visible) {
if (!is_visible) {
_animation.opacity = "0";
if (is_animated && not_too_many) {
_animation.animate = true;
}
the_intervals[i].interval_visible = false;
} else {
_animation.opacity = "100";
if (is_animated && is_in_view) {
_animation.animate = true;
}
}
} else {
_animation.opacity = "100";
if (is_visible) {
if (is_animated && not_too_many) {
_animation.animate = true;
} else {
if (is_animated && is_in_view) {
_animation.animate = true;
}
}
the_intervals[i].interval_visible = true;
} else {
VMM.Lib.css(_interval, "opacity", 100);
if (is_animated && not_too_many) {
_animation.animate = true;
}
}
the_intervals[i].interval_visible = true;
}
}
last_position = pos;
last_position = pos;
if (pos > config.nav.minor_width) {
config.nav.minor_width = pos;
if (pos > config.nav.minor_width) {
config.nav.minor_width = pos;
}
if (pos < config.nav.minor_left) {
config.nav.minor_left = pos;
trace("MINOR " + pos);
}
}
if (_animation.animate) {
VMM.Lib.animate(_interval, config.duration/2, config.ease, {opacity: _animation.opacity, left: _animation.pos});
} else {
VMM.Lib.css(_interval, "opacity", _animation.opacity);
VMM.Lib.css(_interval, "left", pos);
}
}
VMM.Lib.css($timeintervalminor_minor, "left", -(config.width/2));
VMM.Lib.width($timeintervalminor_minor, (config.nav.minor_width)+(config.width) );
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) );
//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");
}
}
*/
}
var createIntervalElements = function(_interval, _array, _element_parent) {
var inc_time = 0;
var _first_run = true;
var _last_pos = 0;
var _largest_pos = 0;
var inc_time = 0,
_first_run = true,
_last_pos = 0,
_largest_pos = 0;
VMM.attachElement(_element_parent, "");
_interval.date = new Date(data[0].startdate.getFullYear(), 0, 1, 0,0,0);
for(var i = 0; i < Math.ceil(_interval.number) + 1; i++) {
var _idd;
var _pos;
var pos;
var _element = VMM.appendAndGetElement(_element_parent, "<div>", _interval.classname);
var _date;
var _visible = false;
var _idd,
_pos,
pos,
_date,
_visible = false,
_relative_pos,
_element = VMM.appendAndGetElement(_element_parent, "<div>", _interval.classname);
if (_interval.type == "eon") {
if (_first_run) {
@ -861,8 +946,11 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
_first_run = false;
_pos = positionOnTimeline(_interval, _interval.date);
pos = _pos.begin;
_relative_pos = positionRelative(interval, _interval.date);
//_pos = positionOnTimeline(_interval, _interval.date);
//pos = _pos.begin;
pos = _relative_pos.begin;
VMM.appendElement(_element, _idd);
@ -881,7 +969,15 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
interval_element: _element,
interval_date: _date,
interval_visible: _visible,
type: _interval.interval_type
type: _interval.interval_type,
relative_pos: _relative_pos,
is_detached: false,
animation: {
animate: false,
pos: "",
opacity: "100"
}
};
_array.push(_obj);
@ -889,7 +985,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.Lib.width($timeintervalminor_minor, _largest_pos);
positionInterval(_array);
positionInterval(_element_parent, _array);
}
@ -917,8 +1014,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
buildMarkers();
calculateMultiplier();
positionMarkers();
positionInterval(interval_array, false, true);
positionInterval(interval_major_array);
positionInterval($timeinterval, interval_array, false, true);
positionInterval($timeintervalmajor, interval_major_array);
//reSize(true);
if (config.start_page) {
@ -1040,46 +1139,67 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var buildMarkers = function() {
var row = 2; //row
var lpos = 0; // last marker pos;
var row_depth = 0;
markers = [];
era_markers = [];
var row = 2,
lpos = 0,
row_depth = 0;
markers = [];
era_markers = [];
for(var i = 0; i < data.length; i++) {
var _marker, _marker_flag, _marker_content, _marker_dot, _marker_line, _marker_line_event, _marker_title = "";
_marker = VMM.appendAndGetElement($content, "<div>", "marker");
_marker_flag = VMM.appendAndGetElement(_marker, "<div>", "flag");
_marker_content = VMM.appendAndGetElement(_marker_flag, "<div>", "flag-content");
_marker_dot = VMM.appendAndGetElement(_marker, "<div>", "dot");
_marker_line = VMM.appendAndGetElement(_marker, "<div>", "line");
_marker_line_event = VMM.appendAndGetElement(_marker_line, "<div>", "event-line");
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_flag = VMM.appendAndGetElement(_marker, "<div>", "flag");
_marker_content = VMM.appendAndGetElement(_marker_flag, "<div>", "flag-content");
_marker_dot = VMM.appendAndGetElement(_marker, "<div>", "dot");
_marker_line = VMM.appendAndGetElement(_marker, "<div>", "line");
_marker_line_event = VMM.appendAndGetElement(_marker_line, "<div>", "event-line");
_marker_relative_pos = positionRelative(interval, data[i].startdate, data[i].enddate);
_marker_thumb = "";
// THUMBNAIL
if (data[i].asset != null && data[i].asset != "") {
VMM.appendElement(_marker_content, VMM.MediaElement.thumbnail(data[i].asset, 24, 24));
VMM.appendElement(_marker_content, VMM.MediaElement.thumbnail(data[i].asset, 24, 24, data[i].uniqueid));
} else {
//VMM.appendElement(_marker_content, "<div class='thumbnail thumb-plaintext'></div>");
VMM.appendElement(_marker_content, "<div style='margin-right:7px;height:50px;width:2px;float:left;'></div>");
}
// ADD DATE AND TITLE
if (data[i].title != " ") {
_marker_title = VMM.Util.unlinkify(data[i].title);
} else {
if (typeof data[i].slug != 'undefined') {
_marker_title = VMM.Util.unlinkify(data[i].slug);
if (data[i].title == "" || data[i].title == " " ) {
trace("TITLE NOTHING")
if (typeof data[i].slug != 'undefined' && data[i].slug != "") {
trace("SLUG")
_marker_title = VMM.Util.untagify(data[i].slug);
has_title = true;
} else {
var m = VMM.MediaType(data[i].asset.media);
if (m.type == "quote" || m.type == "unknown") {
_marker_title = VMM.Util.untagify(m.id);
has_title = true;
} else if (m.type == "twitter") {
has_title = false;
VMM.appendElement(_marker_content, "<h3 id='text_thumb_" + m.id + "'>" + _marker_title + "</h3>");
} else {
has_title = false;
}
}
} else if (data[i].title != "" || data[i].title != " ") {
trace(data[i].title)
_marker_title = VMM.Util.untagify(data[i].title);
has_title = true;
} else {
trace("TITLE SLUG NOT FOUND " + data[i].slug)
}
if (has_title) {
VMM.appendElement(_marker_content, "<h3>" + _marker_title + "</h3>");
}
VMM.appendElement(_marker_content, "<h3>" + _marker_title + "</h3><h4>" + data[i].date + "</h4>");
// ADD ID
VMM.Lib.attr(_marker, "id", (data[i].uniqueid).toString());
VMM.Lib.attr(_marker, "id", ( "marker_" + data[i].uniqueid).toString() );
// MARKER CLICK
VMM.bindEvent(_marker_flag, onMarkerClick, "", {number: i});
@ -1090,16 +1210,22 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
flag: _marker_flag,
lineevent: _marker_line_event,
type: "marker",
relative_pos: _marker_relative_pos,
tag: data[i].tag
};
if (data[i].type == "start") {
trace("BUILD MARKER HAS START PAGE")
trace("BUILD MARKER HAS START PAGE");
config.start_page = true;
_marker_obj.type = "start";
}
if (data[i].type == "storify") {
_marker_obj.type = "storify";
}
if (data[i].tag) {
tags.push(data[i].tag);
}
@ -1133,9 +1259,12 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
enddate: VMM.Util.parseDate(eras[j].endDate),
title: eras[j].headline,
uniqueid: VMM.Util.unique_ID(4),
color: eras[j].color
color: eras[j].color,
relative_pos: ""
};
era.relative_pos = positionRelative(interval, eras[j].startdate, eras[j].enddate);
VMM.Lib.attr(era.content, "id", era.uniqueid);
VMM.Lib.css(era.content, "background", era.color);
VMM.appendElement(era.content, "<h3>" + VMM.Util.unlinkify(era.title) + "</h3>");

Loading…
Cancel
Save