mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-30 16:47:59 +01:00
12 lines
340 B
CoffeeScript
12 lines
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'
|