Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 9e924af0d19ea28b41c27037b2a85491f958eeff 1 parent 23f3151
Sebastian Senf mustardamus authored
1  app/assets/javascripts/bundle.js.coffee
View
@@ -7,6 +7,7 @@
#= require init
#= require templates
+#= require helper
#= require sidebar
#= require categories
#= require header
5 app/assets/javascripts/helper.js.coffee
View
@@ -0,0 +1,5 @@
+class jqapi.Helper
+ isMobile: ->
+ ua = navigator.userAgent
+
+ ua.match(/Android|webOS|iPhone|iPod|BlackBerry|iPad|IEMobile/i)
1  app/assets/javascripts/init.js.coffee
View
@@ -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
3  app/assets/javascripts/sidebar.js.coffee
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.