On Windows, use alt modifier instead of ctrl for back/forward navigation

Fixes #51.
pull/129/head
Thibaut 11 years ago
parent 144136b824
commit a93b2d922c

@ -2,6 +2,7 @@ class app.Shortcuts
$.extend @prototype, Events $.extend @prototype, Events
constructor: -> constructor: ->
@isWindows = navigator.platform?.indexOf('Win') >= 0
@start() @start()
start: -> start: ->
@ -72,12 +73,14 @@ class app.Shortcuts
when 13 when 13
@trigger 'superEnter' @trigger 'superEnter'
when 37 when 37
unless @isWindows
@trigger 'superLeft' @trigger 'superLeft'
false false
when 38 when 38
@trigger 'home' @trigger 'home'
false false
when 39 when 39
unless @isWindows
@trigger 'superRight' @trigger 'superRight'
false false
when 40 when 40
@ -97,9 +100,17 @@ class app.Shortcuts
switch event.which switch event.which
when 9 when 9
@trigger 'altRight', event @trigger 'altRight', event
when 37
if @isWindows
@trigger 'superLeft'
false
when 38 when 38
@trigger 'altUp' @trigger 'altUp'
false false
when 39
if @isWindows
@trigger 'superRight'
false
when 40 when 40
@trigger 'altDown' @trigger 'altDown'
false false

@ -1,4 +1,5 @@
ctrlKey = if navigator.userAgent.indexOf 'Mac OS X' then 'cmd' else 'ctrl' ctrlKey = if navigator.userAgent?.indexOf('Mac') >= 0 then 'cmd' else 'ctrl'
navKey = if navigator.platform?.indexOf('Win') >= 0 then 'alt' else ctrlKey
app.templates.helpPage = """ app.templates.helpPage = """
<div class="_toc"> <div class="_toc">
@ -59,8 +60,8 @@ app.templates.helpPage = """
<h3 class="_shortcuts-title">Navigation</h3> <h3 class="_shortcuts-title">Navigation</h3>
<dl class="_shortcuts-dl"> <dl class="_shortcuts-dl">
<dt class="_shortcuts-dt"> <dt class="_shortcuts-dt">
<code class="_shortcut-code">#{ctrlKey} + &larr;</code> <code class="_shortcut-code">#{navKey} + &larr;</code>
<code class="_shortcut-code">#{ctrlKey} + &rarr;</code> <code class="_shortcut-code">#{navKey} + &rarr;</code>
<dd class="_shortcuts-dd">Go back/forward <dd class="_shortcuts-dd">Go back/forward
<dt class="_shortcuts-dt"> <dt class="_shortcuts-dt">
<code class="_shortcut-code">alt + &darr;</code> <code class="_shortcut-code">alt + &darr;</code>

Loading…
Cancel
Save