From 2f4411472a04948e0b74a589cd9666427379f30e Mon Sep 17 00:00:00 2001 From: magnolia-fan Date: Thu, 16 Jun 2011 04:19:40 +0400 Subject: [PATCH] Fucking solved that scroll height bug --- public/demo/index.html | 4 +++- public/demo/search.html | 13 ------------- public/javascripts/beathaven/ajax.js | 20 +++++++++++++++++--- public/javascripts/beathaven/layout.js | 19 +++++++++++++++++++ public/javascripts/beathaven/pages.js | 3 ++- public/javascripts/jquery/jquery.scroll.js | 2 +- public/stylesheets/albums.css | 2 ++ public/stylesheets/misc.css | 6 ++++++ 8 files changed, 50 insertions(+), 19 deletions(-) diff --git a/public/demo/index.html b/public/demo/index.html index 14799cf..0d1a0f1 100644 --- a/public/demo/index.html +++ b/public/demo/index.html @@ -57,7 +57,9 @@ -
+
+
+
diff --git a/public/demo/search.html b/public/demo/search.html index c0d3470..a7effbf 100644 --- a/public/demo/search.html +++ b/public/demo/search.html @@ -1,16 +1,3 @@ -
diff --git a/public/javascripts/beathaven/ajax.js b/public/javascripts/beathaven/ajax.js index 7f5bccf..f8806c2 100644 --- a/public/javascripts/beathaven/ajax.js +++ b/public/javascripts/beathaven/ajax.js @@ -14,25 +14,39 @@ var Ajax = { return false; } Pages.renderArtist(data); + beathaven.redrawScrollbar(); }) }, loadSearchPage: function() { Ajax.setArchor('/search/'); $.get('/demo/search.html', function(data){ - $('#data-container').html(data); + $('#data-container .inner').html(data); + beathaven.redrawScrollbar(); + $('#search_field').autocomplete({ + serviceUrl: '/artist/autocomplete', // Страница для обработки запросов автозаполнения + minChars: 2, // Минимальная длина запроса для срабатывания автозаполнения + delimiter: /(,|;)\s*/, // Разделитель для нескольких запросов, символ или регулярное выражение + maxHeight: 400, // Максимальная высота списка подсказок, в пикселях + width: 415, // Ширина списка + zIndex: 9999, // z-index списка + deferRequestBy: 150, // Задержка запроса (мсек) + onSelect: Ajax.loadArtistData + }); + $('#search_field').focus(); }) }, loadWheePage: function() { $.get('/demo/whee.html', function(data){ - $('#data-container').html(data); + $('#data-container .inner').html(data); }) }, load404Page: function() { $.get('/demo/404.html', function(data){ - $('#data-container').html(data); + $('#data-container .inner').html(data); + beathaven.redrawScrollbar(); }) }, diff --git a/public/javascripts/beathaven/layout.js b/public/javascripts/beathaven/layout.js index ed8aea8..a3fcbda 100644 --- a/public/javascripts/beathaven/layout.js +++ b/public/javascripts/beathaven/layout.js @@ -1,20 +1,39 @@ $(function(){ beathaven.init(); $(window).resize(beathaven.adjustSizes) + window.setTimeout(beathaven.checkRedrawScrollbar, 500); }) var beathaven = { + last_height: false, + init: function () { this.drawInterface(); this.adjustSizes(); Ajax.detectStartPage(); }, + drawInterface: function() { }, + adjustSizes: function() { $('#data-container').height($(window).height() - $('#header-container').height()); $('#data-container').width($(window).width() - $('#player').width()).scrollbar(); $('#player-container').height($(window).height()); $('#playlist').height($(window).height() - $('#player').height()).scrollbar(); + }, + + checkRedrawScrollbar: function() { + var outer_height = $('#data-container > div').outerHeight(); + if (outer_height > 300 && outer_height != beathaven.last_height) { + beathaven.last_height = outer_height; + beathaven.redrawScrollbar(); + } + window.setTimeout(beathaven.checkRedrawScrollbar, 500); + }, + + redrawScrollbar: function() { + $('#data-container').html($('#data-container').find('.inner').first()); + $('#data-container').scrollbar(); } } \ No newline at end of file diff --git a/public/javascripts/beathaven/pages.js b/public/javascripts/beathaven/pages.js index 8379795..363047d 100644 --- a/public/javascripts/beathaven/pages.js +++ b/public/javascripts/beathaven/pages.js @@ -30,6 +30,7 @@ var Pages = { \
\ \ +
\ '); $.each(album.tracks.album, function(i, track){ @@ -51,6 +52,6 @@ var Pages = { } }) - $('#data-container').html('').append(artist_info).append(albums_info).scrollbar(); + $('#data-container .inner').html('').append(artist_info).append(albums_info); } } \ No newline at end of file diff --git a/public/javascripts/jquery/jquery.scroll.js b/public/javascripts/jquery/jquery.scroll.js index 257b2b3..87b6b86 100755 --- a/public/javascripts/jquery/jquery.scroll.js +++ b/public/javascripts/jquery/jquery.scroll.js @@ -257,7 +257,7 @@ // min- and max-range for handle this.props.handleTop = { min: 0, - max: this.props.handleContainerHeight - this.props.handleHeight + max: (this.props.handleContainerHeight - this.props.handleHeight) }; // ratio of handle-container-height to content-container-height (to calculate position of content related to position of handle) diff --git a/public/stylesheets/albums.css b/public/stylesheets/albums.css index 3e1d390..bbe73f5 100644 --- a/public/stylesheets/albums.css +++ b/public/stylesheets/albums.css @@ -3,10 +3,12 @@ width: 100%; float: left; margin: 0 0 25px 0; + clear: both; } .albums { width: 100%; float: left; + clear: both; } /* Artist info block */ diff --git a/public/stylesheets/misc.css b/public/stylesheets/misc.css index 9fe4d51..c1ac1d0 100644 --- a/public/stylesheets/misc.css +++ b/public/stylesheets/misc.css @@ -124,6 +124,12 @@ #error_page span { font-size: 24px; } + +.kaboom { + width: 100%; + height: 30px; + clear: both; +} /* Colorizing * #player-container { background-color: #CFC; }