core.js.coffee 901 B

123456789101112131415161718192021222324252627282930
  1. $ ->
  2. # Flash
  3. if $(".flash").length
  4. setTimeout((-> $(".flash").slideUp(-> $(".flash").remove())), 5000)
  5. # Help popovers
  6. $('.hover-help').popover(trigger: 'hover', html: true)
  7. # Pressing '/' selects the search box.
  8. $("body").on "keypress", (e) ->
  9. if e.keyCode == 47 # The '/' key
  10. if e.target.nodeName == "BODY"
  11. e.preventDefault()
  12. $agentNavigate.focus()
  13. # Select2 Selects
  14. $(".select2").select2(width: 'resolve')
  15. # Helper for selecting text when clicked
  16. $('.selectable-text').each ->
  17. $(this).click ->
  18. range = document.createRange()
  19. range.setStartBefore(this.firstChild)
  20. range.setEndAfter(this.lastChild)
  21. sel = window.getSelection()
  22. sel.removeAllRanges();
  23. sel.addRange(range)
  24. # Agent navbar dropdown
  25. $('.navbar .dropdown.dropdown-hover').hover (-> $(this).addClass('open')), (-> $(this).removeClass('open'))