Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ = jQuery
- $(document).on 'click', 'a.actionable.do_favourite', (evt) ->
- evt.preventDefault()
- $a = $ @
- return if $a.hasClass("loading")
- $a.toggleClass('loading')
- $a.closest('.f_s').toggleClass('f_a')
- onSuccess = ->
- $a.toggleClass('loading')
- #Changing title
- if $a.closest('.f_s').hasClass('f_a') #Active
- $a.attr('title', $a.attr('data-title-on'))
- else #Inactive
- $a.attr('title', $a.attr('data-title-off'))
- $('span.count').each ->
- $this = $ @
- # 'current' for Classifieds
- if $this.parent().hasClass('current')
- count = +($this.text().trim().replace(/[\(\)]/g, ''))
- if $a.closest('.f_s').hasClass('f_a') #Active
- $this.text("(#{count + 1})")
- else #Inactive
- $this.text("(#{count - 1})")
- # 'favs' class for Community
- $('span.count.favs').each ->
- $this = $ @
- count = +($this.text().trim().replace(/[\(\)]/g, ''))
- if $a.closest('.f_s').hasClass('f_a')
- $this.text("(#{count + 1})")
- else
- $this.text("(#{count - 1})")
- $.get(@getAttribute('data-action')).success(onSuccess)
- jQuery ($) ->
- $('.notify-frequency').change ->
- selected = $(@).find('option:selected').val()
- $.get(@getAttribute('data-action'), updating_frequency: selected)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement