From 214622b41e7443486184afac5e9bdaae66a4f434 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 26 Feb 2017 14:46:45 -0500 Subject: [PATCH] Only use super + left/right for back/forward navigation on Mac Closes #529. --- assets/javascripts/app/shortcuts.coffee | 10 +++++----- assets/javascripts/lib/util.coffee | 3 --- assets/javascripts/templates/pages/help_tmpl.coffee | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/assets/javascripts/app/shortcuts.coffee b/assets/javascripts/app/shortcuts.coffee index 8ea37a24..57c96d8f 100644 --- a/assets/javascripts/app/shortcuts.coffee +++ b/assets/javascripts/app/shortcuts.coffee @@ -2,7 +2,7 @@ class app.Shortcuts $.extend @prototype, Events constructor: -> - @isWindows = $.isWindows() + @isMac = $.isMac() @start() start: -> @@ -91,14 +91,14 @@ class app.Shortcuts when 13 @trigger 'superEnter' when 37 - unless @isWindows + if @isMac @trigger 'superLeft' false when 38 @trigger 'pageTop' false when 39 - unless @isWindows + if @isMac @trigger 'superRight' false when 40 @@ -135,14 +135,14 @@ class app.Shortcuts when 9 @trigger 'altRight', event when 37 - if @isWindows + unless @isMac @trigger 'superLeft' false when 38 @trigger 'altUp' false when 39 - if @isWindows + unless @isMac @trigger 'superRight' false when 40 diff --git a/assets/javascripts/lib/util.coffee b/assets/javascripts/lib/util.coffee index dae644c3..aba9f038 100644 --- a/assets/javascripts/lib/util.coffee +++ b/assets/javascripts/lib/util.coffee @@ -336,9 +336,6 @@ $.popup = (value) -> window.open value.href or value, '_blank' return -$.isWindows = -> - navigator.platform?.indexOf('Win') >= 0 - $.isMac = -> navigator.userAgent?.indexOf('Mac') >= 0 diff --git a/assets/javascripts/templates/pages/help_tmpl.coffee b/assets/javascripts/templates/pages/help_tmpl.coffee index c6489c1d..51831d63 100644 --- a/assets/javascripts/templates/pages/help_tmpl.coffee +++ b/assets/javascripts/templates/pages/help_tmpl.coffee @@ -1,5 +1,5 @@ ctrlKey = if $.isMac() then 'cmd' else 'ctrl' -navKey = if $.isWindows() then 'alt' else ctrlKey +navKey = if $.isMac() then 'cmd' else 'alt' app.templates.helpPage = """