|
|
@@ -9,6 +9,18 @@ class app.views.Mobile extends app.View
|
|
|
@routes:
|
|
|
after: 'afterRoute'
|
|
|
|
|
|
+ @detect: ->
|
|
|
+ try
|
|
|
+ (window.matchMedia('(max-width: 480px)').matches) or
|
|
|
+ (window.matchMedia('(max-device-width: 767px)').matches) or
|
|
|
+ (window.matchMedia('(max-device-height: 767px) and (max-device-width: 1024px)').matches) or
|
|
|
+ # Need to sniff the user agent because some Android and Windows Phone devices don't take
|
|
|
+ # resolution (dpi) into account when reporting device width/height.
|
|
|
+ (navigator.userAgent.indexOf('Android') isnt -1 and navigator.userAgent.indexOf('Mobile') isnt -1) or
|
|
|
+ (navigator.userAgent.indexOf('IEMobile') isnt -1)
|
|
|
+ catch
|
|
|
+ false
|
|
|
+
|
|
|
constructor: ->
|
|
|
@el = document.documentElement
|
|
|
super
|