From 6c42b98383d48f680ab584e077abd02e42cd2f39 Mon Sep 17 00:00:00 2001 From: magnolia-fan Date: Fri, 16 Sep 2011 05:57:41 +0400 Subject: [PATCH] Tons of little fixes --- app/assets/javascripts/beathaven.coffee | 2 +- .../javascripts/jquery/jquery.autocomplete.js | 6 ++- app/assets/javascripts/player.coffee | 44 +++++----------- app/assets/stylesheets/misc.scss | 4 -- app/assets/stylesheets/player.scss | 51 ++++++++++++++----- app/views/layouts/application.html.haml | 4 +- 6 files changed, 58 insertions(+), 53 deletions(-) diff --git a/app/assets/javascripts/beathaven.coffee b/app/assets/javascripts/beathaven.coffee index 702803d..3f31d0f 100644 --- a/app/assets/javascripts/beathaven.coffee +++ b/app/assets/javascripts/beathaven.coffee @@ -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 # Ширина списка diff --git a/app/assets/javascripts/jquery/jquery.autocomplete.js b/app/assets/javascripts/jquery/jquery.autocomplete.js index 9a08412..59e066d 100644 --- a/app/assets/javascripts/jquery/jquery.autocomplete.js +++ b/app/assets/javascripts/jquery/jquery.autocomplete.js @@ -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'); } }, diff --git a/app/assets/javascripts/player.coffee b/app/assets/javascripts/player.coffee index e6ed46c..7dc7f4a 100644 --- a/app/assets/javascripts/player.coffee +++ b/app/assets/javascripts/player.coffee @@ -56,15 +56,14 @@ class window.Player $('.playlist').append '
  • ' +item.duration+ '
    +
    remove
    ' +item.artist+ '
    ' +item.name+ '
  • ' _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 diff --git a/app/assets/stylesheets/misc.scss b/app/assets/stylesheets/misc.scss index 00c4e04..21d1b94 100644 --- a/app/assets/stylesheets/misc.scss +++ b/app/assets/stylesheets/misc.scss @@ -3,10 +3,6 @@ padding: 2px 9px !important; font-size: 18px !important; } -.large-round { - border-radius: 21px !important; - padding: 11px 11px 11px 15px !important; -} .popover-wrapper { display: none; diff --git a/app/assets/stylesheets/player.scss b/app/assets/stylesheets/player.scss index 432d9ce..e05dac4 100644 --- a/app/assets/stylesheets/player.scss +++ b/app/assets/stylesheets/player.scss @@ -1,8 +1,17 @@ .player { .buttons { text-align: center; + height: 36px; + } + .play { + border-radius: 21px !important; + padding: 11px 11px 11px 15px !important; + margin-top: -10px !important; } .pause { + font-weight: bold; + border-radius: 21px !important; + padding: 11px 16px 11px 16px !important; display: none; } .now-playing { @@ -10,16 +19,17 @@ } .progress { width: 94%; - margin: 0 0 10px 3%; - height: 7px; + margin: 0 0 18px 3%; + height: 5px; background-color: #e0e0e0; .loaded { width: 66%; - height: 7px; - background-color: #70c0c0; + height: 5px; + background-color: #d0e0e0; + cursor: pointer; .played { width: 66%; - height: 7px; + height: 5px; background-color: #0090AA; } } @@ -30,28 +40,43 @@ margin: 20px 0 0 0; li { list-style: none; + background-color: #ffffff; border-bottom: #DDD 1px solid; .drag { float: left; - margin: 3px 0 0 -3px; - width: 5px; - height: 32px; - background-color: #DDD; + margin: 11px 0 0 -6px; + width: 15px; + height: 26px; + background: url("/assets/drag.png"); cursor: pointer; } .artist-name { - font-size: 10px; - margin: 5px 0 0 5px; + font-size: 11px; + margin: 0 0 0 5px; + padding: 5px 0 0 0; } .song-title { margin: 0 0 5px 5px; } .song-duration { float: right; - margin: 10px 5px 0 0; + margin: 15px 5px 0 0; + } + .remove { + display: none; + font-size: 11px; + line-height: 11px; + color: #fffafa; + background-color: #cc9090; + border: #bb8080 1px solid; + border-radius: 3px; + padding: 0 3px 2px 3px; + float: right; + margin: 16px 5px 0 0; + cursor: pointer; } &.now { - background-color: #DEF; + background-color: #EAF5FF; } } } \ No newline at end of file diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 0d3e402..aa5867d 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -57,8 +57,8 @@ .played .buttons %a.btn.small-round.prev « - %a.btn.large.large-round.play ► - %a.btn.large.large-round.pause II + %a.btn.large.play ► + %a.btn.large.pause II %a.btn.small-round.next » %ul.playlist