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 $.extend @prototype, Events
constructor: -> constructor: ->
@isWindows = navigator.platform?.indexOf('Win') >= 0 @isWindows = $.isWindows()
@start() @start()
start: -> start: ->

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

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

Loading…
Cancel
Save