Permalink
Browse files

added helper files with mobile device detection, dont set focus if mo…

…use (or pointer) is over the sidebar if it is a mobile device
  • Loading branch information...
1 parent 23f3151 commit 9e924af0d19ea28b41c27037b2a85491f958eeff @mustardamus mustardamus committed Jan 21, 2013
@@ -7,6 +7,7 @@
#= require init
#= require templates
+#= require helper
#= require sidebar
#= require categories
#= require header
@@ -0,0 +1,5 @@
+class jqapi.Helper
+ isMobile: ->
+ ua = navigator.userAgent
+
+ ua.match(/Android|webOS|iPhone|iPod|BlackBerry|iPad|IEMobile/i)
@@ -3,6 +3,7 @@ jqapi.events = $ {} # use application even
jQuery -> # wait for dom ready
window.templates = new jqapi.Templates # shared templates between scripts
+ window.helper = new jqapi.Helper
parts = [
'Sidebar' # responsible for the sidebar dimensions
@@ -10,4 +10,5 @@ class jqapi.Sidebar
@contentEl.height newHeight # set new height of sidebar content
@el.on 'mouseenter', => # if the mouse enters the sidebar area
- jqapi.events.trigger 'search:focus' # set focus to search input
+ unless helper.isMobile() # don't set focus on mobile devices
+ jqapi.events.trigger 'search:focus' # set focus to search input

0 comments on commit 9e924af

Please sign in to comment.