Showing the changes to assets/javascripts/app (2 of 4 files). Show all
Unified · Split
| @@ -14,6 +14,7 @@ class app.Settings · 13 unmodified lines | ||
| 14 | 14 | 'tips' |
| 15 | 15 | 'autoInstall' |
| 16 | 16 | 'spaceScroll' |
| 17 | + 'spaceTimeout' | |
| 17 | 18 | ] |
| 18 | 19 | |
| 19 | 20 | INTERNAL_KEYS = [ |
| @@ -35,6 +36,7 @@ class app.Settings · 15 unmodified lines | ||
| 35 | 36 | analyticsConsent: false |
| 36 | 37 | theme: 'auto' |
| 37 | 38 | spaceScroll: 1 |
| 39 | + spaceTimeout: 0.5 | |
| 38 | 40 | |
| 39 | 41 | constructor: -> |
| 40 | 42 | @store = new CookiesStore |
| @@ -20,11 +20,14 @@ class app.Shortcuts · 19 unmodified lines | ||
| 20 | 20 | |
| 21 | 21 | spaceScroll: -> |
| 22 | 22 | app.settings.get('spaceScroll') |
| 23 | − | |
| 23 | + | |
| 24 | 24 | showTip: -> |
| 25 | 25 | app.showTip('KeyNav') |
| 26 | 26 | @showTip = null |
| 27 | 27 | |
| 28 | + spaceTimeout: -> | |
| 29 | + app.settings.get('spaceTimeout') | |
| 30 | + | |
| 28 | 31 | onKeydown: (event) => |
| 29 | 32 | return if @buggyEvent(event) |
| 30 | 33 | result = if event.ctrlKey or event.metaKey |
| @@ -62,7 +65,7 @@ class app.Shortcuts · 31 unmodified lines | ||
| 62 | 65 | @trigger 'escape' |
| 63 | 66 | false |
| 64 | 67 | when 32 |
| 65 | − if event.target.type is 'search' and @spaceScroll() and (not @lastKeypress or @lastKeypress < Date.now() - 500) | |
| 68 | + if event.target.type is 'search' and @spaceScroll() and (not @lastKeypress or @lastKeypress < Date.now() - (@spaceTimeout() * 1000)) | |
| 66 | 69 | @trigger 'pageDown' |
| 67 | 70 | false |
| 68 | 71 | when 33 |