Commit 2176fa15 authored by Sidorela Uku's avatar Sidorela Uku
Browse files

added code files

parent 63cdb5a4
MIT License
Copyright (c) 2019 Guilherme Sávio
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
@import url('https://fonts.googleapis.com/css?family=Share:400i,700i');
@import url('bootstrap.min.css');
html, body {
height: 100%;
}
body {
display: flex;
flex-flow: row;
justify-content: center;
overflow-x: hidden;
}
.cover-site {
min-width: 100%;
min-height: 100%;
position: fixed;
background: url('../img/background.jpg') no-repeat;
background-position: center;
background-size: cover;
transition: background-image 1s;
background-position: center;
background-attachment: fixed;
}
#bgCover {
min-width: 100%;
min-height: 100%;
position: absolute;
background-position: center;
background-size: cover;
transition: background-image 1s;
background-position: center;
background-attachment: fixed;
z-index: 1;
}
.bg-mask {
min-width: 100%;
min-height: 100%;
position: absolute;
background: radial-gradient(rgba(0, 0, 0, .5) 20%, #000 85%);
z-index: 2;
}
.web-player {
height: 100%;
color: #fff;
padding: 5px;
position: relative;
z-index: 3;
margin-top: 25px;
}
.cover-album {
margin: auto;
background: url('../img/bg-capa.png') no-repeat;
background-size: auto;
border: 1px solid #383838;
box-shadow: 0px 5px 10px 3px rgba(0, 0, 0, 0.4);
transition: background-image 1s;
margin-bottom: 15px;
}
.watermark {
width: 89px;
height: 35px;
background: url(../img/logo.png) no-repeat;
background-size: auto 35px;
opacity: 0.5;
position: relative;
bottom: 36px;
right: -1px;
z-index: 5;
}
#currentCoverArt {
width: 100%;
height: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
transition: background-image 1s;
}
.logo {
display: none;
}
.info-current-song {
text-align: center;
}
.info-current-song h2 {
font-size: 22px;
font-weight: 700;
}
.info-current-song h3 {
font-size: 18px;
font-weight: 400;
}
.play-pause {
font-size: 65px;
}
.play-pause i {
cursor: pointer;
}
.volume-icon {
font-size: 28px;
margin-top: -5px;
}
.volume-slide {
line-height: 35px;
}
.volume-control {
display: none;
}
.vagalume a {
color: #fff;
text-decoration: underline;
}
.lyrics {
text-transform: uppercase;
text-decoration: underline;
color: #fff;
font-size: 1em;
font-weight: 400;
outline: none;
transition: .3s;
}
.lyrics:active {
text-decoration: none;
color: #fff;
}
.lyrics:visited {
text-decoration: none;
color: #fff;
}
.modal-content {
background-color: rgba(0, 0, 0, 0.8);
color: #fff !important;
border-radius: 0;
}
.modal-content .btn {
border-radius: 0;
}
/* Chrome */
input[type=range] {
-webkit-appearance: none;
background: transparent;
width: 100%;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
background: #fff;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
height: 20px;
width: 20px;
border-radius: 50%;
background: #fff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -8px;
}
/* Firefox */
input[type=range]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
background: #fff;
}
input[type=range]::-moz-range-thumb {
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
border: 0px solid #000000;
height: 20px;
width: 20px;
border-radius: 50%;
background: #fff;
cursor: pointer;
}
/* IE e Edge */
input[type=range]::-ms-track {
width: 100%;
height: 5px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-color: transparent;
border-width: 10px 0;
top: -10px;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #fff;
border: 0px solid #000101;
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
}
input[type=range]::-ms-fill-upper {
background: #fff;
border: 0px solid #000101;
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
}
input[type=range]::-ms-thumb {
box-shadow: 0px 0px 0px #000000, 0px 0px 0px #0d0d0d;
border: 0px solid #000000;
height: 20px;
width: 20px;
border-radius: 50%;
background: #fff;
cursor: pointer;
}
.historic h2 {
color: #fff;
border-bottom: 2px solid #fff;
font-size: 16px;
font-weight: bold;
text-transform: uppercase;
margin: 10px 0;
}
.historic article {
margin: 5px 0;
}
.historic .cover-historic {
width: 95px;
height: 95px;
margin-right: 15px;
float: left;
background: url('../img/bg-capa.jpg') no-repeat;
background-size: cover;
border: 1px solid #383838;
box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.3);
transition: background-image 1s;
}
.historic .music-info {
color: #fff;
}
.historic .music-info .song {
width: 100%;
font-weight: bold;
font-size: 20px;
text-transform: uppercase;
margin-bottom: -5px;
}
@media(max-width: 370px) {
.cover-album {
max-width: 100%;
}
}
@media(min-width: 576px) {
.volume-control {
display: flex;
}
.call-lyrics {
margin-top: 20px;
}
}
@media(min-width: 768px) {
body {
align-items: center;
}
.h1-logo {
text-align: center;
}
.logo {
display: block;
z-index: 2;
}
.logo img {
max-width: 200px;
}
.web-player {
height: auto;
margin-top: 0;
}
.cover-album {
margin: 10px auto;
min-width: 350px;
height: 320px;
}
.logo img {
max-width: 300px;
margin: 65px 0;
}
.info-current-song {
margin-top: 50px;
text-align: left;
}
.volume-control {
margin-top: 10%;
}
}
This diff is collapsed.
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>AlbaniaRadioDJ</title>
<meta name="description" content="AlbaniaRadioDJ">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#171717">
<meta property="og:url" content="https://albaniaradiodj.al/">
<meta property="og:title" content="I'm listening to AlbaniaRadioDJ!">
<meta property="og:site_name" content="albaniaradiodj">
<meta property="og:description" content="">
<meta property="og:image" content="img/bg-capa.jpg">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="512">
<meta property="og:image:height" content="512">
<link rel="icon" type="image/png" href="img/logo.png" />
<link rel="stylesheet" type="text/css" href="css/animate.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.2/css/all.min.css">
<style type="text/css">
.playButton[paused] {
background-image: url(http://radioblog.al/wp-content/themes/radioblog/img/play.png) !important;
}
</style>
</head>
<body>
<div class="cover-site">
<div id="bgCover"></div>
<div class="bg-mask"></div>
</div>
<main>
<section id="player">
<div class="container">
<div class="row web-player">
<div class="col-12 col-lg-10">
<div class="row">
<div class="col-12 col-md-5">
<img src="radio_dj_logo.png">
</div>
<div class="col-12 ml-md-auto col-md-6">
<div class="row">
<div class="col-12">
<div class="info-current-song">
<h2 id="currentSong" class="current-song text-uppercase">Nr 1 Radio Station</h2>
<h3 id="currentArtist" class="current-artist text-captalize">PLAYS EVERYWHERE</h3>
</div>
</div>
<div class="col-12">
<div class="row">
<div class="play-pause col-12 col-md-2 text-center">
<i id="playerButton" class="fa fa-play" onclick="togglePlay()"></i>
</div>
<div class="col-12 col-md-10 text-center">
<div class="row volume-control">
<div class="volume-icon col-1"><i class="fa fa-volume-up"></i></div>
<div class="volume-slide col-10 text-center"><input type="range" id="volume"
step="1" min="0" max="100" value="80"></div>
<div class="percentual-volume col-12">Volume <span id="volIndicator">...</span>%</div>
</div>
</div>
</div>
<div style="font-size: 1rem;font-weight: 400;line-height: 1.5;">Play</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row historic">
<div class="col-12">
<h2></h2>
<div class="row">
<article class="col-sm">
<a href="https://www.facebook.com/radiodj.tirana.1" target="_blank"><i class="fab fa-facebook" style="font-size: 40px;"></i></a>
</article>
<article class="col-sm">
<a href="https://www.instagram.com/radiodj98.2albania/" target="_blank"><i class="fab fa-instagram" style="font-size: 40px;"></i></a>
</article>
<article class="col-sm">
<a href="mailto:info@radiodj.tirana.1"><i class="fas fa-envelope" style="font-size: 40px;"></i></a>
</article>
</div>
</div>
</div>
</div>
</section>
</main>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
</body>
</html>
This diff is collapsed.
/*
The MIT License (MIT)
Copyright (c) 2017-2019 Guilherme Sávio
Github: https://github.com/gsavio
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
const RADIO_NAME = "Albania Radio DJ";
// URL of SHOUTCast streaming without / on the final, eg: http://streaming.com:8080
const URL_STREAMING = "http://185.32.20.10:7750";
// Visit https://api.vagalume.com.br/docs/ to get your API key
// Set HISTORIC to true to get the last songs played
const HISTORIC = true;
window.onload = function () {
var page = new Page;
page.changeTitlePage();
page.setVolume();
var player = new Player();
player.play();
getStreamingData();
// Interval to get streaming data in miliseconds
setInterval(function () {
getStreamingData();
}, 4000);
var coverArt = document.getElementsByClassName('cover-album')[0];
}
// DOM control
function Page() {
this.changeTitlePage = function (title = RADIO_NAME) {
document.title = title;
};
this.refreshCurrentSong = function (song, artist) {
var currentSong = document.getElementById('currentSong');
var currentArtist = document.getElementById('currentArtist');
if (song !== currentSong.innerHTML) {
// Animate transition
currentSong.className = 'animated flipInY text-uppercase';
currentSong.innerHTML = song;
currentArtist.className = 'animated flipInY text-capitalize';
currentArtist.innerHTML = artist;
// Refresh modal title
document.getElementById('lyricsSong').innerHTML = song + ' - ' + artist;
// Remove animation classes
setTimeout(function () {
currentSong.className = 'text-uppercase';
currentArtist.className = 'text-capitalize';
}, 2000);
}
}
this.refreshHistoric = function (info, n) {
var $historicDiv = document.querySelectorAll('#historicSong article');
var $songName = document.querySelectorAll('#historicSong article .music-info .song');
var $artistName = document.querySelectorAll('#historicSong article .music-info .artist');
// Default cover art
var urlCoverArt = 'img/bg-capa.jpg';
// Get cover art for song history
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
var data = JSON.parse(this.responseText);
var artworkUrl100 = (data.resultCount) ? data.results[0].artworkUrl100 : urlCoverArt;
document.querySelectorAll('#historicSong article .cover-historic')[n].style.backgroundImage = 'url(' + artworkUrl100 + ')';
}
// Formating characters to UTF-8
var music = info.song.replace(/&apos;/g, '\'');
var songHist = music.replace(/&amp;/g, '&');
var artist = info.artist.replace(/&apos;/g, '\'');
var artistHist = artist.replace(/&amp;/g, '&');
$songName[n].innerHTML = songHist;
$artistName[n].innerHTML = artistHist;
// Add class for animation
$historicDiv[n].classList.add('animated');
$historicDiv[n].classList.add('slideInRight');
}
xhttp.open('GET', 'https://itunes.apple.com/search?term=' + info.artist + ' ' + info.song + '&media=music&limit=1', true);
xhttp.send();
setTimeout(function () {
for (var j = 0; j < 2; j++) {
$historicDiv[j].classList.remove('animated');
$historicDiv[j].classList.remove('slideInRight');
}
}, 2000);
}
this.refreshCover = function (song = '', artist) {
// Default cover art
var urlCoverArt = 'img/bg-capa.jpg';
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
var coverArt = document.getElementById('currentCoverArt');
var coverBackground = document.getElementById('bgCover');
// Get cover art URL on iTunes API