UNPKG

bespoke-keys

Version:
32 lines (28 loc) 1.65 kB
/*! * bespoke-keys v1.0.0 * * Copyright 2015, Mark Dalgleish * This content is released under the MIT license * http://mit-license.org/markdalgleish */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self);var o=n;o=o.bespoke||(o.bespoke={}),o=o.plugins||(o.plugins={}),o.keys=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ module.exports = function(options) { return function(deck) { var isHorizontal = options !== 'vertical'; document.addEventListener('keydown', function(e) { if (e.which == 34 || // PAGE DOWN (e.which == 32 && !e.shiftKey) || // SPACE WITHOUT SHIFT (isHorizontal && e.which == 39) || // RIGHT (!isHorizontal && e.which == 40) // DOWN ) { deck.next(); } if (e.which == 33 || // PAGE UP (e.which == 32 && e.shiftKey) || // SPACE + SHIFT (isHorizontal && e.which == 37) || // LEFT (!isHorizontal && e.which == 38) // UP ) { deck.prev(); } }); }; }; },{}]},{},[1]) (1) });