   114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 144, 145, 191
 ]
 
-bindRawKey = (hotkey, fn) -> $(document).bind "keydown", hotkey, fn
+bindRawKey = (hotkey, fn) -> $(document).bind 'keydown', hotkey, fn
 
 bindKey = (hotkey, fn) -> bindRawKey hotkey, (event) -> fn(event) if not event.metaKey
 
 bindKeySequence = (expression, fn) -> keySequences.push([expression, fn])
 
 clearNewPostsFromDiscussion = (target) ->
-  $(".discussion" + exchangeId(target)).removeClass "new_posts"
-  $(".discussion" + exchangeId(target) + " .new_posts").html ""
+  $('.discussion' + exchangeId(target)).removeClass 'new_posts'
+  $('.discussion' + exchangeId(target) + ' .new_posts').html ''
 
 defaultTarget = ->
   if document.location.hash && document.location.hash.match(/^#post-([\d]+)$/)


trackKeySequence = (event) ->
  target = $(event.target)
  if target.is("input") or target.is("textarea") or target.is("select")
    keySequence = ""
  else
    character = keypressToCharacter(event)
    if not event.metaKey and character and character.match(/^[\w\d]$/)


markAsRead = (target) ->
  if isDiscussion(target)
    $.get '/discussions/' + exchangeId(target) + '/mark_as_read', {}, ->
      clearNewPostsFromDiscussion(target)

openTarget = (target) -> visitPath(targetUrl(target))
openTargetNewTab = (target) -> window.open targetUrl(target)

scrollToTarget = (target) -> $.scrollTo target, { duration: 100, offset: { top: -50 }, axis: 'y' }

targetUrl = (target) -> target.href

isDiscussion = (target) -> $(target).closest('tr').hasClass('discussion')

isExchangesView = -> $('table.discussions').length > 0
isPostsView     = -> $('.posts .post').length > 0

onlyExchanges = (fn) -> (fn() if isExchangesView())
onlyPosts     = (fn) -> (fn() if isPostsView())
