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