Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function () {
- function wrap_list_input() {
- $('.thumbsU').html(0);
- $('.thumbsD').html(0);
- $('.likes').attr('data-postid', 0);
- $('.top').attr('data-postid', 0);
- $('.top').attr('data-score', 0);
- $('.bottom').attr('data-postid', 0);
- $('.bottom').attr('data-score', 0);
- $('.player .img img').fadeOut('slow', function () {
- $('.player .img img').attr('src', artistTrack);
- $('.player .img img').fadeIn('slow');
- });
- $('.comingUp span').html("");
- /** @type {number} */
- currentRelations = 0;
- /** @type {number} */
- newPath = 0;
- /** @type {number} */
- outFile = 0;
- }
- var result;
- var artistTrack = "images/logo.png";
- /** @type {boolean} */
- var _0x8879x4 = true;
- /** @type {number} */
- var currentRelations = 0;
- /** @type {number} */
- var newPath = 0;
- /** @type {number} */
- var outFile = 0;
- startRadio();
- $('#coveriTunes').click(function () {
- if (result != undefined) {
- window.open(result);
- return false;
- }
- });
- if (_0x8879x4 == true) {
- $('.top').click(function () {
- var addedRelations = currentRelations;
- var origNewPath = newPath;
- if (!($(this).parent().hasClass('.disabled'))) {
- if ($(this).data('action') == 'up') {
- $(this).parent().find('.thumbsU').html(++origNewPath);
- $('.player .img img').attr('src', 'images/thankyou.png');
- $('.comingUp span').html("Voto registado. Gracias.");
- $.ajax({
- data: {
- "postid": addedRelations,
- "action": 'up'
- }
- });
- }
- } else {
- $('.comingUp span').html('Un solo voto basta. Gracias.');
- }
- });
- $('.bottom').click(function () {
- var addedRelations = currentRelations;
- var originalOutFile = outFile;
- if (!($(this).parent().hasClass('.disabled'))) {
- if ($(this).data('action') == "down") {
- $(this).parent().find('.thumbsD').html(++originalOutFile);
- $('.player .img img').attr('src', 'images/thankyou.png');
- $('.comingUp span').html("Voto registado. Gracias");
- $.ajax({
- data: {
- "postid": addedRelations,
- "action": 'down'
- }
- });
- }
- } else {
- $('.comingUp span').html("Un solo voto basta. Gracias.");
- }
- });
- }
- $('.controls').on('click', '.play', function () {
- $(this).addClass('pause');
- $(this).removeClass('play');
- });
- $('.controls').on('click', '.pause', function () {
- $(this).removeClass('pause');
- $(this).addClass('play');
- });
- $('.controls').on('click', '.muteoff', function () {
- $(this).removeClass('muteoff');
- $(this).addClass('muteon');
- });
- $('.controls').on('click', '.muteon', function () {
- $(this).removeClass('muteon');
- $(this).addClass('muteoff');
- });
- });
- /**
- * @return {undefined}
- */
- function startRadio() {
- $('#playBtn').hide();
- grabRadioInfo();
- /** @type {number} */
- radioInfoInterval = setInterval(grabRadioInfo, 25E3);
- }
- /**
- * @return {undefined}
- */
- function grabRadioInfo() {
- var requestOrUrl = 'song.php';
- $.ajax({
- type: "POST",
- url: requestOrUrl,
- data: {},
- dataType: "xml",
- success: function (str) {
- xmldoc = $(str);
- xmldoc.find('data').each(function (canCreateDiscussions, delete_behavior_form) {
- key = $(delete_behavior_form).find('name').text();
- val = $(delete_behavior_form).find('value').text();
- if (key == "Current Song") {
- var _alarm = val.split('-');
- var _0x8879x17 = _alarm[0] != undefined ? _alarm[0] : "";
- var _0x8879x18 = _alarm[1] != undefined ? _alarm[1] : "";
- var _0x8879x19 = $('#artist').text();
- $('#song').text(_0x8879x18.trim());
- if (_0x8879x19 != _0x8879x17.trim()) {
- $('#artist').text(_0x8879x17.trim());
- Album(_0x8879x17.trim());
- }
- }
- });
- },
- error: function (deleted_model, err, op) {
- if (deleted_model.readyState == 4) {
- $('#artist').text('Musica');
- $('#song').text('various artistas');
- Album("");
- } else {
- if (deleted_model.readyState == 0) {
- } else {
- }
- }
- }
- });
- }
- /**
- * @param {?} amgArtistId
- * @return {undefined}
- */
- function Album(amgArtistId) {
- var requestOrUrl = "https://ws.audioscrobbler.com/2.0/";
- if (location.protocol == "http:") {
- requestOrUrl = requestOrUrl.replace('https:', 'http:');
- } else {
- requestOrUrl = requestOrUrl.replace('http:', 'https:');
- }
- art = amgArtistId.trim();
- $.ajax({
- url: requestOrUrl,
- data: {
- method: "artist.getinfo",
- artist: art,
- api_key: "4d8eb4ccf7af1cfb1edcc6e70c5a262b",
- format: "json"
- },
- dataType: "json",
- success: function (inRevIdx) {
- bg_image = "images/nocover.jpg";
- if (inRevIdx.artist == undefined) {
- $('#artwork').attr('src', artistTrack);
- $('#artwork').attr('src', 'images/nocover.jpg');
- } else {
- var artistTrack = inRevIdx.artist.image[2]["#text"];
- if (location.protocol == "http:") {
- artistTrack = artistTrack.replace('https:', 'http:');
- } else {
- artistTrack = artistTrack.replace('http:', 'https:');
- }
- if (artistTrack.trim() != "") {
- $('#artwork').attr('src', artistTrack);
- bg_image = artistTrack;
- } else {
- $('#artwork').attr('src', 'images/nocover.jpg');
- bg_image = 'images/nocover.jpg';
- }
- }
- $('#artwork').css('background-repeat', 'no-repeat');
- $('#artwork').fadeOut(1E3, function () {
- $('#artwork').css('background', 'url("' + bg_image +'")');
- //todo bien
- $('#artwork').css('background-size', 'cover');
- $('#artwork').fadeIn(1E3, function () {
- $('#artwork').css('background-size', 'cover');
- });
- });
- $('#artwork').css('background-position', '-100px -100px');
- artistTrack = document.createElement('img');
- artistTrack.setAttribute('crossorigin', "");
- artistTrack.src = bg_image;
- artistTrack.style.display = "none";
- document.body.appendChild(artistTrack);
- /** @type {number} */
- var deltaY = 0;
- /**
- * @return {undefined}
- */
- artistTrack.onload = function () {
- var a = document.createElement('canvas');
- a.width = this.width;
- a.height = this.height;
- var globalAjaxOptions = a.getContext('2d');
- globalAjaxOptions.drawImage(this, 0, 0);
- var test_data = globalAjaxOptions.getImageData(0, 0, a.width, a.height);
- var data = test_data.data;
- var offset;
- var musicplaylistload;
- var name;
- var acceleration;
- /** @type {number} */
- for (i=0; i < data.length; i = i + 4) {
- offset = data[i];
- musicplaylistload = data[i + 1];
- name = data[i + 2];
- acceleration = Math.floor((offset + musicplaylistload + name) / 3);
- deltaY = deltaY + acceleration;
- }
- var rule_id = Math.floor(Math.random() * 999999 + 5);
- if (Math.floor(deltaY / (this.width * this.height)) > 170) {
- var filter_value_container_id = "js/dark.css?r=" + rule_id;
- $('#pstyle[rel=stylesheet]').attr('href', filter_value_container_id);
- } else {
- filter_value_container_id = "js/dark.light?r=" + rule_id;
- $('#pstyle[rel=stylesheet]').attr('href', filter_value_container_id);
- }
- };
- }
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement