Compare commits

...

3 Commits

Author SHA1 Message Date
Wirlaburla
5218286e53 fix styles some more 2023-01-08 23:57:46 -06:00
Wirlaburla
eda5b12ca6 fix styles 2023-01-08 23:56:04 -06:00
Wirlaburla
85ae86ddd3 add mute for volume icon 2023-01-08 23:46:58 -06:00
3 changed files with 51 additions and 17 deletions

View File

@ -25,8 +25,9 @@
<button title='Play' class='play' onclick='play()'><img src='play.png'></button> <button title='Play' class='play' onclick='play()'><img src='play.png'></button>
<button title='Stop' onclick='stop()'><img src='stop.png'></button> <button title='Stop' onclick='stop()'><img src='stop.png'></button>
<button style='flex-grow:1;pointer-events:none;'></button> <button style='flex-grow:1;pointer-events:none;'></button>
<slider title='100%'><img src='vol.png'><input type=range min=0 max=100 value=100 step=5 oninput="volChange(this)"></slider> <button title='Mute/Unmute' class='volume' onclick='mute()'><img src='vol.png'></button>
<button class='fav-button' title='Favorite' onclick='favoriteCurrentTrack()'><img src='heart.png'></button> <slider title='100%' class='volslider'><input type=range min=0 max=100 value=100 step=5 oninput="volChange(this)"></slider>
<button class='fav-button' title='Favorite' onclick='updateFavStatus(favoriteTrack(station.listen_url, station.title));'><img src='heart.png'></button>
</controls> </controls>
</player> </player>
</div> </div>

View File

@ -1,6 +1,4 @@
:root { :root {
--background: #b3a99e;
--primary: #0079b5; --primary: #0079b5;
--primary-border: #009ae6; --primary-border: #009ae6;
@ -26,7 +24,7 @@ html {
} }
body { body {
background: var(--background); background: var(--background-image) var(--main-background);
background-repeat: repeat; background-repeat: repeat;
height: 100%; height: 100%;
margin: 0; margin: 0;
@ -95,18 +93,18 @@ slider input {
background: lightgray; background: lightgray;
-webkit-appearance: none; -webkit-appearance: none;
appearance: none; appearance: none;
height: 4px; height: 50%;
margin: 6 2; margin: auto 4px;
width: 96px; width: 96px;
} }
slider input::-moz-range-thumb, slider input::-webkit-slider-thumb,
slider input::-webkit-slider-thumb { slider input::-moz-range-thumb {
background: gray; background: gray;
-webkit-appearance: none; -webkit-appearance: none;
appearance: none; appearance: none;
width: 8px; width: 8px;
height: 16px; height: 100%;
border: none; border: none;
border-radius: 0; border-radius: 0;
} }
@ -282,13 +280,15 @@ history .track a {
favorites, history { favorites, history {
height: 240px; height: 240px;
} }
body.old panel#favorites, body.old panel#history { display: none; }
} }
@media only screen and (orientation: landscape) { @media only screen and (orientation: landscape) {
.container, .footer { .container, .footer {
width: calc(100% - 64px); width: calc(100% - 64px);
height: calc(100% - 212px);
} }
body:not(.old) .container { height: calc(100% - 212px); }
.banner { .banner {
margin: auto; margin: auto;
@ -301,4 +301,23 @@ history .track a {
.player-container { .player-container {
margin-top: 48px; margin-top: 48px;
} }
/* OLD */
body.old .container, body.old .footer {
flex-direction: column;
width: 320px;
}
body.old .banner { flex-direction: column-reverse; }
body.old .banner img, body.old .player-container {
margin: auto;
}
body.old .banner > img { flex-shrink: 0; }
body.old .player-container { margin-bottom: -2px; }
body.old panel {
max-height: 480px;
}
body.old panel#favorites, body.old panel#history { display: none; }
} }

View File

@ -34,6 +34,7 @@ var tuner = {
player: null, player: null,
playing: true, playing: true,
volume: 100, volume: 100,
isMuted: false,
canvas: { canvas: {
element: null, element: null,
drawRequest: 0 drawRequest: 0
@ -119,6 +120,25 @@ function stop() {
updateMetadata(''); updateMetadata('');
} }
function mute() {
if (tuner.isMuted) {
document.querySelector('.volume').classList.remove('active');
document.querySelector('.volslider').title = tuner.volume+'%';
tuner.player.audioElement.volume=tuner.volume/100;
} else {
document.querySelector('.volume').classList.add('active');
document.querySelector('.volslider').title = "Muted";
tuner.player.audioElement.volume=0;
}
tuner.isMuted = !tuner.isMuted;
}
function volChange(e) {
tuner.player.audioElement.volume=e.value/100;
e.parentNode.title = e.value+'%';
tuner.volume = e.value;
}
function updateMetadata(track) { function updateMetadata(track) {
var line_data = [ var line_data = [
{ {
@ -381,12 +401,6 @@ function searchFavorites(query) {
} }
} }
function volChange(e) {
tuner.player.audioElement.volume=e.value/100;
e.parentNode.title = e.value+'%';
tuner.volume = e.value;
}
function setVisMode(i) { function setVisMode(i) {
if (i > vis_modes.length) visualizer.mode = 1; if (i > vis_modes.length) visualizer.mode = 1;
else visualizer.mode = i; else visualizer.mode = i;