jQuery from CDN, work on search

This commit is contained in:
magnolia-fan
2011-07-04 19:09:44 +04:00
parent f92693d847
commit 495d0a08df
24 changed files with 235 additions and 924 deletions
+3 -6
View File
@@ -21,19 +21,16 @@ Ajax = (function() {
_search.hideSpinner();
_search.showError();
}
return _beathaven.redrawScrollbar();
_beathaven.redrawScrollbar();
} else {
_ajax.setArchor('/artist/' + name + '/');
return _pages.renderArtist(data);
_pages.renderArtist(data);
}
return _search.hideSpinner();
});
return false;
};
Ajax.prototype.loadSearchPage = function() {
$.get('/templates/search.html', function(data) {
_ajax.setArchor('/search/');
return _pages.renderSearch(_beathaven.localizeHTML($(data)));
});
return false;
};
Ajax.prototype.loadSettingsPage = function() {
+9 -1
View File
@@ -43,7 +43,7 @@ BeatHaven = (function() {
return false;
};
BeatHaven.prototype.adjustSizes = function() {
$('.data-container').height($(window).height() - $('.header-container').height());
$('.data-container').height($(window).height() - $('.header-container').height() - $('.pulldown').height());
$('.data-container').width($(window).width() - $('.player').width());
$('.player-container').height($(window).height());
$('.playlist').height($(window).height() - $('.player').height() - $('.player-container .additional-controls').height());
@@ -105,6 +105,14 @@ BeatHaven = (function() {
return id;
}
};
BeatHaven.prototype.pdShowSpinner = function() {
$('.pulldown').html('<div class="pd-spinner"><img src="/images/loader.gif" alt=""/></div>');
return false;
};
BeatHaven.prototype.pdHideSpinner = function() {
$('.pulldown').html('');
return false;
};
return BeatHaven;
})();
String.prototype.htmlsafe = function() {
+5 -11
View File
@@ -56,13 +56,9 @@ Pages = (function() {
return false;
};
Pages.prototype.renderSearch = function(data) {
$('.data-container').css({
background: 'url(/images/concrete_wall_2.png) 0 -30px repeat'
});
$('.data-container .inner').html(data);
$('.search-container').css('marginLeft', ($('.data-container').width() - 425) / 2 + 'px').css('marginTop', ($('.data-container').height() / 2 - 230) + 'px').height(($('.data-container').height() - $('#search_form').height()) / 2);
$('.pulldown').html(data);
setTimeout(function() {
$('#search_field').bh_autocomplete({
$('.search_field').first().bh_autocomplete({
serviceUrl: '/artist/autocomplete',
minChars: 2,
delimiter: /(,|;)\s*/,
@@ -71,13 +67,11 @@ Pages = (function() {
zIndex: 9999,
deferRequestBy: 500,
onSelect: function() {
return _ajax.loadArtistData($('#search_field').val());
return _ajax.loadArtistData($('.search_field').first().val());
}
});
return $('#search_field').focus();
}, 501);
yaCounter7596904.hit(_ajax.getAnchor(), 'Artist Search', _ajax.referer);
_ajax.setTitle('Artist Search');
return $('.search_field').first().focus();
}, 1);
return false;
};
Pages.prototype.renderSettings = function(data) {
+26 -10
View File
@@ -3,19 +3,19 @@ Search = (function() {
function Search() {}
Search.prototype.pics = [];
Search.prototype.showSpinner = function() {
$('.search-container input').attr({
$('.search-container input').first().attr({
disabled: 'disabled'
}).blur();
$('.search-container img').show();
$('.search-container img').first().show();
$('.autocomplete-container').hide();
$('.artist_loading.failed').hide();
$('.artist_loading.failed').first().hide();
this.hideSuggestions();
return false;
};
Search.prototype.hideSpinner = function() {
$('.search-container input').removeAttr('disabled');
$('.search_field').focus();
$('.search-container img').hide();
$('.search-container input').first().removeAttr('disabled');
$('.search_field').first().focus();
$('.search-container img').first().hide();
return false;
};
Search.prototype.showSuggestions = function(values) {
@@ -59,16 +59,32 @@ Search = (function() {
return Search;
})();
$('.search').live('click', function() {
_ajax.go('/search/');
if ($('.pulldown').css('display') === 'none') {
$('.pulldown').width($('.data-container').width() - 50);
$('.pulldown').height(300);
$('.pulldown').slideDown('fast', function() {
var data;
data = '<div class="search-container">' + $('.subpages .search-container').html() + '</div>';
_pages.renderSearch(_beathaven.localizeHTML($(data)));
_beathaven.adjustSizes();
return _beathaven.redrawScrollbar();
});
} else {
$('.pulldown').slideUp('fast', function() {
$('.pulldown').height(0);
_beathaven.adjustSizes();
return _beathaven.redrawScrollbar();
});
}
return false;
});
$('#search_form').live('submit', function() {
$('.search_form').live('submit', function() {
$('.autocomplete-container').remove();
_ajax.loadArtistData($('#search_field').val());
_ajax.loadArtistData($('.search_field').first().val());
return false;
});
$('.suggestions a').live('click', function() {
$('#search_field').val($(this).text());
$('.search_field').first().val($(this).text());
return false;
});
$('.data.artist').live('click', function() {