diff --git a/source/js/Core/Slider/VMM.Slider.Slide.js b/source/js/Core/Slider/VMM.Slider.Slide.js index ff1f9c2e5..ea53701d3 100644 --- a/source/js/Core/Slider/VMM.Slider.Slide.js +++ b/source/js/Core/Slider/VMM.Slider.Slide.js @@ -22,6 +22,7 @@ if (typeof VMM.Slider != 'undefined') { _id = _id + data.uniqueid; this.enqueue = _enqueue; this.id = _id; + this.slideName = data.slideName; element = VMM.appendAndGetElement(_parent, "
", "slider-item"); diff --git a/source/js/Core/Slider/VMM.Slider.js b/source/js/Core/Slider/VMM.Slider.js index fe149c8e8..6b9c98818 100644 --- a/source/js/Core/Slider/VMM.Slider.js +++ b/source/js/Core/Slider/VMM.Slider.js @@ -113,6 +113,18 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') { } } + // Get index using Slide Name for hash routing + this.findSlideIndexByName = function(n) { + for (var i = 0; i < slides.length; i++) + { + if (slides[i].slideName == n) { + return i; + } + } + return -1; + }; + + /* GETTERS AND SETTERS ================================================== */ this.setData = function(d) { @@ -799,7 +811,3 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') { }; } - - - - diff --git a/source/js/VMM.Timeline.DataObj.js b/source/js/VMM.Timeline.DataObj.js index a0f238bee..283ed67ce 100644 --- a/source/js/VMM.Timeline.DataObj.js +++ b/source/js/VMM.Timeline.DataObj.js @@ -282,6 +282,7 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef } else { var date = { type: "google spreadsheet", + slideName: getGVar(dd.gsx$slidename), startDate: getGVar(dd.gsx$startdate), endDate: getGVar(dd.gsx$enddate), headline: getGVar(dd.gsx$headline), @@ -794,4 +795,4 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef }; -} \ No newline at end of file +} diff --git a/source/js/VMM.Timeline.js b/source/js/VMM.Timeline.js index f75b4d061..0fd7b17a3 100755 --- a/source/js/VMM.Timeline.js +++ b/source/js/VMM.Timeline.js @@ -155,11 +155,18 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { } } + // Routes number AND Slide Name window.onhashchange = function () { var hash = window.location.hash.substring(1); if (config.hash_bookmark) { if (is_moving) { - goToEvent(parseInt(hash)); + if ( isNaN(parseInt(hash)) ) { + // if string, find the index and route to it + var slideI = slider.findSlideIndexByName(hash); + if ( slideI != -1 ) goToEvent(slideI); + } else { + goToEvent(parseInt(hash)); + } } else { is_moving = false; } @@ -580,6 +587,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { } } + _date.slideName = data.date[i].slideName; _date.title = data.date[i].headline; _date.headline = data.date[i].headline; _date.type = data.date[i].type;