diff --git a/extensions/goto/deck.goto.js b/extensions/goto/deck.goto.js index 6a90f16c..32abebb8 100644 --- a/extensions/goto/deck.goto.js +++ b/extensions/goto/deck.goto.js @@ -15,6 +15,25 @@ the deck container. var $document = $(document); var rootCounter; + var maybeAddSnippet = function() { + var options = $.deck('getOptions'); + if (options.snippets.goto) { + if ($(options.selectors.gotoForm).size() > 0 && options.alert.goto) { + alert("'options.snippets.goto' is true but a "+options.selectors.gotoForm+" has been found." + +"\nThis might cause interaction glitches." + +"\n" + +"\nSuggestion: remove your html snippet or pass the {snippets: {goto: false}} option." + ); + } + $('
').addClass('goto-form').attr('action', '.').attr('method', 'get') + .append($('').attr('for', 'goto-slide').text('Go to slide:')) + .append($('').attr('type', 'text').attr('id', 'goto-slide').attr('name', 'slidenum').attr('list', 'goto-datalist')) + .append($('').attr('id', 'goto-datalist')) + .append($('').attr('type', 'submit').attr('value', 'Go')) + .appendTo($.deck('getContainer')); + } + }; + var bindKeyEvents = function() { $document.unbind('keydown.deckgoto'); $document.bind('keydown.deckgoto', function(event) { @@ -136,6 +155,14 @@ the deck container. gotoInput: '#goto-slide' }, + snippets: { + goto: true + }, + + alert: { + goto: true + }, + keys: { goto: 71 // g }, @@ -181,6 +208,7 @@ the deck container. }); $document.bind('deck.init', function() { + maybeAddSnippet(); bindKeyEvents(); populateDatalist(); markRootSlides();