Search fixes

This commit is contained in:
magnolia-fan
2011-06-21 19:22:09 +04:00
parent 49f1fba33a
commit 1d9f527f39
5 changed files with 24 additions and 19 deletions
+11 -7
View File
@@ -1,5 +1,7 @@
var Search = {
pics: [],
showSpinner: function() {
$('#search-container input').attr('disabled', 'disabled').blur();
$('#search-container img').show();
@@ -31,13 +33,15 @@ var Search = {
showArtistPics: function(pics) {
$('.artist_loading, .artist_pics').show();
$('.artist_pics').html('');
for (var i = 0; i < pics.length; i++) {
$('.artist_pics').append('\
<div class="pic">\
<img src="'+ pics[i] +'" alt=""/>\
</div>\
');
for (var i = 0; i < pics.length; i++) {console.log(Search.pics.indexOf(pics[i]));
if (Search.pics.indexOf(pics[i]) === -1) {
Search.pics.push(pics[i]);
$('.artist_pics').append('\
<div class="pic">\
<img src="'+ pics[i] +'" alt=""/>\
</div>\
');
}
}
}
}
+3 -2
View File
@@ -26,7 +26,7 @@ function authInfo(response) {
$(function(){
VK.init({
apiId: (document.location.host == 'beathaven.org' ? 2335068 : 2383163),
nameTransportPath: "/demo/xd_receiver.html"
nameTransportPath: "/xd_receiver.html"
});
VK.Auth.getLoginStatus(authInfo);
$('#vk_login').click(function(){
@@ -38,7 +38,8 @@ $(function(){
})
function loadTracksData(artist, track, duration, callback) {
VK.Api.call('audio.search', {q: artist +' '+ track}, function(r){
track_prepared = track.replace(/\(.*\)/i, '');
VK.Api.call('audio.search', {q: artist +' '+ track_prepared}, function(r){
callback(matchPerfectResult(r.response, artist, track, duration));
})
}