Tons of little fixes
This commit is contained in:
@@ -43,7 +43,7 @@ class window.BeatHaven
|
||||
setupAutocomplete: ->
|
||||
$('#search').first().bh_autocomplete
|
||||
serviceUrl: '/artist/autocomplete' # Страница для обработки запросов автозаполнения
|
||||
minChars: 2 # Минимальная длина запроса для срабатывания автозаполнения
|
||||
minChars: 3 # Минимальная длина запроса для срабатывания автозаполнения
|
||||
delimiter: /(,|;)\s*/ # Разделитель для нескольких запросов, символ или регулярное выражение
|
||||
maxHeight: 400 # Максимальная высота списка подсказок, в пикселях
|
||||
width: 415 # Ширина списка
|
||||
|
||||
@@ -248,7 +248,11 @@
|
||||
} else if (!this.isBadQuery(q)) {
|
||||
me = this;
|
||||
me.options.params.query = q;
|
||||
$.get(this.serviceUrl, me.options.params, function(txt) { me.processResponse(txt); }, 'text');
|
||||
$('#artist-load-spinner').show()
|
||||
$.get(this.serviceUrl, me.options.params, function(txt) {
|
||||
me.processResponse(txt);
|
||||
$('#artist-load-spinner').hide();
|
||||
}, 'text');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -56,15 +56,14 @@ class window.Player
|
||||
$('.playlist').append '
|
||||
<li id="i' +Math.round(Math.random() * 999999)+ '" data-id="'+item.id+'">
|
||||
<div class="song-duration">' +item.duration+ '</div>
|
||||
<div class="remove">remove</div>
|
||||
<div class="drag"></div>
|
||||
<div class="artist-name">' +item.artist+ '</div>
|
||||
<div class="song-title">' +item.name+ '</div>
|
||||
</li>'
|
||||
_player.playlist.push item
|
||||
$('.playlist').sortable axis: 'y', handle: '.drag'
|
||||
if autoplay?
|
||||
_player.setTrack($('.playlist li').last().attr('id').split('i')[1])
|
||||
else if initial_count == 0 and not _player.hasTrack()
|
||||
if initial_count == 0 and not _player.hasTrack()
|
||||
_player.setTrack($('.playlist li').first().attr('id').split('i')[1])
|
||||
false
|
||||
|
||||
@@ -199,26 +198,28 @@ $('#empty-playlist').live 'click', ->
|
||||
|
||||
# Playlist Actions
|
||||
|
||||
$('.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
|
||||
$(this).parent().find('.duration').hide()
|
||||
$('.playlist li .artist-name, .playlist li .song-title, .playlist li .song-duration, .playlist li .remove').live 'mousemove mouseover mouseout', (e) ->
|
||||
if e.type in ['mouseover', 'mousemove'] and ($(window).width() - e.clientX) < 60 +
|
||||
$(window).width() - $('.playlist').offset().left - $('.playlist').outerWidth()
|
||||
$(this).parent().find('.song-duration').hide()
|
||||
$(this).parent().find('.remove').show()
|
||||
else
|
||||
$(this).parent().find('.remove').hide()
|
||||
$(this).parent().find('.duration').show()
|
||||
$(this).parent().find('.song-duration').show()
|
||||
false
|
||||
|
||||
$('.playlist li .remove').live 'click', ->
|
||||
$li = $(this).parent().parent()
|
||||
$('.playlist li .remove').live 'click', (e) ->
|
||||
$li = $(this).parent()
|
||||
if $li.hasClass 'now'
|
||||
$('#jplayer').jPlayer 'clearMedia'
|
||||
$('.player .now-playing').text '...'
|
||||
$('.player .loaded, .player .played').width 0
|
||||
$li.remove()
|
||||
e.preventDefault()
|
||||
false
|
||||
|
||||
$('.playlist li .title .playtrack').live 'click', ->
|
||||
_player.setTrack $(this).parent().parent().parent().attr('id').split('i')[1]
|
||||
$('.playlist li').live 'click', ->
|
||||
_player.setTrack $(this).attr('id').split('i')[1]
|
||||
false
|
||||
|
||||
# Adding To Playlist actions
|
||||
@@ -231,24 +232,3 @@ $('.add-album').live 'click', ->
|
||||
item['album'] = album.name
|
||||
_player.addTracks album.tracks.album
|
||||
false
|
||||
|
||||
$('.add-track').live 'click', ->
|
||||
track = _player.getDataFromLi $(this).parent()
|
||||
track['artist'] = $('.artist-info .name').html()
|
||||
track['album'] = $(this).parent().parent().parent().parent().find('h2.name').text().replace /\s\([\d]{4}\)$/, ''
|
||||
_player.addTracks [track]
|
||||
false
|
||||
|
||||
$('.tracklist li').live 'mouseover mouseout', (e) ->
|
||||
if e.type == 'mouseover'
|
||||
$(this).find('.add-track').show()
|
||||
else
|
||||
$(this).find('.add-track').hide()
|
||||
false
|
||||
|
||||
$('.tracklist li').live 'click', (e) ->
|
||||
track = _player.getDataFromLi this
|
||||
track['artist'] = $('.artist-info .name').html()
|
||||
track['album'] = $(this).parent().parent().parent().find('h2.name').text().replace /\s\([\d]{4}\)$/, ''
|
||||
_player.addTracks [track], true
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user