ensl.org/app/assets/javascripts/application.js.coffee

49 lines
1.1 KiB
CoffeeScript
Raw Normal View History

//= require jquery
//= require jquery_ujs
//= require jquery.periodicalupdater
//= require jquery.jplayer.min
//= require flowplayer
//= require tinymce-jquery
//= require yetii
//= require local
//= require_self
$ ->
$('#logout').click ->
$(this).closest('form').submit()
$('select').each (i, el) ->
$select = $(el)
$select.wrap '<div class="select-wrapper" />'
$select.on 'DOMSubtreeModified', (event) ->
$el = $(this)
$wrapper = $el.parent()
if $el.is("[disabled]")
$wrapper.addClass 'disabled'
else
$wrapper.removeClass 'disabled'
$select.trigger 'DOMSubtreeModified'
2014-05-10 08:44:48 +00:00
$('a[href=#form_submit]').click ->
$(this).closest('form').submit()
return false
2014-05-10 10:02:57 +00:00
$('select.autosubmit').change ->
$(this).closest('form').submit()
$('#notification').delay(3000).fadeOut()
$('#steam-search a').click (event) ->
event.preventDefault()
$search = $('#steam-search')
id = $search.data 'user-id'
$search.html "<p>Searching...</p>"
$.get "/api/v1/users/#{id}", (data) ->
$search.html "<a href='#{data.steam.url}'>Steam Profile: #{data.steam.nickname}</a>"