Refactor Mac/Windows detection

pull/129/head
Thibaut 11 years ago
parent a93b2d922c
commit 4ffc605019

@ -2,7 +2,7 @@ class app.Shortcuts
$.extend @prototype, Events
constructor: ->
@isWindows = navigator.platform?.indexOf('Win') >= 0
@isWindows = $.isWindows()
@start()
start: ->

@ -277,6 +277,12 @@ $.popup = (value) ->
$.isTouchScreen = ->
typeof ontouchstart isnt 'undefined'
$.isWindows = ->
navigator.platform?.indexOf('Win') >= 0
$.isMac = ->
navigator.userAgent?.indexOf('Mac') >= 0
HIGHLIGHT_DEFAULTS =
className: 'highlight'
delay: 1000

@ -1,5 +1,5 @@
ctrlKey = if navigator.userAgent?.indexOf('Mac') >= 0 then 'cmd' else 'ctrl'
navKey = if navigator.platform?.indexOf('Win') >= 0 then 'alt' else ctrlKey
ctrlKey = if $.isMac() then 'cmd' else 'ctrl'
navKey = if $.isWindows() then 'alt' else ctrlKey
app.templates.helpPage = """
<div class="_toc">

Loading…
Cancel
Save