Browse Source

Cleanup and fixes a new issue with config files not being implemented as a result of merging with StoryJS codebase

pull/197/head
Zach Wise 13 years ago
parent
commit
6c77328354
  1. 7
      LICENSE
  2. 2
      compiled/js/timeline-embed.js
  3. 12
      compiled/js/timeline-min.js
  4. 820
      compiled/js/timeline.js
  5. 78
      examples/example_kitchensink.json
  6. 11
      examples/model.json
  7. 0
      source/js/Core/Library/AES.js
  8. 0
      source/js/Core/Library/Embed.LoadLib.js
  9. 0
      source/js/Core/Library/bootstrap-tooltip.js
  10. 0
      source/js/Core/Library/jQuery/easing.js
  11. 62
      source/js/Core/Media/VMM.ExternalAPI.js
  12. 0
      source/js/Core/Media/VMM.Media.js
  13. 31
      source/js/Core/Media/VMM.MediaElement.js
  14. 12
      source/js/Core/Media/VMM.MediaType.js
  15. 0
      source/js/Core/Media/VMM.TextElement.js
  16. 0
      source/js/Core/Slider/VMM.DragSlider.js
  17. 0
      source/js/Core/Slider/VMM.Slider.Slide.js
  18. 169
      source/js/Core/Slider/VMM.Slider.js
  19. 8
      source/js/Embed/Embed.js
  20. 2
      source/js/VMM.Timeline.DataObj.js
  21. 2
      source/js/VMM.Timeline.License.js
  22. 435
      source/js/VMM.Timeline.TimeNav.js
  23. 107
      source/js/VMM.Timeline.js

7
LICENSE

@ -10,4 +10,9 @@ GNU General Public License for more details.
http://www.gnu.org/licenses/ http://www.gnu.org/licenses/
Map tiles by [Stamen Design](http://stamen.com "Stamen Design"), under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0 "CC BY 3.0"). Data by [OpenStreetMap](http://openstreetmap.org "OpenStreetMap"), under [CC BY SA](http://creativecommons.org/licenses/by-sa/3.0 "CC BY SA"). -------------------------------------------
Map tiles by [Stamen Design](http://stamen.com "Stamen Design"), under
[CC BY 3.0](http://creativecommons.org/licenses/by/3.0 "CC BY 3.0").
Data by [OpenStreetMap](http://openstreetmap.org "OpenStreetMap"),
under [CC BY SA](http://creativecommons.org/licenses/by-sa/3.0 "CC BY SA").

2
compiled/js/timeline-embed.js

File diff suppressed because one or more lines are too long

12
compiled/js/timeline-min.js vendored

File diff suppressed because one or more lines are too long

820
compiled/js/timeline.js

File diff suppressed because it is too large Load Diff

78
examples/example_kitchensink.json

@ -31,6 +31,80 @@
"text":"Example of an era" "text":"Example of an era"
} }
], ],
"chart": [
{
"startDate":"1895,1,1",
"endDate":"1905,1,1",
"headline":"Something",
"value":"28"
},
{
"startDate":"1906,1,1",
"endDate":"1915,1,1",
"headline":"Something",
"value":"35"
},
{
"startDate":"1916,1,1",
"endDate":"1925,1,1",
"headline":"Something",
"value":"55"
},
{
"startDate":"1926,1,1",
"endDate":"1935,1,1",
"headline":"Something",
"value":"67"
},
{
"startDate":"1936,1,1",
"endDate":"1945,1,1",
"headline":"Something",
"value":"78"
},
{
"startDate":"1946,1,1",
"endDate":"1955,1,1",
"headline":"Something",
"value":"79"
},
{
"startDate":"1956,1,1",
"endDate":"1965,1,1",
"headline":"Something",
"value":"84"
},
{
"startDate":"1966,1,1",
"endDate":"1975,1,1",
"headline":"Something",
"value":"66"
},
{
"startDate":"1976,1,1",
"endDate":"1985,1,1",
"headline":"Something",
"value":"87"
},
{
"startDate":"1986,1,1",
"endDate":"1995,1,1",
"headline":"Something",
"value":"90"
},
{
"startDate":"1996,1,1",
"endDate":"2005,1,1",
"headline":"Something",
"value":"45"
},
{
"startDate":"2006,1,1",
"endDate":"2015,1,1",
"headline":"Something",
"value":"99"
}
],
"date": [ "date": [
{ {
"startDate":"2012,1,18", "startDate":"2012,1,18",
@ -38,9 +112,9 @@
"text":"To add a YouTube video, just add a link to it.", "text":"To add a YouTube video, just add a link to it.",
"asset": "asset":
{ {
"media":"http://youtu.be/yRvJylbSg7o", "media":"http://youtu.be/5NlVttFRPpU?hd=1&t=3s",
"credit":"", "credit":"",
"caption":"Directed and Edited by Matt Mayer, Produced by Seth Keim, Written by Eliot Glazer. Featuring Eliot and Ilana Glazer, who are siblings, not married." "caption":"From the creators of the game Flower comes Journey for the PlayStation 3."
} }
}, },
{ {

11
examples/model.json

@ -30,10 +30,19 @@
"startDate":"2011,12,10", "startDate":"2011,12,10",
"endDate":"2011,12,11", "endDate":"2011,12,11",
"headline":"Headline Goes Here", "headline":"Headline Goes Here",
"text":"<p>Body text goes here, some HTML is OK</p>",
"tag":"This is Optional" "tag":"This is Optional"
} }
],
"chart": [
{
"startDate":"2011,12,10",
"endDate":"2011,12,11",
"headline":"Headline Goes Here",
"value":"28"
}
] ]
} }
} }

0
source/js/lib/AES.js → source/js/Core/Library/AES.js

0
source/js/lib/Embed.LoadLib.js → source/js/Core/Library/Embed.LoadLib.js

0
source/js/lib/bootstrap-tooltip.js → source/js/Core/Library/bootstrap-tooltip.js vendored

0
source/js/lib/jQuery/easing.js → source/js/Core/Library/jQuery/easing.js

62
source/js/Media/VMM.ExternalAPI.js → source/js/Core/Media/VMM.ExternalAPI.js

