It works!!1
This commit is contained in:
parent
024f1d7af2
commit
e2b0fac59e
|
@ -1,6 +1,6 @@
|
||||||
class window.Player
|
class window.Player
|
||||||
|
|
||||||
bar_width: 330
|
bar_width: 263
|
||||||
jp: null
|
jp: null
|
||||||
scrobbled: false
|
scrobbled: false
|
||||||
albums: []
|
albums: []
|
||||||
|
@ -31,7 +31,7 @@ class window.Player
|
||||||
@jp.bind $.jPlayer.event.timeupdate, (e) ->
|
@jp.bind $.jPlayer.event.timeupdate, (e) ->
|
||||||
data = e.jPlayer.status
|
data = e.jPlayer.status
|
||||||
if not _player.scrobbled and data.currentPercentAbsolute > 50
|
if not _player.scrobbled and data.currentPercentAbsolute > 50
|
||||||
$obj = $('.playlist-tracks li.now')
|
$obj = $('.playlist li.now')
|
||||||
self.scrobble $obj.attr('data-artist'), $obj.attr('data-album'), $obj.attr('data-track')
|
self.scrobble $obj.attr('data-artist'), $obj.attr('data-album'), $obj.attr('data-track')
|
||||||
_player.scrobbled = true
|
_player.scrobbled = true
|
||||||
$('.player .progress .loaded').width(data.seekPercent * self.bar_width / 100)
|
$('.player .progress .loaded').width(data.seekPercent * self.bar_width / 100)
|
||||||
|
@ -43,7 +43,7 @@ class window.Player
|
||||||
$('#jplayer').jPlayer 'clearMedia'
|
$('#jplayer').jPlayer 'clearMedia'
|
||||||
$('.player .now-playing').html 'Nothing left to <strike>lose</strike> play'
|
$('.player .now-playing').html 'Nothing left to <strike>lose</strike> play'
|
||||||
$('.player .loaded, .player .played').width 0
|
$('.player .loaded, .player .played').width 0
|
||||||
$('.playlist-tracks li').removeClass 'now'
|
$('.playlist li').removeClass 'now'
|
||||||
else
|
else
|
||||||
self.setTrack next
|
self.setTrack next
|
||||||
false
|
false
|
||||||
|
@ -111,47 +111,47 @@ class window.Player
|
||||||
|
|
||||||
nextTrack: (manual) ->
|
nextTrack: (manual) ->
|
||||||
manual = manual?
|
manual = manual?
|
||||||
cnt = $('.playlist-tracks li').length
|
cnt = $('.playlist li').length
|
||||||
if not this.onShuffle() # Shuffle off
|
if not this.onShuffle() # Shuffle off
|
||||||
if $('.playlist-tracks .now').next().length == 0 # Last track and repeat is on
|
if $('.playlist .now').next().length == 0 # Last track and repeat is on
|
||||||
if _player.onRepeat() or manual # Repeat or manual click
|
if _player.onRepeat() or manual # Repeat or manual click
|
||||||
return $('.playlist-tracks li').first().attr('id').split('i')[1]
|
return $('.playlist li').first().attr('id').split('i')[1]
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
else
|
else
|
||||||
return $('.playlist-tracks .now').next().attr('id').split('i')[1]
|
return $('.playlist .now').next().attr('id').split('i')[1]
|
||||||
else if cnt == 1 # Single track in the playlist
|
else if cnt == 1 # Single track in the playlist
|
||||||
return $('.playlist-tracks li').first().attr('id').split('i')[1]
|
return $('.playlist li').first().attr('id').split('i')[1]
|
||||||
else # Shuffle on
|
else # Shuffle on
|
||||||
while true
|
while true
|
||||||
rnd = Math.floor(Math.random() * (cnt + .999))
|
rnd = Math.floor(Math.random() * (cnt + .999))
|
||||||
$li = $('.playlist-tracks li').eq rnd
|
$li = $('.playlist li').eq rnd
|
||||||
if $li.length > 0 and not $li.hasClass 'now'
|
if $li.length > 0 and not $li.hasClass 'now'
|
||||||
return $li.attr('id').split('i')[1]
|
return $li.attr('id').split('i')[1]
|
||||||
false
|
false
|
||||||
|
|
||||||
prevTrack: ->
|
prevTrack: ->
|
||||||
cnt = $('.playlist-tracks li').length
|
cnt = $('.playlist li').length
|
||||||
if not _player.onShuffle() # Shuffle off
|
if not _player.onShuffle() # Shuffle off
|
||||||
if $('.playlist-tracks .now').prev().length == 0 # First track in the playlist
|
if $('.playlist .now').prev().length == 0 # First track in the playlist
|
||||||
return $('.playlist-tracks li').last().attr('id').split('i')[1]
|
return $('.playlist li').last().attr('id').split('i')[1]
|
||||||
else
|
else
|
||||||
return $('.playlist-tracks .now').prev().attr('id').split('i')[1]
|
return $('.playlist .now').prev().attr('id').split('i')[1]
|
||||||
else if cnt == 1 # Single track in the playlist
|
else if cnt == 1 # Single track in the playlist
|
||||||
return $('.playlist-tracks li').first().attr('id').split('i')[1]
|
return $('.playlist li').first().attr('id').split('i')[1]
|
||||||
else # Shuffle on
|
else # Shuffle on
|
||||||
while true
|
while true
|
||||||
rnd = Math.floor(Math.random() * (cnt + .999))
|
rnd = Math.floor(Math.random() * (cnt + .999))
|
||||||
$li = $('.playlist-tracks li').eq rnd
|
$li = $('.playlist li').eq rnd
|
||||||
if $li.length > 0 and not $li.hasClass 'now'
|
if $li.length > 0 and not $li.hasClass 'now'
|
||||||
return $li.attr('id').split('i')[1]
|
return $li.attr('id').split('i')[1]
|
||||||
false
|
false
|
||||||
|
|
||||||
onShuffle: ->
|
onShuffle: ->
|
||||||
return $('#shuffle').hasClass 'active'
|
#return $('#shuffle').hasClass 'active'
|
||||||
|
|
||||||
onRepeat: ->
|
onRepeat: ->
|
||||||
return $('#repeat').hasClass 'active'
|
#return $('#repeat').hasClass 'active'
|
||||||
|
|
||||||
updateNowListening: (artist, album, track) ->
|
updateNowListening: (artist, album, track) ->
|
||||||
if _session.getUser().lastfm_username
|
if _session.getUser().lastfm_username
|
||||||
|
@ -166,17 +166,17 @@ class window.Player
|
||||||
|
|
||||||
# Player Controls
|
# Player Controls
|
||||||
|
|
||||||
$('.player .controls .prev').live 'click', ->
|
$('.player .prev').live 'click', ->
|
||||||
_player.setTrack _player.prevTrack()
|
_player.setTrack _player.prevTrack()
|
||||||
false
|
false
|
||||||
|
|
||||||
$('.player .controls .next').live 'click', ->
|
$('.player .next').live 'click', ->
|
||||||
_player.setTrack _player.nextTrack(true)
|
_player.setTrack _player.nextTrack(true)
|
||||||
false
|
false
|
||||||
|
|
||||||
$('.player .play').live 'click', ->
|
$('.player .play').live 'click', ->
|
||||||
if $('.playlist-tracks li').length > 0 and not _player.hasTrack()
|
if $('.playlist li').length > 0 and not _player.hasTrack()
|
||||||
_player.setTrack $('.playlist-tracks li').first().attr('id').split('i')[1]
|
_player.setTrack $('.playlist li').first().attr('id').split('i')[1]
|
||||||
false
|
false
|
||||||
|
|
||||||
$('.player .progress').live 'click', (e) ->
|
$('.player .progress').live 'click', (e) ->
|
||||||
|
@ -191,7 +191,7 @@ $('#repeat, #shuffle').live 'click', ->
|
||||||
|
|
||||||
$('#empty-playlist').live 'click', ->
|
$('#empty-playlist').live 'click', ->
|
||||||
if confirm('Are you sure?')
|
if confirm('Are you sure?')
|
||||||
$('.playlist-tracks li').remove()
|
$('.playlist li').remove()
|
||||||
$('#jplayer').jPlayer 'clearMedia'
|
$('#jplayer').jPlayer 'clearMedia'
|
||||||
$('.player .now-playing').text 'Add some music to playlist'
|
$('.player .now-playing').text 'Add some music to playlist'
|
||||||
$('.player .loaded, .player .played').width 0
|
$('.player .loaded, .player .played').width 0
|
||||||
|
@ -199,7 +199,7 @@ $('#empty-playlist').live 'click', ->
|
||||||
|
|
||||||
# Playlist Actions
|
# Playlist Actions
|
||||||
|
|
||||||
$('.playlist-tracks li .fade, .playlist-tracks li .duration, .playlist-tracks li .remove').live 'mousemove mouseover mouseout', (e) ->
|
$('.playlist li .fade, .playlist li .duration, .playlist li .remove').live 'mousemove mouseover mouseout', (e) ->
|
||||||
if e.type in ['mouseover', 'mousemove'] and ($(window).width() - e.clientX) < 60
|
if e.type in ['mouseover', 'mousemove'] and ($(window).width() - e.clientX) < 60
|
||||||
$(this).parent().find('.duration').hide()
|
$(this).parent().find('.duration').hide()
|
||||||
$(this).parent().find('.remove').show()
|
$(this).parent().find('.remove').show()
|
||||||
|
@ -208,7 +208,7 @@ $('.playlist-tracks li .fade, .playlist-tracks li .duration, .playlist-tracks li
|
||||||
$(this).parent().find('.duration').show()
|
$(this).parent().find('.duration').show()
|
||||||
false
|
false
|
||||||
|
|
||||||
$('.playlist-tracks li .remove').live 'click', ->
|
$('.playlist li .remove').live 'click', ->
|
||||||
$li = $(this).parent().parent()
|
$li = $(this).parent().parent()
|
||||||
if $li.hasClass 'now'
|
if $li.hasClass 'now'
|
||||||
$('#jplayer').jPlayer 'clearMedia'
|
$('#jplayer').jPlayer 'clearMedia'
|
||||||
|
@ -217,7 +217,7 @@ $('.playlist-tracks li .remove').live 'click', ->
|
||||||
$li.remove()
|
$li.remove()
|
||||||
false
|
false
|
||||||
|
|
||||||
$('.playlist-tracks li .title .playtrack').live 'click', ->
|
$('.playlist li .title .playtrack').live 'click', ->
|
||||||
_player.setTrack $(this).parent().parent().parent().attr('id').split('i')[1]
|
_player.setTrack $(this).parent().parent().parent().attr('id').split('i')[1]
|
||||||
false
|
false
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ class window.Vkontakte
|
||||||
@api_id
|
@api_id
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
@qr = []
|
@qr = {}
|
||||||
|
|
||||||
window.vkAsyncInit = ->
|
window.vkAsyncInit = ->
|
||||||
VK.init apiId: _vkontakte.getApiId()
|
VK.init apiId: _vkontakte.getApiId()
|
||||||
|
@ -118,11 +118,11 @@ class window.Vkontakte
|
||||||
return best_result.url
|
return best_result.url
|
||||||
|
|
||||||
addQR: (query, url) ->
|
addQR: (query, url) ->
|
||||||
@qr[query] = url;
|
_vkontakte.qr[query] = url;
|
||||||
|
|
||||||
getQR: (query) ->
|
getQR: (query) ->
|
||||||
if @qr[query]?
|
if _vkontakte.qr[query]?
|
||||||
@qr[query]
|
_vkontakte.qr[query]
|
||||||
false
|
false
|
||||||
|
|
||||||
$('#login').live 'click', ->
|
$('#login').live 'click', ->
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
.buttons {
|
.buttons {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.pause {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.now-playing {
|
.now-playing {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,9 +56,10 @@
|
||||||
.loaded
|
.loaded
|
||||||
.played
|
.played
|
||||||
.buttons
|
.buttons
|
||||||
%a.btn.small-round «
|
%a.btn.small-round.prev «
|
||||||
%a.btn.large.large-round ►
|
%a.btn.large.large-round.play ►
|
||||||
%a.btn.small-round »
|
%a.btn.large.large-round.pause II
|
||||||
|
%a.btn.small-round.next »
|
||||||
|
|
||||||
%ul.playlist
|
%ul.playlist
|
||||||
|
|
||||||
|
@ -67,3 +68,4 @@
|
||||||
= image_tag "loader.gif"
|
= image_tag "loader.gif"
|
||||||
|
|
||||||
#vk_api_transport
|
#vk_api_transport
|
||||||
|
#jplayer
|
||||||
|
|
Loading…
Reference in New Issue