Added the ability to use different radio stations
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
parent
7107d7e464
commit
ba9dd452f2
@ -1,5 +1,25 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {String} parameterName - Variable name
|
||||||
|
* @returns {String} Value of variable
|
||||||
|
* @description Searches for the value of the GET variable on the page.
|
||||||
|
*/
|
||||||
|
function findGetParameter(parameterName) {
|
||||||
|
var result = null;
|
||||||
|
var tmp = [];
|
||||||
|
|
||||||
|
var items = window.location.search.substr(1).split('&');
|
||||||
|
for (var index = 0; index < items.length; index++) {
|
||||||
|
tmp = items[index].split('=');
|
||||||
|
if (tmp[0] === parameterName) {
|
||||||
|
result = decodeURIComponent(tmp[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} artistTrack - Artist of the track
|
* @param {String} artistTrack - Artist of the track
|
||||||
* @param {String} titleTrack - Name of the track
|
* @param {String} titleTrack - Name of the track
|
||||||
@ -14,8 +34,8 @@ function updateData(artistTrack, titleTrack) {
|
|||||||
|
|
||||||
if (artistElement.textContent !== artistTrack || titleElement.textContent !== titleTrack) {
|
if (artistElement.textContent !== artistTrack || titleElement.textContent !== titleTrack) {
|
||||||
/* Updates text */
|
/* Updates text */
|
||||||
artistElement.innerHTML = artistTrack;
|
artistElement.textContent = artistTrack;
|
||||||
titleElement.innerHTML = titleTrack;
|
titleElement.textContent = titleTrack;
|
||||||
|
|
||||||
/* Displays a pop-up window */
|
/* Displays a pop-up window */
|
||||||
displayElement.style['animation-name'] = 'fadeIn';
|
displayElement.style['animation-name'] = 'fadeIn';
|
||||||
@ -28,7 +48,8 @@ function updateData(artistTrack, titleTrack) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var client = new XMLHttpRequest();
|
var client = new XMLHttpRequest();
|
||||||
var url = 'https://somafm.com/songs/defcon.xml';
|
var radio = findGetParameter('radio');
|
||||||
|
var url = '//somafm.com/songs/' + radio + '.xml';
|
||||||
|
|
||||||
/* Processes response */
|
/* Processes response */
|
||||||
client.onload = function () {
|
client.onload = function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user