mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
Refactor Mac/Windows detection
This commit is contained in:
parent
a93b2d922c
commit
4ffc605019
3 changed files with 9 additions and 3 deletions
|
@ -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…
Reference in a new issue