From 53252f3cab47cc81c095924a8a7005850efaa42e Mon Sep 17 00:00:00 2001 From: Joel Purra Date: Wed, 23 Apr 2014 11:23:57 +0200 Subject: [PATCH] Ignore jumps while the alt key is pressed --- dist/bespoke-jumpy.js | 2 +- dist/bespoke-jumpy.min.js | 2 +- src/bespoke-jumpy.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/bespoke-jumpy.js b/dist/bespoke-jumpy.js index 73fccb1..60b7543 100644 --- a/dist/bespoke-jumpy.js +++ b/dist/bespoke-jumpy.js @@ -106,7 +106,7 @@ digit, index; - if(e.metaKey || e.ctrlKey || e.shiftKey) { + if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return false; } diff --git a/dist/bespoke-jumpy.min.js b/dist/bespoke-jumpy.min.js index b4e9b34..85280b9 100644 --- a/dist/bespoke-jumpy.min.js +++ b/dist/bespoke-jumpy.min.js @@ -1,2 +1,2 @@ /*! bespoke-jumpy v0.1.2 © 2014 Joel Purra, Licensed MIT */ -!function(a,b,c,d,e,f){"use strict";var g=c.builder(e),h={END:35,HOME:36},i=function(a){for(var b=a;b>9;)b-=48;return b},j=function(a){var b=a>=48&&57>=a||a>=96&&105>=a;return b},k={firstIndex:function(){var a=0;return a},lastIndex:function(){var a=Math.max(0,this.slides.length-1);return a},first:function(a){var b=this.firstIndex(),c=g.fire(this,"first",null,b,a)&&this.slide(b,a);return c},last:function(a){var b=this.lastIndex(),c=g.fire(this,"last",null,b,a)&&this.slide(b,a);return c}},l=function(b){var c=["firstIndex","lastIndex","first","last"],d={},e=function(){c.forEach(function(a){d[a]=b[a],b[a]=k[a].bind(b)})},f=function(a){var c,d,e=!1;return a.metaKey||a.ctrlKey||a.shiftKey?!1:(e=e||a.which===h.END&&g.fire(b,"end",a)&&!b.last(),e=e||a.which===h.HOME&&g.fire(b,"home",a)&&!b.first(),j(a.which)&&(c=i(a.which),d=(c-1+10)%10,e=e||g.fire(b,"jump",a,d)&&!b.slide(d)),e&&a.preventDefault(),!e)},l=function(){a.addEventListener("keydown",f,!1)},m=function(){e(),l()};m()};if(d[e]!==f)throw g.generateErrorObject("The "+e+" plugin has already been loaded.");d[e]=l}(document,bespoke,bespoke.plugins.convenient,bespoke.plugins,"jumpy"); \ No newline at end of file +!function(a,b,c,d,e,f){"use strict";var g=c.builder(e),h={END:35,HOME:36},i=function(a){for(var b=a;b>9;)b-=48;return b},j=function(a){var b=a>=48&&57>=a||a>=96&&105>=a;return b},k={firstIndex:function(){var a=0;return a},lastIndex:function(){var a=Math.max(0,this.slides.length-1);return a},first:function(a){var b=this.firstIndex(),c=g.fire(this,"first",null,b,a)&&this.slide(b,a);return c},last:function(a){var b=this.lastIndex(),c=g.fire(this,"last",null,b,a)&&this.slide(b,a);return c}},l=function(b){var c=["firstIndex","lastIndex","first","last"],d={},e=function(){c.forEach(function(a){d[a]=b[a],b[a]=k[a].bind(b)})},f=function(a){var c,d,e=!1;return a.altKey||a.ctrlKey||a.metaKey||a.shiftKey?!1:(e=e||a.which===h.END&&g.fire(b,"end",a)&&!b.last(),e=e||a.which===h.HOME&&g.fire(b,"home",a)&&!b.first(),j(a.which)&&(c=i(a.which),d=(c-1+10)%10,e=e||g.fire(b,"jump",a,d)&&!b.slide(d)),e&&a.preventDefault(),!e)},l=function(){a.addEventListener("keydown",f,!1)},m=function(){e(),l()};m()};if(d[e]!==f)throw g.generateErrorObject("The "+e+" plugin has already been loaded.");d[e]=l}(document,bespoke,bespoke.plugins.convenient,bespoke.plugins,"jumpy"); \ No newline at end of file diff --git a/src/bespoke-jumpy.js b/src/bespoke-jumpy.js index 601d3e7..3518f02 100644 --- a/src/bespoke-jumpy.js +++ b/src/bespoke-jumpy.js @@ -100,7 +100,7 @@ digit, index; - if(e.metaKey || e.ctrlKey || e.shiftKey) { + if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return false; }