Browse Source

Added features to use slugs in TimeNav when there is no headline

pull/127/merge
Zach Wise 13 years ago
parent
commit
6d9d82f532
  1. 23
      source/js/VMM.Timeline.js

23
source/js/VMM.Timeline.js

@ -68,7 +68,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
timeline_id = "#timeline"; timeline_id = "#timeline";
} }
version = "1.45mem"; version = "1.48";
trace("TIMELINE VERSION " + version); trace("TIMELINE VERSION " + version);
@ -111,6 +111,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
interval_width: 200, interval_width: 200,
density: 4, density: 4,
minor_width: 0, minor_width: 0,
minor_left: 0,
multiplier: { multiplier: {
current: 6, current: 6,
min: .1, min: .1,
@ -448,7 +449,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
if (!isNaN(_date.startdate)) { if (!isNaN(_date.startdate)) {
_date.uniqueid = (data.date[i].startDate).toString() + "-" + i.toString();
// END DATE // END DATE
if (data.date[i].endDate != null && data.date[i].endDate != "") { if (data.date[i].endDate != null && data.date[i].endDate != "") {
@ -461,6 +461,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
_date.enddate = _date.startdate; _date.enddate = _date.startdate;
} }
_date.needs_slug = false;
if (data.date[i].headline == "") {
if (data.date[i].slug != null && data.date[i].slug != "") {
_date.needs_slug = true;
}
}
_date.title = data.date[i].headline; _date.title = data.date[i].headline;
_date.headline = data.date[i].headline; _date.headline = data.date[i].headline;
_date.type = data.date[i].type; _date.type = data.date[i].type;
@ -471,6 +479,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
_date.content = ""; _date.content = "";
_date.tag = data.date[i].tag; _date.tag = data.date[i].tag;
_date.slug = data.date[i].slug; _date.slug = data.date[i].slug;
_date.uniqueid = VMM.Util.unique_ID(7);
_dates.push(_date); _dates.push(_date);
} }
@ -481,9 +490,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* CUSTOM SORT /* CUSTOM SORT
================================================== */ ================================================== */
if (data.type != "storify") {
_dates.sort(function(a, b){ _dates.sort(function(a, b){
return a.fulldate - b.fulldate return a.fulldate - b.fulldate
}); });
}
/* CREATE START PAGE IF AVAILABLE /* CREATE START PAGE IF AVAILABLE
================================================== */ ================================================== */
@ -511,7 +522,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
_date.startdate.setMinutes(td.getMinutes() - 1); _date.startdate.setMinutes(td.getMinutes() - 1);
} }
_date.uniqueid = VMM.Util.unique_ID(5); _date.uniqueid = VMM.Util.unique_ID(7);
_date.enddate = _date.startdate; _date.enddate = _date.startdate;
_date.title = data.headline; _date.title = data.headline;
_date.headline = data.headline; _date.headline = data.headline;
@ -519,20 +530,24 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
_date.type = "start"; _date.type = "start";
_date.date = VMM.Date.prettyDate(data.startDate); _date.date = VMM.Date.prettyDate(data.startDate);
_date.asset = data.asset; _date.asset = data.asset;
_date.slug = false;
_date.needs_slug = false;
_date.fulldate = _date.startdate.getTime(); _date.fulldate = _date.startdate.getTime();
if (config.embed) { if (config.embed) {
VMM.fireEvent(global, config.events.headline, _date.headline); VMM.fireEvent(global, config.events.headline, _date.headline);
} }
_dates.push(_date); _dates.unshift(_date);
} }
/* CUSTOM SORT /* CUSTOM SORT
================================================== */ ================================================== */
if (data.type != "storify") {
_dates.sort(function(a, b){ _dates.sort(function(a, b){
return a.fulldate - b.fulldate return a.fulldate - b.fulldate
}); });
}
onDatesProcessed(); onDatesProcessed();
} }

Loading…
Cancel
Save