diff --git a/src/js/plugins/vk.js b/src/js/plugins/vk.js index 2a7c3a8..3a8f0b0 100644 --- a/src/js/plugins/vk.js +++ b/src/js/plugins/vk.js @@ -7,46 +7,26 @@ var vk = Object.create(Plugin); vk.init("vk", "VK"); vk.scrape = function () { - function vknew() { - var info = { stopped: true }; - - var player = $("#top_audio_player"); - if(!player.length) { return info; } - - var playing = player.hasClass("top_audio_player_playing"); - if(!playing) { return info; } - - var title = - player - .find('.top_audio_player_title') - .text() - .split('–'); // Unicode: EN DASH - if(title.length != 2) { return info; } - - info.stopped = false; - info.artist = title[0]; - info.title = title[1]; - - return info; - } - - function vkold() { - var gpPlay = $("#gp_play"); - var isPlaying = gpPlay && gpPlay.hasClass("playing"); - var info = { - stopped: !isPlaying - }; - - if (isPlaying) { - info.artist = $("#gp_performer").text(); - info.title = $("#gp_title").text(); - } - - return info; - } - - var hostname = window.location.hostname; - return hostname.startsWith('new.vk') ? vknew() : vkold(); + var info = { stopped: true }; + + var player = $("#top_audio_player"); + if(!player.length) { return info; } + + var playing = player.hasClass("top_audio_player_playing"); + if(!playing) { return info; } + + var title = + player + .find('.top_audio_player_title') + .text() + .split('–'); // Unicode: EN DASH + if(title.length != 2) { return info; } + + info.stopped = false; + info.artist = title[0]; + info.title = title[1]; + + return info; }; module.exports = vk;