Browse Source

Added constants for drag slider to config. Added new start_at_slide feature. Started a IE7 depreciated view

pull/177/head
Zach Wise 12 years ago
parent
commit
386cd67169
  1. 85
      source/js/VMM.Timeline.js

85
source/js/VMM.Timeline.js

@ -103,6 +103,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
current_slide: 0, current_slide: 0,
hash_bookmark: false, hash_bookmark: false,
start_at_end: false, start_at_end: false,
start_at_slide: 0,
start_page: false, start_page: false,
api_keys: { api_keys: {
google: "", google: "",
@ -125,10 +126,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
density: 4, density: 4,
minor_width: 0, minor_width: 0,
minor_left: 0, minor_left: 0,
contstraint: { constraint: {
left: 0, left: 0,
right: 0, right: 0,
right_min: 0 right_min: 0,
right_max: 0
}, },
multiplier: { multiplier: {
current: 6, current: 6,
@ -178,18 +180,20 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
if(window.location.hash) { if(window.location.hash) {
var hash = window.location.hash.substring(1); var hash = window.location.hash.substring(1);
if (!isNaN(hash)) { if (!isNaN(hash)) {
config.current_slide = parseInt(hash); config.current_slide = parseInt(hash);
} }
} }
window.onhashchange = function () { window.onhashchange = function () {
var hash = window.location.hash.substring(1);
if (config.hash_bookmark) { if (config.hash_bookmark) {
if (is_moving) { if (is_moving) {
var hash = window.location.hash.substring(1);
goToEvent(parseInt(hash)); goToEvent(parseInt(hash));
} else { } else {
is_moving = false; is_moving = false;
} }
} else {
goToEvent(parseInt(hash));
} }
} }
@ -356,17 +360,13 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
} }
} }
if (ie7) { if (type.of(_data) == "string" || type.of(_data) == "object") {
ie7 = true; VMM.Timeline.DataObj.getData(_data);
VMM.fireEvent(global, config.events.messege, "Internet Explorer " + VMM.Browser.version + " is not supported by TimelineJS. Please update your browser to version 8 or higher.");
} else { } else {
if (type.of(_data) == "string" || type.of(_data) == "object") { VMM.Timeline.DataObj.getData(VMM.getElement(timeline_id));
VMM.Timeline.DataObj.getData(_data);
} else {
VMM.Timeline.DataObj.getData(VMM.getElement(timeline_id));
}
} }
}; };
this.iframeLoaded = function() { this.iframeLoaded = function() {
@ -414,24 +414,59 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
if (config.start_at_end && config.current_slide == 0) { if (config.start_at_end && config.current_slide == 0) {
config.current_slide = _dates.length - 1; config.current_slide = _dates.length - 1;
} }
// CREATE DOM STRUCTURE // START AT END?
VMM.attachElement($timeline, ""); if (parseInt(config.start_at_slide) > 0) {
VMM.appendElement($timeline, "<div class='container main'><div class='feature'><div class='slider'></div></div><div class='navigation'></div></div>"); config.current_slide = parseInt(config.start_at_slide);
}
reSize(); // IE7
if (ie7) {
ie7 = true;
VMM.fireEvent(global, config.events.messege, "Internet Explorer " + VMM.Browser.version + " is not supported by TimelineJS. Please update your browser to version 8 or higher.");
} else {
// CREATE DOM STRUCTURE
VMM.attachElement($timeline, "");
VMM.appendElement($timeline, "<div class='container main'><div class='feature'><div class='slider'></div></div><div class='navigation'></div></div>");
VMM.bindEvent("div.slider", onSliderLoaded, "LOADED"); reSize();
VMM.bindEvent("div.navigation", onTimeNavLoaded, "LOADED");
VMM.bindEvent("div.slider", onSlideUpdate, "UPDATE");
VMM.bindEvent("div.navigation", onMarkerUpdate, "UPDATE");
slider.init(_dates); VMM.bindEvent("div.slider", onSliderLoaded, "LOADED");
timenav.init(_dates, data.era); VMM.bindEvent("div.navigation", onTimeNavLoaded, "LOADED");
VMM.bindEvent("div.slider", onSlideUpdate, "UPDATE");
VMM.bindEvent("div.navigation", onMarkerUpdate, "UPDATE");
// RESIZE EVENT LISTENERS slider.init(_dates);
VMM.bindEvent(global, reSize, config.events.resize); timenav.init(_dates, data.era);
//VMM.bindEvent(global, function(e) {e.preventDefault()}, "touchmove");
// RESIZE EVENT LISTENERS
VMM.bindEvent(global, reSize, config.events.resize);
//VMM.bindEvent(global, function(e) {e.preventDefault()}, "touchmove");
}
};
var ie7Build = function() {
trace("IE7 or lower");
for(var i = 0; i < _dates.length; i++) {
trace(_dates[i]);
/*
var st = VMM.Date.prettyDate(data.startdate);
var en = VMM.Date.prettyDate(data.enddate);
var tag = "";
if (data.tag != null && data.tag != "") {
tag = VMM.createElement("span", data.tag, "slide-tag");
}
if (st != en) {
c.text += VMM.createElement("h2", st + " &mdash; " + en + tag, "date");
} else {
c.text += VMM.createElement("h2", st + tag, "date");
}
*/
}
}; };
var updateSize = function() { var updateSize = function() {

Loading…
Cancel
Save