@ -38,8 +38,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
twitter: { twitter: {
tweetArray: [], tweetArray: [],
get: function(mid, id) { get: function(m) {
var tweet = {mid: mid, id: id}; var tweet = {mid: m.id, id: m.uid};
VMM.master_config.twitter.que.push(tweet); VMM.master_config.twitter.que.push(tweet);
VMM.master_config.twitter.active = true; VMM.master_config.twitter.active = true;
//VMM.master_config.api.pushques.push(VMM.ExternalAPI.twitter.pushQue); //VMM.master_config.api.pushques.push(VMM.ExternalAPI.twitter.pushQue);
@ -299,10 +299,14 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
googlemaps: { googlemaps: {
get: function(url, id) { get: function(m) {
var timer, api_key, map_vars; var timer,
api_key,
map_vars,
map_url,
map;
map_vars = VMM.Util.getUrlVars(url); map_vars = VMM.Util.getUrlVars(m.id);
if (VMM.master_config.Timeline.api_keys.google != "") { if (VMM.master_config.Timeline.api_keys.google != "") {
api_key = VMM.master_config.Timeline.api_keys.google; api_key = VMM.master_config.Timeline.api_keys.google;
@ -310,8 +314,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
api_key = Aes.Ctr.decrypt(VMM.master_config.api_keys_master.google, VMM.master_config.vp, 256); api_key = Aes.Ctr.decrypt(VMM.master_config.api_keys_master.google, VMM.master_config.vp, 256);
} }
var map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady"; map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady";
var map = { url: url, vars: map_vars, id: id }; map = { url: m.id, vars: map_vars, id: m.uid };
if (VMM.master_config.googlemaps.active) { if (VMM.master_config.googlemaps.active) {
VMM.master_config.googlemaps.que.push(map); VMM.master_config.googlemaps.que.push(map);
@ -561,9 +565,9 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
googleplus: { googleplus: {
get: function(user, activity) { get: function(m) {
var api_key; var api_key;
var gplus = {user: user, activity: activity}; var gplus = {user: m.user, activity: m.id, id: m.uid};
VMM.master_config.googleplus.que.push(gplus); VMM.master_config.googleplus.que.push(gplus);
VMM.master_config.googleplus.active = true; VMM.master_config.googleplus.active = true;
@ -707,8 +711,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
googledocs: { googledocs: {
get: function(url, id) { get: function(m) {
var doc = {url: url, id: id}; var doc = {url: m.id, id: m.uid};
VMM.master_config.googledocs.que.push(doc); VMM.master_config.googledocs.que.push(doc);
VMM.master_config.googledocs.active = true; VMM.master_config.googledocs.active = true;
}, },
@ -735,8 +739,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
flickr: { flickr: {
get: function(mid, id, link) { get: function(m) {
var flick = {mid: mid, id: id, link:link}; var flick = {mid: m.id, id: m.uid, link: m.link};
VMM.master_config.flickr.que.push(flick); VMM.master_config.flickr.que.push(flick);
VMM.master_config.flickr.active = true; VMM.master_config.flickr.active = true;
}, },
@ -848,8 +852,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
soundcloud: { soundcloud: {
get: function(mid, id) { get: function(m) {
var sound = {mid: mid, id: id}; var sound = {mid: m.id, id: m.uid};
VMM.master_config.soundcloud.que.push(sound); VMM.master_config.soundcloud.que.push(sound);
VMM.master_config.soundcloud.active = true; VMM.master_config.soundcloud.active = true;
}, },
@ -873,8 +877,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
wikipedia: { wikipedia: {
get: function(url, id, lang) { get: function(m) {
var api_obj = {url: url, id: id, lang: lang}; var api_obj = {url: m.id, id: m.uid, lang: m.lang};
VMM.master_config.wikipedia.que.push(api_obj); VMM.master_config.wikipedia.que.push(api_obj);
VMM.master_config.wikipedia.active = true; VMM.master_config.wikipedia.active = true;
}, },
@ -967,9 +971,9 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
youtube: { youtube: {
get: function(mid, id, start) { get: function(m) {
var the_url = "http://gdata.youtube.com/feeds/api/videos/" + mid + "?v=2&alt=jsonc&callback=?", var the_url = "http://gdata.youtube.com/feeds/api/videos/" + m.id + "?v=2&alt=jsonc&callback=?",
vid = {mid: mid, id: id, start: start}; vid = {mid: m.id, id: m.uid, start: m.start, hd: m.hd};
VMM.master_config.youtube.que.push(vid); VMM.master_config.youtube.que.push(vid);
@ -996,7 +1000,6 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
vid_start_seconds = 0; vid_start_seconds = 0;
if (vidstart.match('m')) { if (vidstart.match('m')) {
vidstart = vidstart.split("=")[1];
vid_start_minutes = parseInt(vidstart.split("m")[0], 10); vid_start_minutes = parseInt(vidstart.split("m")[0], 10);
vid_start_seconds = parseInt(vidstart.split("m")[1].split("s")[0], 10); vid_start_seconds = parseInt(vidstart.split("m")[1].split("s")[0], 10);
vid.start = (vid_start_minutes * 60) + vid_start_seconds; vid.start = (vid_start_minutes * 60) + vid_start_seconds;
@ -1011,9 +1014,14 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
active: false, active: false,
player: {}, player: {},
name: vid.id, name: vid.id,
playing: false playing: false,
hd: false
}; };
if (typeof(vid.hd) != 'undefined') {
p.hd = true;
}
p.player[vid.id] = new YT.Player(vid.id, { p.player[vid.id] = new YT.Player(vid.id, {
height: '390', height: '390',
width: '640', width: '640',
@ -1073,6 +1081,12 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
if (VMM.master_config.youtube.array[i].player[the_name] == e.target) { if (VMM.master_config.youtube.array[i].player[the_name] == e.target) {
if (e.data == YT.PlayerState.PLAYING) { if (e.data == YT.PlayerState.PLAYING) {
VMM.master_config.youtube.array[i].playing = true; VMM.master_config.youtube.array[i].playing = true;
trace(VMM.master_config.youtube.array[i].hd)
if (VMM.master_config.youtube.array[i].hd) {
// SET TO HD
// DOESN'T WORK AS OF NOW
//VMM.master_config.youtube.array[i].player.setPlaybackQuality("hd720");
}
} }
} }
} }
@ -1087,8 +1101,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
vimeo: { vimeo: {
get: function(mid, id) { get: function(m) {
var vid = {mid: mid, id: id}; var vid = {mid: m.id, id: m.uid};
VMM.master_config.vimeo.que.push(vid); VMM.master_config.vimeo.que.push(vid);
VMM.master_config.vimeo.active = true; VMM.master_config.vimeo.active = true;
}, },

0
source/js/Media/VMM.Media.js → source/js/Core/Media/VMM.Media.js

31
source/js/Media/VMM.MediaElement.js → source/js/Core/Media/VMM.MediaElement.js

@ -102,6 +102,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
var mediaElem = "", captionElem = "", creditElem = "", _id = "", isTextMedia = false, m; var mediaElem = "", captionElem = "", creditElem = "", _id = "", isTextMedia = false, m;
m = VMM.MediaType(data.media); //returns an object with .type and .id m = VMM.MediaType(data.media); //returns an object with .type and .id
m.uid = uid;
_valid = true; _valid = true;
// CREDIT // CREDIT
@ -119,54 +120,54 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
} else if (m.type == "flickr") { } else if (m.type == "flickr") {
//mediaElem = "<div class='media-image media-shadow' id='" + uid + "'>" + loading_messege + "</div>"; //mediaElem = "<div class='media-image media-shadow' id='" + uid + "'>" + loading_messege + "</div>";
mediaElem = "<div class='media-image media-shadow'><a href='" + m.link + "' target='_blank'><img id='" + uid + "'></a></div>"; mediaElem = "<div class='media-image media-shadow'><a href='" + m.link + "' target='_blank'><img id='" + uid + "'></a></div>";
VMM.ExternalAPI.flickr.get(m.id, uid, m.link); VMM.ExternalAPI.flickr.get(m);
// INSTAGRAM // INSTAGRAM
} else if (m.type == "instagram") { } else if (m.type == "instagram") {
mediaElem = "<div class='media-image media-shadow'><a href='" + m.link + "' target='_blank'><img src='" + VMM.ExternalAPI.instagram.get(m.id) + "'></a></div>"; mediaElem = "<div class='media-image media-shadow'><a href='" + m.link + "' target='_blank'><img src='" + VMM.ExternalAPI.instagram.get(m.id) + "'></a></div>";
//VMM.ExternalAPI.instagram.get(m.id, uid); //VMM.ExternalAPI.instagram.get(m.id, uid);
// GOOGLE DOCS // GOOGLE DOCS
} else if (m.type == "googledoc") { } else if (m.type == "googledoc") {
mediaElem = "<div class='media-frame media-shadow doc' id='" + uid + "'>" + loading_messege + "</div>"; mediaElem = "<div class='media-frame media-shadow doc' id='" + m.uid + "'>" + loading_messege + "</div>";
VMM.ExternalAPI.googledocs.get(m.id, uid); VMM.ExternalAPI.googledocs.get(m);
// YOUTUBE // YOUTUBE
} else if (m.type == "youtube") { } else if (m.type == "youtube") {
mediaElem = "<div class='media-shadow'><div class='media-frame video youtube' id='" + uid + "'>" + loading_messege + "</div></div>"; mediaElem = "<div class='media-shadow'><div class='media-frame video youtube' id='" + m.uid + "'>" + loading_messege + "</div></div>";
VMM.ExternalAPI.youtube.get(m.id, uid, m.start); VMM.ExternalAPI.youtube.get(m);
// VIMEO // VIMEO
} else if (m.type == "vimeo") { } else if (m.type == "vimeo") {
mediaElem = "<div class='media-shadow'><iframe class='media-frame video vimeo' autostart='false' frameborder='0' width='100%' height='100%' src='http://player.vimeo.com/video/" + m.id + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'></iframe></div>"; mediaElem = "<div class='media-shadow'><iframe class='media-frame video vimeo' autostart='false' frameborder='0' width='100%' height='100%' src='http://player.vimeo.com/video/" + m.id + "?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff'></iframe></div>";
VMM.ExternalAPI.vimeo.get(m.id, uid); VMM.ExternalAPI.vimeo.get(m);
// DAILYMOTION // DAILYMOTION
} else if (m.type == "dailymotion") { } else if (m.type == "dailymotion") {
mediaElem = "<div class='media-shadow'><iframe class='media-frame video dailymotion' autostart='false' frameborder='0' width='100%' height='100%' src='http://www.dailymotion.com/embed/video/" + m.id + "'></iframe></div>"; mediaElem = "<div class='media-shadow'><iframe class='media-frame video dailymotion' autostart='false' frameborder='0' width='100%' height='100%' src='http://www.dailymotion.com/embed/video/" + m.id + "'></iframe></div>";
// TWITTER // TWITTER
} else if (m.type == "twitter"){ } else if (m.type == "twitter"){
mediaElem = "<div class='twitter' id='" + uid + "'>" + loading_messege + "</div>"; mediaElem = "<div class='twitter' id='" + m.uid + "'>" + loading_messege + "</div>";
isTextMedia = true; isTextMedia = true;
VMM.ExternalAPI.twitter.get(m.id, uid); VMM.ExternalAPI.twitter.get(m);
// TWITTER // TWITTER
} else if (m.type == "twitter-ready") { } else if (m.type == "twitter-ready") {
isTextMedia = true; isTextMedia = true;
mediaElem = m.id; mediaElem = m.id;
// SOUNDCLOUD // SOUNDCLOUD
} else if (m.type == "soundcloud") { } else if (m.type == "soundcloud") {
mediaElem = "<div class='media-frame media-shadow soundcloud' id='" + uid + "'>" + loading_messege + "</div>"; mediaElem = "<div class='media-frame media-shadow soundcloud' id='" + m.uid + "'>" + loading_messege + "</div>";
VMM.ExternalAPI.soundcloud.get(m.id, uid); VMM.ExternalAPI.soundcloud.get(m);
// GOOGLE MAPS // GOOGLE MAPS
} else if (m.type == "google-map") { } else if (m.type == "google-map") {
mediaElem = "<div class='media-frame media-shadow map' id='" + uid + "'>" + loading_messege + "</div>"; mediaElem = "<div class='media-frame media-shadow map' id='" + m.uid + "'>" + loading_messege + "</div>";
VMM.ExternalAPI.googlemaps.get(m.id, uid); VMM.ExternalAPI.googlemaps.get(m);
// GOOGLE PLUS // GOOGLE PLUS
} else if (m.type == "googleplus") { } else if (m.type == "googleplus") {
_id = "googleplus_" + m.id; _id = "googleplus_" + m.id;
mediaElem = "<div class='googleplus' id='" + _id + "'>" + loading_messege + "</div>"; mediaElem = "<div class='googleplus' id='" + _id + "'>" + loading_messege + "</div>";
isTextMedia = true; isTextMedia = true;
VMM.ExternalAPI.googleplus.get(m.user, m.id, uid); VMM.ExternalAPI.googleplus.get(m);
// WIKIPEDIA // WIKIPEDIA
} else if (m.type == "wikipedia") { } else if (m.type == "wikipedia") {
mediaElem = "<div class='wikipedia' id='" + uid + "'>" + loading_messege + "</div>"; mediaElem = "<div class='wikipedia' id='" + m.uid + "'>" + loading_messege + "</div>";
isTextMedia = true; isTextMedia = true;
VMM.ExternalAPI.wikipedia.get(m.id, uid, m.lang); VMM.ExternalAPI.wikipedia.get(m);
// STORIFY // STORIFY
} else if (m.type == "storify") { } else if (m.type == "storify") {
isTextMedia = true; isTextMedia = true;

12
source/js/Media/VMM.MediaType.js → source/js/Core/Media/VMM.MediaType.js

@ -12,6 +12,7 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
type: "unknown", type: "unknown",
id: "", id: "",
start: 0, start: 0,
hd: false,
link: "", link: "",
lang: "", lang: "",
uniqueid: VMM.Util.unique_ID(6) uniqueid: VMM.Util.unique_ID(6)
@ -23,15 +24,14 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
success = true; success = true;
} else if (d.match('(www.)?youtube|youtu\.be')) { } else if (d.match('(www.)?youtube|youtu\.be')) {
if (d.match('v=')) { if (d.match('v=')) {
media.id = VMM.Util.getUrlVars(d)["v"]; media.id = VMM.Util.getUrlVars(d)["v"];
media.start = VMM.Util.getUrlVars(d)["t"];
} else if (d.match('\/embed\/')) { } else if (d.match('\/embed\/')) {
media.id = d.split("embed\/")[1].split(/[?&]/)[0]; media.id = d.split("embed\/")[1].split(/[?&]/)[0];
media.start = d.split("embed\/")[1].split(/[?&]/)[1];
} else { } else {
media.id = d.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0]; media.id = d.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0];
media.start = d.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[1];
} }
media.start = VMM.Util.getUrlVars(d)["t"];
media.hd = VMM.Util.getUrlVars(d)["hd"];
media.type = "youtube"; media.type = "youtube";
success = true; success = true;
} else if (d.match('(player.)?vimeo\.com')) { } else if (d.match('(player.)?vimeo\.com')) {

0
source/js/Media/VMM.TextElement.js → source/js/Core/Media/VMM.TextElement.js

0
source/js/Slider/VMM.DragSlider.js → source/js/Core/Slider/VMM.DragSlider.js

0
source/js/Slider/VMM.Slider.Slide.js → source/js/Core/Slider/VMM.Slider.Slide.js

169
source/js/Slider/VMM.Slider.js → source/js/Core/Slider/VMM.Slider.js

@ -4,46 +4,64 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Slider = function(parent, parent_config) { VMM.Slider = function(parent, parent_config) {
var events = {}, config; var config,
var $slider, $slider_mask, $slider_container, $slides_items; timer,
var data = [], slides = [], slide_positions = []; $slider,
$slider_mask,
var slides_content = ""; $slider_container,
var current_slide = 0; $slides_items,
var current_width = 960; events = {},
var touch = {move: false, x: 10, y:0, off: 0, dampen: 48}; data = [],
var content = ""; slides = [],
var _active = false; slide_positions = [],
var layout = parent; slides_content = "",
var navigation = {nextBtn:"", prevBtn:"", nextDate:"", prevDate:"", nextTitle:"", prevTitle:""}; current_slide = 0,
var timer; current_width = 960,
touch = {
move: false,
x: 10,
y: 0,
off: 0,
dampen: 48
},
content = "",
_active = false,
layout = parent,
navigation = {
nextBtn: "",
prevBtn: "",
nextDate: "",
prevDate: "",
nextTitle: "",
prevTitle: ""
};
// CONFIG // CONFIG
if(typeof VMM.Timeline != 'undefined') { if(typeof parent_config != 'undefined') {
config = VMM.Timeline.Config; config = parent_config;
} else { } else {
config = { config = {
preload: 4, preload: 4,
current_slide: 0, current_slide: 0,
interval: 10, interval: 10,
something: 0, something: 0,
width: 720, width: 720,
height: 400, height: 400,
ease: "easeInOutExpo", ease: "easeInOutExpo",
duration: 1000, duration: 1000,
timeline: false, timeline: false,
spacing: 15, spacing: 15,
slider: { slider: {
width: 720, width: 720,
height: 400, height: 400,
content: { content: {
width: 720, width: 720,
height: 400, height: 400,
padding: 130 padding: 130
}, },
nav: { nav: {
width: 100, width: 100,
height: 200 height: 200
} }
} }
}; };
@ -53,14 +71,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
================================================== */ ================================================== */
this.ver = "0.6"; this.ver = "0.6";
config.slider.width = config.width; config.slider.width = config.width;
config.slider.height = config.height; config.slider.height = config.height;
/* PUBLIC FUNCTIONS /* PUBLIC FUNCTIONS
================================================== */ ================================================== */
this.init = function(d) { this.init = function(d) {
slides = []; slides = [];
slide_positions = []; slide_positions = [];
if(typeof d != 'undefined') { if(typeof d != 'undefined') {
this.setData(d); this.setData(d);
@ -142,9 +160,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
}; };
function reSize(go_to_slide, from_start) { function reSize(go_to_slide, from_start) {
var _go_to_slide = true,
var _go_to_slide = true; _from_start = false;
var _from_start = false;
if (go_to_slide != null) {_go_to_slide = go_to_slide}; if (go_to_slide != null) {_go_to_slide = go_to_slide};
if (from_start != null) {_from_start = from_start}; if (from_start != null) {_from_start = from_start};
@ -158,8 +175,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Lib.width($slides_items, (slides.length * config.slider.content.width)); VMM.Lib.width($slides_items, (slides.length * config.slider.content.width));
if (_from_start) { if (_from_start) {
var _pos = slides[current_slide].leftpos(); VMM.Lib.css($slider_container, "left", slides[current_slide].leftpos());
VMM.Lib.css($slider_container, "left", _pos);
} }
// RESIZE SLIDES // RESIZE SLIDES
@ -265,10 +281,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/* BUILD SLIDES /* BUILD SLIDES
================================================== */ ================================================== */
var buildSlides = function(d) { var buildSlides = function(d) {
var i = 0;
VMM.attachElement($slides_items, ""); VMM.attachElement($slides_items, "");
slides = []; slides = [];
for(var i = 0; i < d.length; i++) { for(i = 0; i < d.length; i++) {
var _slide = new VMM.Slider.Slide(d[i], $slides_items); var _slide = new VMM.Slider.Slide(d[i], $slides_items);
//_slide.show(); //_slide.show();
slides.push(_slide); slides.push(_slide);
@ -276,11 +294,13 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
} }
var preloadSlides = function(skip) { var preloadSlides = function(skip) {
var i = 0;
if (skip) { if (skip) {
preloadTimeOutSlides(); preloadTimeOutSlides();
} else { } else {
for(var k = 0; k < slides.length; k++) { for(i = 0; i < slides.length; i++) {
slides[k].clearTimers(); slides[i].clearTimers();
} }
timer = setTimeout(preloadTimeOutSlides, config.duration); timer = setTimeout(preloadTimeOutSlides, config.duration);
@ -288,23 +308,25 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
} }
var preloadTimeOutSlides = function() { var preloadTimeOutSlides = function() {
for(var k = 0; k < slides.length; k++) { var i = 0;
slides[k].enqueue = true;
for(i = 0; i < slides.length; i++) {
slides[i].enqueue = true;
} }
for(var j = 0; j < config.preload; j++) { for(i = 0; i < config.preload; i++) {
if ( !((current_slide + j) > slides.length - 1)) { if ( !((current_slide + i) > slides.length - 1)) {
slides[current_slide + j].show(); slides[current_slide + i].show();
slides[current_slide + j].enqueue = false; slides[current_slide + i].enqueue = false;
} }
if ( !( (current_slide - j) < 0 ) ) { if ( !( (current_slide - i) < 0 ) ) {
slides[current_slide - j].show(); slides[current_slide - i].show();
slides[current_slide - j].enqueue = false; slides[current_slide - i].enqueue = false;
} }
} }
if (slides.length > 50) { if (slides.length > 50) {
for(var i = 0; i < slides.length; i++) { for(i = 0; i < slides.length; i++) {
if (slides[i].enqueue) { if (slides[i].enqueue) {
slides[i].hide(); slides[i].hide();
} }
@ -320,7 +342,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/* SIZE SLIDES /* SIZE SLIDES
================================================== */ ================================================== */
var sizeSlides = function() { var sizeSlides = function() {
var layout_text_media = ".slider-item .layout-text-media .media .media-container ", var i = 0,
layout_text_media = ".slider-item .layout-text-media .media .media-container ",
layout_media = ".slider-item .layout-media .media .media-container ", layout_media = ".slider-item .layout-media .media .media-container ",
layout_both = ".slider-item .media .media-container", layout_both = ".slider-item .media .media-container",
layout_caption = ".slider-item .media .media-container .media-shadow .caption", layout_caption = ".slider-item .media .media-container .media-shadow .caption",
@ -470,7 +493,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Lib.css( layout_media + ".caption", "max-width", mediasize.media.video.width); VMM.Lib.css( layout_media + ".caption", "max-width", mediasize.media.video.width);
// MAINTAINS VERTICAL CENTER IF IT CAN // MAINTAINS VERTICAL CENTER IF IT CAN
for(var i = 0; i < slides.length; i++) { for(i = 0; i < slides.length; i++) {
slides[i].layout(is_skinny); slides[i].layout(is_skinny);
@ -486,8 +509,10 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/* POSITION SLIDES /* POSITION SLIDES
================================================== */ ================================================== */
var positionSlides = function() { var positionSlides = function() {
var pos = 0; var pos = 0,
for(var i = 0; i < slides.length; i++) { i = 0;
for(i = 0; i < slides.length; i++) {
pos = i * (config.slider.width+config.spacing); pos = i * (config.slider.width+config.spacing);
slides[i].leftpos(pos); slides[i].leftpos(pos);
} }
@ -496,8 +521,10 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/* OPACITY SLIDES /* OPACITY SLIDES
================================================== */ ================================================== */
var opacitySlides = function(n) { var opacitySlides = function(n) {
var _ease = "linear"; var _ease = "linear",
for(var i = 0; i < slides.length; i++) { i = 0;
for(i = 0; i < slides.length; i++) {
if (i == current_slide) { if (i == current_slide) {
slides[i].animate(config.duration, _ease, {"opacity": 1}); slides[i].animate(config.duration, _ease, {"opacity": 1});
} else if (i == current_slide - 1 || i == current_slide + 1) { } else if (i == current_slide - 1 || i == current_slide + 1) {
@ -512,20 +539,21 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
goToSlide(n, ease, duration); goToSlide(n, ease, duration);
================================================== */ ================================================== */
var goToSlide = function(n, ease, duration, fast, firstrun) { var goToSlide = function(n, ease, duration, fast, firstrun) {
var _ease = config.ease,
_duration = config.duration,
is_last = false,
is_first = false,
_title = "",
_pos;
/* STOP ANY VIDEO PLAYERS ACTIVE /* STOP ANY VIDEO PLAYERS ACTIVE
================================================== */ ================================================== */
VMM.ExternalAPI.youtube.stopPlayers(); VMM.ExternalAPI.youtube.stopPlayers();
// Set current slide // Set current slide
current_slide = n; current_slide = n;
_pos = slides[current_slide].leftpos();
var _ease = config.ease;
var _duration = config.duration;
var is_last = false;
var is_first = false;
var _pos = slides[current_slide].leftpos();
var _title = "";
if (current_slide == 0) {is_first = true}; if (current_slide == 0) {is_first = true};
if (current_slide +1 >= slides.length) {is_last = true}; if (current_slide +1 >= slides.length) {is_last = true};
@ -629,7 +657,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/* BUILD /* BUILD
================================================== */ ================================================== */
var build = function() { var build = function() {
var __duration = 3000;
// Clear out existing content // Clear out existing content
VMM.attachElement(layout, ""); VMM.attachElement(layout, "");
@ -647,9 +675,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
/* MAKE SLIDER TOUCHABLE /* MAKE SLIDER TOUCHABLE
================================================== */ ================================================== */
var __duration = 3000;
if (VMM.Browser.device == "tablet" || VMM.Browser.device == "mobile") { if (VMM.Browser.device == "tablet" || VMM.Browser.device == "mobile") {
config.duration = 500; config.duration = 500;
__duration = 1000; __duration = 1000;

8
source/js/Embed/Embed.js

@ -7,7 +7,7 @@
/* CodeKit Import /* CodeKit Import
http://incident57.com/codekit/ http://incident57.com/codekit/
================================================== */ ================================================== */
// @codekit-prepend "../lib/Embed.LoadLib.js"; // @codekit-prepend "../Core/Library/Embed.LoadLib.js";
var WebFontConfig; var WebFontConfig;
@ -38,7 +38,7 @@ function getScriptPath(scriptname) {
/* VARS /* VARS
================================================== */ ================================================== */
var embedjs, t, te, x, isCDN = false, var embedjs, t, te, x, isCDN = false,
js_version = "1.68", js_version = "1.69",
jquery_version_required = "1.7.1", jquery_version_required = "1.7.1",
jquery_version = "", jquery_version = "",
ready = { ready = {
@ -292,8 +292,8 @@ function getScriptPath(scriptname) {
function buildEmbed() { function buildEmbed() {
VMM.debug = embed_config.debug; VMM.debug = embed_config.debug;
embedjs = new VMM.Timeline(); embedjs = new VMM.Timeline('timelinejs');
embedjs.init(embed_config.source); embedjs.init(embed_config);
if (isCDN) { if (isCDN) {
VMM.bindEvent(global, onHeadline, "HEADLINE"); VMM.bindEvent(global, onHeadline, "HEADLINE");
} }

2
source/js/VMM.Timeline.DataObj.js

@ -215,7 +215,7 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
if (typeof dd.gsx$tag != 'undefined') { if (typeof dd.gsx$tag != 'undefined') {
_date.tag = dd.gsx$tag.$t; _date.tag = dd.gsx$tag.$t;
} }
if (typeof dd.gsx$tag != 'undefined') { if (typeof dd.gsx$mediathumbnail != 'undefined') {
_date.asset.thumbnail = dd.gsx$mediathumbnail.$t; _date.asset.thumbnail = dd.gsx$mediathumbnail.$t;
} }

2
source/js/VMM.Timeline.License.js

@ -1,6 +1,6 @@
/*! /*!
TimelineJS TimelineJS
Version 1.65 Version 1.71
Designed and built by Zach Wise at VéritéCo Designed and built by Zach Wise at VéritéCo
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify

435
source/js/VMM.Timeline.TimeNav.js

@ -8,7 +8,11 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.Timeline.TimeNav = function(parent, content_width, content_height) { VMM.Timeline.TimeNav = function(parent, content_width, content_height) {
trace("VMM.Timeline.TimeNav"); trace("VMM.Timeline.TimeNav");
var events = {}, var $timenav, $content, $time, $timeintervalminor, $timeinterval, $timeintervalmajor, $timebackground,
$timeintervalbackground, $timenavline, $timenavindicator, $timeintervalminor_minor, $toolbar, $zoomin, $zoomout, $dragslide,
config = VMM.Timeline.Config,
row_height,
events = {},
timespan = {}, timespan = {},
layout = parent, layout = parent,
data = [], data = [],
@ -31,25 +35,92 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
right: "" right: ""
} }
}, },
$timenav, $content, $time, $timeintervalminor, $timeinterval, $timeintervalmajor, $timebackground, timelookup = {
$timeintervalbackground, $timenavline, $timenavindicator, $timeintervalminor_minor, $toolbar, $zoomin, $zoomout, $dragslide; day: 24,
month: 12,
year: 10,
hour: 60,
var timelookup = {day: 24, month: 12, year: 10, hour: 60, minute: 60, second: 1000, decade: 10, century: 100, millenium: 1000, age: 1000000, epoch: 10000000, era: 100000000, eon: 500000000, week: 4.34812141, days_in_month: 30.4368499, days_in_week: 7, weeks_in_month:4.34812141, weeks_in_year:52.177457, days_in_year: 365.242199, hours_in_day: 24 }; minute: 60,
var dateFractionBrowser = {day: 86400000, week: 7, month: 30.4166666667, year: 12, hour: 24, minute: 1440, second: 86400, decade: 10, century: 100, millenium: 1000, age: 1000000, epoch: 10000000, era: 100000000, eon: 500000000 }; second: 1000,
decade: 10,
var interval = {type: "year", number: 10, first: 1970, last: 2011, multiplier: 100, classname:"_idd", interval_type:"interval"}; century: 100,
var interval_major = {type: "year", number: 10, first: 1970, last: 2011, multiplier: 100, classname:"major", interval_type:"interval major"}; millenium: 1000,
var interval_macro = {type: "year", number: 10, first: 1970, last: 2011, multiplier: 100, classname:"_dd_minor", interval_type:"interval minor"}; age: 1000000,
var interval_calc = {day: {},month: {},year: {},hour: {},minute: {}, second: {},decade: {},century: {},millenium: {},week: {}, age: {}, epoch: {}, era: {}, eon: {} }; epoch: 10000000,
era: 100000000,
eon: 500000000,
week: 4.34812141,
days_in_month: 30.4368499,
days_in_week: 7,
weeks_in_month: 4.34812141,
weeks_in_year: 52.177457,
days_in_year: 365.242199,
hours_in_day: 24
},
dateFractionBrowser = {
day: 86400000,
week: 7,
month: 30.4166666667,
year: 12,
hour: 24,
minute: 1440,
second: 86400,
decade: 10,
century: 100,
millenium: 1000,
age: 1000000,
epoch: 10000000,
era: 100000000,
eon: 500000000
},
interval = {
type: "year",
number: 10,
first: 1970,
last: 2011,
multiplier: 100,
classname: "_idd",
interval_type: "interval"
},
interval_major = {
type: "year",
number: 10,
first: 1970,
last: 2011,
multiplier: 100,
classname: "major",
interval_type: "interval major"
},
interval_macro = {
type: "year",
number: 10,
first: 1970,
last: 2011,
multiplier: 100,
classname: "_dd_minor",
interval_type: "interval minor"
},
interval_calc = {
day: {},
month: {},
year: {},
hour: {},
minute: {},
second: {},
decade: {},
century: {},
millenium: {},
week: {},
age: {},
epoch: {},
era: {},
eon: {}
};
/* ADD to Config /* ADD to Config
================================================== */ ================================================== */
var config = VMM.Timeline.Config; row_height = config.nav.marker.height/2;
var row_height = config.nav.marker.height/2;
//config.nav.rows = [1, config.nav.marker.height, config.nav.marker.height*2];
config.nav.rows = { config.nav.rows = {
full: [1, row_height*2, row_height*4], full: [1, row_height*2, row_height*4],
half: [1, row_height, row_height*2, row_height*3, row_height*4, row_height*5], half: [1, row_height, row_height*2, row_height*3, row_height*4, row_height*5],
@ -63,15 +134,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
config.nav.height = content_height; config.nav.height = content_height;
} }
/*
config.nav.density = 2;
config.nav.multiplier = {
current: 6,
min: .1,
max: 50
};
*/
/* INIT /* INIT
================================================== */ ================================================== */
this.init = function(d,e) { this.init = function(d,e) {
@ -306,9 +368,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var last_pos = 0, var last_pos = 0,
pos = 0, pos = 0,
pos_dif = 0, pos_dif = 0,
mp_diff = []; mp_diff = [],
i = 0;
for(var i = 0; i < markers.length; i++) { for(i = 0; i < markers.length; i++) {
if (data[i].type == "start") { if (data[i].type == "start") {
} else { } else {
@ -323,30 +386,34 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
var averageDateDistance = function() { var averageDateDistance = function() {
var last_dd = 0; var last_dd = 0,
var dd = 0; dd = 0,
var date_dif = 0; _dd = "",
var date_diffs = []; date_dif = 0,
var is_first_date = true; date_diffs = [],
is_first_date = true,
for(var i = 0; i < data.length; i++) { i = 0;
for(i = 0; i < data.length; i++) {
if (data[i].type == "start") { if (data[i].type == "start") {
trace("DATA DATE IS START") trace("DATA DATE IS START")
} else { } else {
var _dd = data[i].startdate; _dd = data[i].startdate;
last_dd = dd; last_dd = dd;
dd = _dd; dd = _dd;
date_dif = dd - last_dd; date_dif = dd - last_dd;
date_diffs.push(date_dif); date_diffs.push(date_dif);
} }
} }
return VMM.Util.average(date_diffs); return VMM.Util.average(date_diffs);
} }
var calculateMultiplier = function() { var calculateMultiplier = function() {
var temp_multiplier = config.nav.multiplier.current; var temp_multiplier = config.nav.multiplier.current,
for(var i = 0; i < temp_multiplier; i++) { i = 0;
for(i = 0; i < temp_multiplier; i++) {
if (averageMarkerPositionDistance() < 75) { if (averageMarkerPositionDistance() < 75) {
if (config.nav.multiplier.current > 1) { if (config.nav.multiplier.current > 1) {
config.nav.multiplier.current = (config.nav.multiplier.current - 1); config.nav.multiplier.current = (config.nav.multiplier.current - 1);
@ -358,8 +425,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var calculateInterval = function() { var calculateInterval = function() {
// NEED TO REWRITE ALL OF THIS // NEED TO REWRITE ALL OF THIS
var _first = getDateFractions(data[0].startdate); var _first = getDateFractions(data[0].startdate),
var _last = getDateFractions(data[data.length - 1].enddate); _last = getDateFractions(data[data.length - 1].enddate);
// EON // EON
interval_calc.eon.type = "eon"; interval_calc.eon.type = "eon";
@ -531,80 +598,84 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var positionRelative = function(_interval, first, last) { var positionRelative = function(_interval, first, last) {
var _first, var _first,
_last, _last,
_type = _interval.type, _type = _interval.type,
timerelative = {start: "", end: "", type: _type}; timerelative = {
start: "",
end: "",
type: _type
};
/* FIRST /* FIRST
================================================== */ ================================================== */
_first = getDateFractions(first); _first = getDateFractions(first);
timerelative.start = first.months; timerelative.start = first.months;
if (_type == "eon") { if (_type == "eon") {
timerelative.start = _first.eons; timerelative.start = _first.eons;
} else if (_type == "era") { } else if (_type == "era") {
timerelative.start = _first.eras; timerelative.start = _first.eras;
} else if (_type == "epoch") { } else if (_type == "epoch") {
timerelative.start = _first.epochs; timerelative.start = _first.epochs;
} else if (_type == "age") { } else if (_type == "age") {
timerelative.start = _first.ages; timerelative.start = _first.ages;
} else if (_type == "millenium") { } else if (_type == "millenium") {
timerelative.start = first.milleniums; timerelative.start = first.milleniums;
} else if (_type == "century") { } else if (_type == "century") {
timerelative.start = _first.centuries; timerelative.start = _first.centuries;
} else if (_type == "decade") { } else if (_type == "decade") {
timerelative.start = _first.decades; timerelative.start = _first.decades;
} else if (_type == "year") { } else if (_type == "year") {
timerelative.start = _first.years; timerelative.start = _first.years;
} else if (_type == "month") { } else if (_type == "month") {
timerelative.start = _first.months; timerelative.start = _first.months;
} else if (_type == "week") { } else if (_type == "week") {
timerelative.start = _first.weeks; timerelative.start = _first.weeks;
} else if (_type == "day") { } else if (_type == "day") {
timerelative.start = _first.days; timerelative.start = _first.days;
} else if (_type == "hour") { } else if (_type == "hour") {
timerelative.start = _first.hours; timerelative.start = _first.hours;
} else if (_type == "minute") { } else if (_type == "minute") {
timerelative.start = _first.minutes; timerelative.start = _first.minutes;
} }
/* LAST /* LAST
================================================== */ ================================================== */
if (type.of(last) == "date") { if (type.of(last) == "date") {
_last = getDateFractions(last); _last = getDateFractions(last);
timerelative.end = last.months; timerelative.end = last.months;
if (_type == "eon") { if (_type == "eon") {
timerelative.end = _last.eons; timerelative.end = _last.eons;
} else if (_type == "era") { } else if (_type == "era") {
timerelative.end = _last.eras; timerelative.end = _last.eras;
} else if (_type == "epoch") { } else if (_type == "epoch") {
timerelative.end = _last.epochs; timerelative.end = _last.epochs;
} else if (_type == "age") { } else if (_type == "age") {
timerelative.end = _last.ages; timerelative.end = _last.ages;
} else if (_type == "millenium") { } else if (_type == "millenium") {
timerelative.end = last.milleniums; timerelative.end = last.milleniums;
} else if (_type == "century") { } else if (_type == "century") {
timerelative.end = _last.centuries; timerelative.end = _last.centuries;
} else if (_type == "decade") { } else if (_type == "decade") {
timerelative.end = _last.decades; timerelative.end = _last.decades;
} else if (_type == "year") { } else if (_type == "year") {
timerelative.end = _last.years; timerelative.end = _last.years;
} else if (_type == "month") { } else if (_type == "month") {
timerelative.end = _last.months; timerelative.end = _last.months;
} else if (_type == "week") { } else if (_type == "week") {
timerelative.end = _last.weeks; timerelative.end = _last.weeks;
} else if (_type == "day") { } else if (_type == "day") {
timerelative.end = _last.days; timerelative.end = _last.days;
} else if (_type == "hour") { } else if (_type == "hour") {
timerelative.end = _last.hours; timerelative.end = _last.hours;
} else if (_type == "minute") { } else if (_type == "minute") {
timerelative.end = _last.minutes; timerelative.end = _last.minutes;
} }
} else { } else {
timerelative.end = timerelative.start; timerelative.end = timerelative.start;
} }
@ -632,9 +703,11 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
pos_cache_array = [], pos_cache_array = [],
pos_cache_max = 6, pos_cache_max = 6,
in_view = { in_view = {
left: timenav_pos.visible.left - in_view_margin, left: timenav_pos.visible.left - in_view_margin,
right: timenav_pos.visible.right + in_view_margin right: timenav_pos.visible.right + in_view_margin
}; },
i = 0,
k = 0;
config.nav.minor_width = config.width; config.nav.minor_width = config.width;
@ -642,7 +715,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.Lib.removeClass(".flag", "row2"); VMM.Lib.removeClass(".flag", "row2");
VMM.Lib.removeClass(".flag", "row3"); VMM.Lib.removeClass(".flag", "row3");
for(var i = 0; i < markers.length; i++) { for(i = 0; i < markers.length; i++) {
var line, var line,
marker = markers[i], marker = markers[i],
@ -697,7 +770,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// CONTROL ROW POSITION // CONTROL ROW POSITION
if (tags.length > 0) { if (tags.length > 0) {
for (var k = 0; k < tags.length; k++) { for (k = 0; k < tags.length; k++) {
if (k < config.nav.rows.current.length) { if (k < config.nav.rows.current.length) {
if (marker.tag == tags[k]) { if (marker.tag == tags[k]) {
row = k; row = k;
@ -710,63 +783,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
row_pos = config.nav.rows.current[row]; row_pos = config.nav.rows.current[row];
} else { } else {
/*
pos_cache_close = 0;
for (var l = 0; l < pos_cache_array.length; l++) {
if (pos.begin - pos_cache_array[l].pos.begin < ((config.nav.marker.width/2))) {
pos_cache_close++;
trace("POS CACHE TOO CLOSE");
markers[pos_cache_array[l].id].full = false;
VMM.Lib.addClass(markers[pos_cache_array[l].id].flag, "flag-small");
}
}
if (pos_cache_close > 3) {
trace("POS CACHE TOO CLOSE GRATER THAN 2");
marker.full = false;
VMM.Lib.addClass(marker.flag, "flag-small");
if (row < config.nav.rows.current.length - 1) {
row ++;
} else {
row = 0;
row_depth ++;
}
if (config.nav.rows.current == config.nav.rows.full) {
if (row_depth_sub == 0) {
row_depth_sub = 1;
} else {
row_depth_sub = 0;
}
row_pos = config.nav.rows.half[ (row*2) + row_depth_sub ];
} else {
row_pos = config.nav.rows.half[row];
}
} else {
if (!marker.full) {
VMM.Lib.removeClass(markers[i].flag, "flag-small");
marker.full = true;
}
if (pos.begin - previous_pos.begin < (config.nav.marker.width + config.spacing)) {
if (row < config.nav.rows.full.length - 1) {
row ++;
} else {
row = 0;
row_depth ++;
}
} else {
row_depth = 1;
row = 1;
}
row_pos = config.nav.rows.full[row];
}
*/
if (pos.begin - previous_pos.begin < (config.nav.marker.width + config.spacing)) { if (pos.begin - previous_pos.begin < (config.nav.marker.width + config.spacing)) {
if (row < config.nav.rows.current.length - 1) { if (row < config.nav.rows.current.length - 1) {
@ -781,25 +797,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
row = 1; row = 1;
} }
row_pos = config.nav.rows.current[row]; row_pos = config.nav.rows.current[row];
/*
if (row_depth > 2) {
marker.full = false;
VMM.Lib.addClass(marker.flag, "flag-small");
trace(config.nav.rows.current);
trace(config.nav.rows.full);
if (row_depth_sub == 0) {
row_depth_sub = 1;
} else {
row_depth_sub = 0;
}
if (config.nav.rows.current == config.nav.rows.full) {
trace(config.nav.rows.half[(row*2) + 1]);
trace(config.nav.rows.full[row]);
row_pos = config.nav.rows.half[ (row*2) + row_depth_sub ];
}
}
*/
} }
// SET LAST MARKER POSITION // SET LAST MARKER POSITION
@ -847,7 +845,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
var positionEras = function(is_animated) { var positionEras = function(is_animated) {
for(var i = 0; i < era_markers.length; i++) { var i = 0,
p = 0;
for(i = 0; i < era_markers.length; i++) {
var era = era_markers[i], var era = era_markers[i],
pos = positionOnTimeline(interval, era.relative_pos), pos = positionOnTimeline(interval, era.relative_pos),
row_pos = 0, row_pos = 0,
@ -857,7 +858,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// CONTROL ROW POSITION // CONTROL ROW POSITION
if (era.tag != "") { if (era.tag != "") {
era_height = (config.nav.marker.height * config.nav.rows.full.length) / config.nav.rows.current.length; era_height = (config.nav.marker.height * config.nav.rows.full.length) / config.nav.rows.current.length;
for (var p = 0; p < tags.length; p++) { for (p = 0; p < tags.length; p++) {
if (p < config.nav.rows.current.length) { if (p < config.nav.rows.current.length) {
if (era.tag == tags[p]) { if (era.tag == tags[p]) {
row = p; row = p;
@ -900,7 +901,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
left: timenav_pos.visible.left - in_view_margin, left: timenav_pos.visible.left - in_view_margin,
right: timenav_pos.visible.right + in_view_margin right: timenav_pos.visible.right + in_view_margin
} }
not_too_many = true; not_too_many = true,
i = 0;
config.nav.minor_left = 0; config.nav.minor_left = 0;
@ -910,7 +912,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
for(var i = 0; i < the_intervals.length; i++) { for(i = 0; i < the_intervals.length; i++) {
var _interval = the_intervals[i].element, var _interval = the_intervals[i].element,
_interval_date = the_intervals[i].date, _interval_date = the_intervals[i].date,
_interval_visible = the_intervals[i].visible, _interval_visible = the_intervals[i].visible,
@ -998,18 +1000,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
if (pos > config.nav.minor_width) { if (pos > config.nav.minor_width) {
config.nav.minor_width = pos; config.nav.minor_width = pos;
//config.nav.constraint.right_min = -pos;
//config.nav.constraint.right = config.nav.constraint.right_min + (config.width/2);
} }
if (pos < config.nav.minor_left) { if (pos < config.nav.minor_left) {
config.nav.minor_left = pos; config.nav.minor_left = pos;
//config.nav.constraint.right_min = pos;
//config.nav.constraint.right = config.nav.constraint.right_min + (config.width/2);
} }
} }
@ -1022,25 +1016,12 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
} }
config.nav.constraint.right_min = -(config.nav.minor_width)+(config.width); config.nav.constraint.right_min = -(config.nav.minor_width)+(config.width);
config.nav.constraint.right = config.nav.constraint.right_min + (config.width/2); config.nav.constraint.right = config.nav.constraint.right_min + (config.width/2);
VMM.Lib.css($timeintervalminor_minor, "left", config.nav.minor_left - (config.width)/2); VMM.Lib.css($timeintervalminor_minor, "left", config.nav.minor_left - (config.width)/2);
VMM.Lib.width($timeintervalminor_minor, (config.nav.minor_width)+(config.width) + Math.abs(config.nav.minor_left) ); VMM.Lib.width($timeintervalminor_minor, (config.nav.minor_width)+(config.width) + Math.abs(config.nav.minor_left) );
//trace((config.nav.minor_width/config.nav.multiplier.current)/2)
/*
for(var k = 0; k < the_intervals.length; k++) {
var _animation = the_intervals[k].animation;
if (_animation.animate) {
var _interval = the_intervals[k].interval_element;
VMM.Lib.animate(_interval, config.duration/2, config.ease, {opacity: _animation.opacity, left: _animation.pos}, "interval_que");
}
}
*/
} }
/* Interval Elements /* Interval Elements
@ -1058,14 +1039,15 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
firefox = { firefox = {
flag: false, flag: false,
offset: 0 offset: 0
}; },
i = 0;
VMM.attachElement(_element_parent, ""); VMM.attachElement(_element_parent, "");
_interval.date = new Date(data[0].startdate.getFullYear(), 0, 1, 0,0,0); _interval.date = new Date(data[0].startdate.getFullYear(), 0, 1, 0,0,0);
_timezone_offset = _interval.date.getTimezoneOffset(); _timezone_offset = _interval.date.getTimezoneOffset();
for(var i = 0; i < int_number; i++) { for(i = 0; i < int_number; i++) {
trace(_interval.type); trace(_interval.type);
var _is_year = false, var _is_year = false,
int_obj = { int_obj = {
@ -1251,21 +1233,25 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
/* BUILD /* BUILD
================================================== */ ================================================== */
var build = function() { var build = function() {
var i = 0,
j = 0;
VMM.attachElement(layout, ""); VMM.attachElement(layout, "");
$timenav = VMM.appendAndGetElement(layout, "<div>", "timenav"); $timenav = VMM.appendAndGetElement(layout, "<div>", "timenav");
$content = VMM.appendAndGetElement($timenav, "<div>", "content"); $content = VMM.appendAndGetElement($timenav, "<div>", "content");
$time = VMM.appendAndGetElement($timenav, "<div>", "time"); $time = VMM.appendAndGetElement($timenav, "<div>", "time");
$timeintervalminor = VMM.appendAndGetElement($time, "<div>", "time-interval-minor"); $timeintervalminor = VMM.appendAndGetElement($time, "<div>", "time-interval-minor");
$timeintervalminor_minor = VMM.appendAndGetElement($timeintervalminor, "<div>", "minor"); $timeintervalminor_minor = VMM.appendAndGetElement($timeintervalminor, "<div>", "minor");
$timeintervalmajor = VMM.appendAndGetElement($time, "<div>", "time-interval-major"); $timeintervalmajor = VMM.appendAndGetElement($time, "<div>", "time-interval-major");
$timeinterval = VMM.appendAndGetElement($time, "<div>", "time-interval"); $timeinterval = VMM.appendAndGetElement($time, "<div>", "time-interval");
$timebackground = VMM.appendAndGetElement(layout, "<div>", "timenav-background"); $timebackground = VMM.appendAndGetElement(layout, "<div>", "timenav-background");
$timenavline = VMM.appendAndGetElement($timebackground, "<div>", "timenav-line"); $timenavline = VMM.appendAndGetElement($timebackground, "<div>", "timenav-line");
$timenavindicator = VMM.appendAndGetElement($timebackground, "<div>", "timenav-indicator"); $timenavindicator = VMM.appendAndGetElement($timebackground, "<div>", "timenav-indicator");
$timeintervalbackground = VMM.appendAndGetElement($timebackground, "<div>", "timenav-interval-background", "<div class='top-highlight'></div>"); $timeintervalbackground = VMM.appendAndGetElement($timebackground, "<div>", "timenav-interval-background", "<div class='top-highlight'></div>");
$toolbar = VMM.appendAndGetElement(layout, "<div>", "toolbar"); $toolbar = VMM.appendAndGetElement(layout, "<div>", "toolbar");
$zoomin = VMM.appendAndGetElement($toolbar, "<div>", "zoom-in", "<div class='icon'></div>");
$zoomout = VMM.appendAndGetElement($toolbar, "<div>", "zoom-out", "<div class='icon'></div>");
buildInterval(); buildInterval();
buildMarkers(); buildMarkers();
@ -1287,8 +1273,6 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} }
$zoomin = VMM.appendAndGetElement($toolbar, "<div>", "zoom-in", "<div class='icon'></div>");
$zoomout = VMM.appendAndGetElement($toolbar, "<div>", "zoom-out", "<div class='icon'></div>");
// MAKE TIMELINE DRAGGABLE/TOUCHABLE // MAKE TIMELINE DRAGGABLE/TOUCHABLE
$dragslide = new VMM.DragSlider; $dragslide = new VMM.DragSlider;
@ -1320,11 +1304,11 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// USER CONFIGURABLE ADJUSTMENT TO DEFAULT ZOOM // USER CONFIGURABLE ADJUSTMENT TO DEFAULT ZOOM
if (config.nav.zoom.adjust != 0) { if (config.nav.zoom.adjust != 0) {
if (config.nav.zoom.adjust < 0) { if (config.nav.zoom.adjust < 0) {
for(var i = 0; i < Math.abs(config.nav.zoom.adjust); i++) { for(i = 0; i < Math.abs(config.nav.zoom.adjust); i++) {
onZoomOut(); onZoomOut();
} }
} else { } else {
for(var j = 0; j < config.nav.zoom.adjust; j++) { for(j = 0; j < config.nav.zoom.adjust; j++) {
onZoomIn(); onZoomIn();
} }
} }
@ -1333,7 +1317,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}; };
var buildInterval = function() { var buildInterval = function() {
var i = 0,
j = 0;
// CALCULATE INTERVAL // CALCULATE INTERVAL
timespan = getDateFractions((data[data.length - 1].enddate) - (data[0].startdate), true); timespan = getDateFractions((data[data.length - 1].enddate) - (data[0].startdate), true);
trace(timespan); trace(timespan);
@ -1411,8 +1396,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
createIntervalElements(interval_major, interval_major_array, $timeintervalmajor); createIntervalElements(interval_major, interval_major_array, $timeintervalmajor);
// Cleanup duplicate interval elements between normal and major // Cleanup duplicate interval elements between normal and major
for(var i = 0; i < interval_array.length; i++) { for(i = 0; i < interval_array.length; i++) {
for(var j = 0; j < interval_major_array.length; j++) { for(j = 0; j < interval_major_array.length; j++) {
if (interval_array[i].date_string == interval_major_array[j].date_string) { if (interval_array[i].date_string == interval_major_array[j].date_string) {
VMM.attachElement(interval_array[i].element, ""); VMM.attachElement(interval_array[i].element, "");
} }
@ -1424,14 +1409,27 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var row = 2, var row = 2,
lpos = 0, lpos = 0,
row_depth = 0; row_depth = 0,
i = 0,
k = 0,
l = 0;
markers = []; markers = [];
era_markers = []; era_markers = [];
for(var i = 0; i < data.length; i++) { for(i = 0; i < data.length; i++) {
var _marker,
_marker_flag,
_marker_content,
_marker_dot,
_marker_line,
_marker_line_event,
_marker_obj,
_marker_title = "",
has_title = false;
var _marker, _marker_flag, _marker_content, _marker_dot, _marker_line, _marker_line_event, _marker_title = "", has_title = false;
_marker = VMM.appendAndGetElement($content, "<div>", "marker"); _marker = VMM.appendAndGetElement($content, "<div>", "marker");
_marker_flag = VMM.appendAndGetElement(_marker, "<div>", "flag"); _marker_flag = VMM.appendAndGetElement(_marker, "<div>", "flag");
@ -1488,7 +1486,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
VMM.bindEvent(_marker_flag, onMarkerClick, "", {number: i}); VMM.bindEvent(_marker_flag, onMarkerClick, "", {number: i});
VMM.bindEvent(_marker_flag, onMarkerHover, "mouseenter mouseleave", {number: i, elem:_marker_flag}); VMM.bindEvent(_marker_flag, onMarkerHover, "mouseenter mouseleave", {number: i, elem:_marker_flag});
var _marker_obj = { _marker_obj = {
marker: _marker, marker: _marker,
flag: _marker_flag, flag: _marker_flag,
lineevent: _marker_line_event, lineevent: _marker_line_event,
@ -1527,7 +1525,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
} else { } else {
config.nav.rows.current = config.nav.rows.full; config.nav.rows.current = config.nav.rows.full;
} }
for(var k = 0; k < tags.length; k++) { for(k = 0; k < tags.length; k++) {
if (k < config.nav.rows.current.length) { if (k < config.nav.rows.current.length) {
var tag_element = VMM.appendAndGetElement($timebackground, "<div>", "timenav-tag"); var tag_element = VMM.appendAndGetElement($timebackground, "<div>", "timenav-tag");
VMM.Lib.addClass(tag_element, "timenav-tag-row-" + (k+1)); VMM.Lib.addClass(tag_element, "timenav-tag-row-" + (k+1));
@ -1543,7 +1541,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// RESIZE FLAGS IF NEEDED // RESIZE FLAGS IF NEEDED
if (tags.length > 2) { if (tags.length > 2) {
for(var l = 0; l < markers.length; l++) { for(l = 0; l < markers.length; l++) {
VMM.Lib.addClass(markers[l].flag, "flag-small"); VMM.Lib.addClass(markers[l].flag, "flag-small");
markers[l].full = false; markers[l].full = false;
} }
@ -1554,9 +1552,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
var buildEras = function() { var buildEras = function() {
var number_of_colors = 6, var number_of_colors = 6,
current_color = 0; current_color = 0,
j = 0;
// CREATE ERAS // CREATE ERAS
for(var j = 0; j < eras.length; j++) { for(j = 0; j < eras.length; j++) {
var era = { var era = {
content: VMM.appendAndGetElement($content, "<div>", "era"), content: VMM.appendAndGetElement($content, "<div>", "era"),
text_content: VMM.appendAndGetElement($timeinterval, "<div>", "era"), text_content: VMM.appendAndGetElement($timeinterval, "<div>", "era"),
@ -1569,29 +1568,21 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
}, },
st = VMM.Date.prettyDate(era.startdate), st = VMM.Date.prettyDate(era.startdate),
en = VMM.Date.prettyDate(era.enddate), en = VMM.Date.prettyDate(era.enddate),
era_text = ""; era_text = "<div>&nbsp;</div>";
if (typeof eras[j].tag != "undefined") { if (typeof eras[j].tag != "undefined") {
era.tag = eras[j].tag; era.tag = eras[j].tag;
} }
era.relative_pos = positionRelative(interval, era.startdate, era.enddate); era.relative_pos = positionRelative(interval, era.startdate, era.enddate);
VMM.Lib.attr(era.content, "id", era.uniqueid); VMM.Lib.attr(era.content, "id", era.uniqueid);
VMM.Lib.attr(era.text_content, "id", era.uniqueid + "_text"); VMM.Lib.attr(era.text_content, "id", era.uniqueid + "_text");
//VMM.Lib.css(era.content, "background", era.color);
era_text += "<div>&nbsp;";
//era_text += "<h3>" + VMM.Util.unlinkify(era.title) + "</h3>"
if (st != en) {
//era_text += "<h4>" + st + " &mdash; " + en + "</h4>";
} else {
//era_text += "<h4>" + st + "</h4>";
}
era_text += "</div>";
// Background Color // Background Color
VMM.Lib.addClass(era.content, "era"+(current_color+1)); VMM.Lib.addClass(era.content, "era"+(current_color+1));
VMM.Lib.addClass(era.text_content, "era"+(current_color+1)); VMM.Lib.addClass(era.text_content, "era"+(current_color+1));
if (current_color < number_of_colors) { if (current_color < number_of_colors) {
current_color++; current_color++;
} else { } else {

107
source/js/VMM.Timeline.js

@ -29,23 +29,23 @@
// @codekit-prepend "Core/VMM.Util.js"; // @codekit-prepend "Core/VMM.Util.js";
// @codekit-prepend "Core/VMM.LoadLib.js"; // @codekit-prepend "Core/VMM.LoadLib.js";
// @codekit-prepend "Media/VMM.ExternalAPI.js"; // @codekit-prepend "Core/Media/VMM.ExternalAPI.js";
// @codekit-prepend "Media/VMM.MediaElement.js"; // @codekit-prepend "Core/Media/VMM.MediaElement.js";
// @codekit-prepend "Media/VMM.MediaType.js"; // @codekit-prepend "Core/Media/VMM.MediaType.js";
// @codekit-prepend "Media/VMM.Media.js"; // @codekit-prepend "Core/Media/VMM.Media.js";
// @codekit-prepend "Media/VMM.TextElement.js"; // @codekit-prepend "Core/Media/VMM.TextElement.js";
// @codekit-prepend "Slider/VMM.DragSlider.js"; // @codekit-prepend "Core/Slider/VMM.DragSlider.js";
// @codekit-prepend "Slider/VMM.Slider.js"; // @codekit-prepend "Core/Slider/VMM.Slider.js";
// @codekit-prepend "Slider/VMM.Slider.Slide.js"; // @codekit-prepend "Core/Slider/VMM.Slider.Slide.js";
// @codekit-prepend "VMM.Language.js"; // @codekit-prepend "VMM.Language.js";
// @codekit-append "VMM.Timeline.TimeNav.js"; // @codekit-append "VMM.Timeline.TimeNav.js";
// @codekit-append "VMM.Timeline.DataObj.js"; // @codekit-append "VMM.Timeline.DataObj.js";
// @codekit-prepend "lib/AES.js"; // @codekit-prepend "Core/Library/AES.js";
// @codekit-prepend "lib/bootstrap-tooltip.js"; // @codekit-prepend "Core/Library/bootstrap-tooltip.js";
/* Timeline /* Timeline
@ -53,20 +53,34 @@
if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
VMM.Timeline = function(w, h, conf, _timeline_id) { VMM.Timeline = function(_timeline_id, w, h) {
var $timeline, $feedback, slider, timenav, version, timeline_id; var $timeline,
var events = {}, data = {}, _dates = [], config = {}; $feedback,
var has_width = false, has_height = false, ie7 = false, is_moving = false; slider,
timenav,
version = "1.70",
timeline_id = "#timelinejs",
events = {},
data = {},
_dates = [],
config = {},
has_width = false,
has_height = false,
ie7 = false,
is_moving = false;
if (type.of(_timeline_id) == "string") { if (type.of(_timeline_id) == "string") {
timeline_id = _timeline_id; if (_timeline_id.match("#")) {
timeline_id = _timeline_id;
} else {
timeline_id = "#" + _timeline_id;
}
} else { } else {
timeline_id = "#timelinejs"; timeline_id = "#timelinejs";
} }
version = "1.68";
trace("TIMELINE VERSION " + version); trace("TIMELINE VERSION " + version);
/* CONFIG /* CONFIG
@ -74,11 +88,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
config = { config = {
embed: false, embed: false,
events: { events: {
data_ready: "DATAREADY", data_ready: "DATAREADY",
messege: "MESSEGE", messege: "MESSEGE",
headline: "HEADLINE", headline: "HEADLINE",
slide_change: "SLIDE_CHANGE", slide_change: "SLIDE_CHANGE",
resize: "resize" resize: "resize"
}, },
id: timeline_id, id: timeline_id,
type: "timeline", type: "timeline",
@ -188,7 +202,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* CREATE CONFIG /* CREATE CONFIG
================================================== */ ================================================== */
var createConfig = function(conf) { function createConfig(conf) {
// APPLY SUPPLIED CONFIG TO TIMELINE CONFIG // APPLY SUPPLIED CONFIG TO TIMELINE CONFIG
if (typeof embed_config == 'object') { if (typeof embed_config == 'object') {
@ -217,8 +231,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* CREATE TIMELINE STRUCTURE /* CREATE TIMELINE STRUCTURE
================================================== */ ================================================== */
var createStructure = function(w, h) { function createStructure() {
$timeline = VMM.getElement(timeline_id); $timeline = VMM.getElement(timeline_id);
VMM.Lib.addClass(timeline_id, "vmm-timeline"); VMM.Lib.addClass(timeline_id, "vmm-timeline");
if (config.touch) { if (config.touch) {
@ -227,9 +241,9 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
VMM.Lib.addClass(timeline_id, "vmm-notouch"); VMM.Lib.addClass(timeline_id, "vmm-notouch");
} }
$feedback = VMM.appendAndGetElement($timeline, "<div>", "feedback", ""); $feedback = VMM.appendAndGetElement($timeline, "<div>", "feedback", "");
slider = new VMM.Slider(timeline_id + " div.slider", config); slider = new VMM.Slider(timeline_id + " div.slider", config);
timenav = new VMM.Timeline.TimeNav(timeline_id + " div.navigation"); timenav = new VMM.Timeline.TimeNav(timeline_id + " div.navigation");
if (!has_width) { if (!has_width) {
config.width = VMM.Lib.width($timeline); config.width = VMM.Lib.width($timeline);
@ -305,7 +319,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
slider.setSlide(config.current_slide); slider.setSlide(config.current_slide);
}; };
var goToEvent = function(n) { function goToEvent(n) {
if (n <= _dates.length - 1 && n >= 0) { if (n <= _dates.length - 1 && n >= 0) {
config.current_slide = n; config.current_slide = n;
slider.setSlide(config.current_slide); slider.setSlide(config.current_slide);
@ -321,7 +335,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* PUBLIC FUNCTIONS /* PUBLIC FUNCTIONS
================================================== */ ================================================== */
this.init = function(_data, _timeline_id, conf) { this.init = function(conf, _data, _timeline_id) {
trace('TIMELINE INIT');
if (type.of(_timeline_id) == "string") { if (type.of(_timeline_id) == "string") {
if (_timeline_id.match("#")) { if (_timeline_id.match("#")) {
@ -332,9 +347,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
} }
createConfig(conf); createConfig(conf);
createStructure(w,h); createStructure();
if (type.of(_data) == "string") {
config.source = _data;
}
trace('TIMELINE INIT');
VMM.Date.setLanguage(VMM.Timeline.Config.language); VMM.Date.setLanguage(VMM.Timeline.Config.language);
VMM.master_config.language = VMM.Timeline.Config.language; VMM.master_config.language = VMM.Timeline.Config.language;
@ -354,8 +372,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
} }
} }
if (type.of(_data) == "string" || type.of(_data) == "object") { if (type.of(config.source) == "string" || type.of(config.source) == "object") {
VMM.Timeline.DataObj.getData(_data); VMM.Timeline.DataObj.getData(config.source);
} else { } else {
VMM.Timeline.DataObj.getData(VMM.getElement(timeline_id)); VMM.Timeline.DataObj.getData(VMM.getElement(timeline_id));
} }
@ -376,7 +394,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* DATA /* DATA
================================================== */ ================================================== */
var getData = function(url) { function getData(url) {
VMM.getJSON(url, function(d) { VMM.getJSON(url, function(d) {
data = VMM.Timeline.DataObj.getData(d); data = VMM.Timeline.DataObj.getData(d);
VMM.fireEvent(global, config.events.data_ready); VMM.fireEvent(global, config.events.data_ready);
@ -385,24 +403,23 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* MESSEGES /* MESSEGES
================================================== */ ================================================== */
function showMessege(e, msg) {
var showMessege = function(e, msg) {
trace("showMessege " + msg); trace("showMessege " + msg);
//VMM.attachElement($messege, msg); //VMM.attachElement($messege, msg);
VMM.attachElement($feedback, VMM.MediaElement.loadingmessage(msg)); VMM.attachElement($feedback, VMM.MediaElement.loadingmessage(msg));
}; };
var hideMessege = function() { function hideMessege() {
VMM.Lib.animate($feedback, config.duration, config.ease*4, {"opacity": 0}, detachMessege); VMM.Lib.animate($feedback, config.duration, config.ease*4, {"opacity": 0}, detachMessege);
}; };
var detachMessege = function() { function detachMessege() {
VMM.Lib.detach($feedback); VMM.Lib.detach($feedback);
} }
/* BUILD DISPLAY /* BUILD DISPLAY
================================================== */ ================================================== */
var build = function() { function build() {
// START AT SLIDE // START AT SLIDE
if (parseInt(config.start_at_slide) > 0 && config.current_slide == 0) { if (parseInt(config.start_at_slide) > 0 && config.current_slide == 0) {
@ -442,7 +459,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
}; };
var ie7Build = function() { function ie7Build() {
trace("IE7 or lower"); trace("IE7 or lower");
for(var i = 0; i < _dates.length; i++) { for(var i = 0; i < _dates.length; i++) {
trace(_dates[i]); trace(_dates[i]);
@ -464,7 +481,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
} }
}; };
var updateSize = function() { function updateSize() {
trace("UPDATE SIZE"); trace("UPDATE SIZE");
config.width = VMM.Lib.width($timeline); config.width = VMM.Lib.width($timeline);
config.height = VMM.Lib.height($timeline); config.height = VMM.Lib.height($timeline);
@ -481,7 +498,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
}; };
// BUILD DATE OBJECTS // BUILD DATE OBJECTS
var buildDates = function() { function buildDates() {
_dates = []; _dates = [];
VMM.fireEvent(global, config.events.messege, "Building Dates"); VMM.fireEvent(global, config.events.messege, "Building Dates");

Loading…
Cancel
Save