 
 SERVER = 'http://147.232.55.155:5000'
 
+isiPad = -> navigator.userAgent.match(/iPad/i) != null
+
 # TODO:
 # - Deselecting phrase by tapping somewhere else
 
 class App extends Spine.Controller
   events:
-    'click .phrase': 'select'
-    'touchend .phrase': 'select'
-    'click .image': 'open'
-    'touchend .image': 'open'
+    'tap .phrase': 'select'
+    'tap .image': 'open'
   
   constructor: ->
     super

    $("body").addClass("selected")
    
  _deselect: =>
    $("body").removeClass("selected")
    phrases = @$(".phrase")
    $(".hilight").detach()
    for phrase in phrases
      phrase = $(phrase)
      phrase.html(phrase.text())

  
  _close: (image) =>
    image.removeClass('open')
    console.log 'closing', image
    original = image.data('originalOffset')
    image.gfx({scale: 1, left: original.left, top: original.top}, {duration: 400})
    $(".preview").remove()
    @_currentImage = null
  
  _closeCurrent: ->
    @_close(@_currentImage) if @_currentImage

  # Adjusting font size
  # ---------------------------------------------------------------------------
