28 lines
608 B
JavaScript
28 lines
608 B
JavaScript
function authInfo(response) {
|
|
if (typeof response != 'undefined' && response.session) {
|
|
$('#vk_login').hide();
|
|
$('#vk_logout').show();
|
|
} else {
|
|
$('#vk_login').show();
|
|
$('#vk_logout').hide();
|
|
}
|
|
}
|
|
$(function(){
|
|
VK.init({
|
|
apiId: 2335068,
|
|
nameTransportPath: "/demo/xd_receiver.html"
|
|
});
|
|
VK.Auth.getLoginStatus(authInfo);
|
|
$('#vk_login').click(function(){
|
|
VK.Auth.login(authInfo, 8);
|
|
});
|
|
$('#vk_logout').click(function(){
|
|
VK.Auth.logout(authInfo);
|
|
});
|
|
})
|
|
|
|
function loadTracksData(query, callback) {
|
|
VK.Api.call('audio.search', {q:query}, function(r){
|
|
callback(r.response[1].url);
|
|
})
|
|
} |