dseif / slide-drive

Slideshow using audio/video to drive content
45 stars 9 forks source link

Disable Keyboard Shortcuts In Butter #18

Closed banksJeremy closed 12 years ago

banksJeremy commented 12 years ago

When Slide Drive is used in a Butter template their keyboard shortcuts conflict. When I press space to start playing (Butter shortcut), it also jumps to the next slide (Slide Drive shortcut). We should disable all or some of the keyboard shortcuts when we're in a Butter template.

banksJeremy commented 12 years ago

We're initializing $.deck( ".slide" ) twice, once in js/setup.js or js/mobile.js and once in popcornjs/parser.deckjs.js. Adding , { options: { keys: {} } } to both of them seems like the correct solution, but it doesn't work.

Adding if( window.Butter) $.deck( "getOptions" ).keys = {}; after each initialization is less elegant, but seems to work.

dseif commented 12 years ago

Few comments in the commit

banksJeremy commented 12 years ago

That commit wasn't working right and has now been scrapped.

I reimplemented this while I was reworking /js/setup.js, see here. Deck.js' keyboard shortcut options do not seem to work right, and even if they did they don't have an way to find plugins' shortcuts automatically.

Instead I'm just iterating through all keydown events defined on document and unbinding any with a /^deck/ namespace. It's a little crude, but it should work fine.