Unified · Split
| @@ -191,11 +191,14 @@ · 190 unmodified lines | |||
| 191 | !!(@DOC or @doc) | 191 | !!(@DOC or @doc) |
| 192 | 192 | ||
| 193 | isMobile: -> | 193 | isMobile: -> |
| 194 | # Need to sniff the user agent because some Android and Windows Phone devices don't take | 194 | try |
| 195 | # resolution (dpi) into account when reporting device width/height. | 195 | # Need to sniff the user agent because some Android and Windows Phone devices don't take |
| 196 | @_isMobile ?= (matchMedia('(max-device-width: 767px), (max-device-height: 767px)').matches) or | 196 | # resolution (dpi) into account when reporting device width/height. |
| 197 | (navigator.userAgent.indexOf('Android') isnt -1 and navigator.userAgent.indexOf('Mobile') isnt -1) or | 197 | @_isMobile ?= (window.matchMedia('(max-device-width: 767px), (max-device-height: 767px)').matches) or |
| 198 | (navigator.userAgent.indexOf('IEMobile') isnt -1) | 198 | (navigator.userAgent.indexOf('Android') isnt -1 and navigator.userAgent.indexOf('Mobile') isnt -1) or |
| 199 | (navigator.userAgent.indexOf('IEMobile') isnt -1) | ||
| 200 | catch | ||
| 201 | @_isMobile = false | ||
| 199 | 202 | ||
| 200 | isInvalidLocation: -> | 203 | isInvalidLocation: -> |
| 201 | @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0 | 204 | @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0 |