mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
12 lines
No EOL
340 B
CoffeeScript
12 lines
No EOL
340 B
CoffeeScript
$player = $ '.player'
|
|
$favourite = $player.find '.favourite'
|
|
trackId = $player.data 'track-id'
|
|
|
|
$favourite.click (e) ->
|
|
e.preventDefault()
|
|
|
|
$.post('/api/web/favourites/toggle', {type: 'track', id: trackId, _token: pfm.token}).done (res) ->
|
|
if res.is_favourited
|
|
$player.addClass 'favourited'
|
|
else
|
|
$player.removeClass 'favourited' |