lib/public/js/parade-command-input.js in parade-0.8.0 vs lib/public/js/parade-command-input.js in parade-0.8.1

- old
+ new

@@ -6,11 +6,23 @@ window.TerminalCommands = { next : publishCommand('presentation:slide:next'), previous : publishCommand('presentation:slide:previous'), goto : function(tokens) { - var slide = parseInt(tokens[0]) - 1; - $.publish('presentation:slide:location:change',slide); + + var gotoSlideNumber = undefined; + + if ( parseInt(tokens[0]) > 0 && parseInt(tokens[0]) < presentation.slideTotal()) { + gotoSlideNumber = parseInt(tokens[0]) - 1; + } else if (tokens[0] == 'start') { + gotoSlideNumber = 0; + } else if (tokens[0] == 'end') { + gotoSlideNumber = presentation.slideTotal() - 1; + } else { + gotoSlideNumber = presentation.slides.findClosestToQuery(presentation.currentSlide.sequence,tokens[0]) - 1; + } + + $.publish('presentation:slide:location:change',gotoSlideNumber); } }; }); \ No newline at end of file