-
Notifications
You must be signed in to change notification settings - Fork 32
/
index.html
309 lines (266 loc) · 16.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<!DOCTYPE html>
<html class="nojs" lang="en">
<head>
<title>Soma FM Player</title>
<meta charset="UTF-8" />
<meta http-equiv="x-ua-compatible" content="IE=Edge, chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" id="description" content="SPA audio player for the streaming stations provided by Soma FM." />
<meta name="author" content="Rainner Lins | @raintek_ | https://rainnerlins.com | https://github.com/rainner" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="prefetch" href="https://somafm.com/channels.json" />
<link rel="preconnect" href="https://ice1.somafm.com" />
<link rel="preconnect" href="https://cdnjs.cloudflare.com" />
<style type="text/css">
@keyframes _spin { 0% { transform: rotate( 0deg ); } 100% { transform: rotate( 359deg ); } }
html, body { margin: 0; padding: 0; position: relative; overflow: hidden; min-height: 100vh; background-color: #8086a0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; }
#_spnr { display: flex; flex-direction: column; align-items: center; justify-content: center; position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 9999; }
#_spnr { text-align: center; font-family: Arial, Helvetica, sans-serif; background-color: #8086a0; color: #1e1f30; }
#_spnr svg { display: block; margin: 0; padding: 0; animation: _spin 1s linear infinite; }
#_spnr noscript { max-width: 500px; }
#_spnr a { color: crimson; }
</style>
<script>
(function( w ) {
document.documentElement.classList.remove( 'nojs' );
w.addEventListener( 'pageshow', e => { if ( e.persisted ) w.location.reload(); } );
})( window );
</script>
</head>
<body>
<!-- initial spinner -->
<div id="_spnr">
<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="lds-ring">
<circle cx="50" cy="50" fill="none" r="40" stroke="#8086a0" stroke-width="10"></circle>
<circle cx="50" cy="50" fill="none" r="40" stroke="#1e1f30" stroke-width="6" stroke-linecap="round" stroke-dasharray="150 100"></circle>
</svg>
<noscript>
This applications requires Javascript to run.
Make sure Javascript is enabled in your web browser settings and try again.
<a href="https://www.enable-javascript.com/" target="_blank">Visit this link</a>
for more information on how to enable Javascript.
</noscript>
</div>
<!-- app root container -->
<div id="app" class="app-wrap">
<!-- app player container -->
<main id="player-wrap" class="player-wrap" style="opacity: 0;">
<!-- bg absolute elements -->
<figure id="player-bg" class="player-bg" style="background-image: url( public/img/bg.jpg );"></figure>
<canvas id="player-canvas" class="player-canvas" width="800" height="400"></canvas>
<!-- main player layout -->
<section class="player-layout">
<!-- player top header -->
<header class="player-header flex-row flex-middle flex-stretch">
<h2 class="player-logo text-clip flex-1"><i class="ico ico-waveform"></i> <span>Soma FM Player</span></h2>
<button class="text-nowrap common-btn focus-text" type="button" @click="toggleSidebar( true )" title="Open stations menu"><i class="ico ico-menu"></i></button>
</header>
<!-- player middle content area -->
<main class="player-content flex-row">
<!-- default greet message -->
<section class="player-greet" v-if="!hasChannel && !hasErrors">
<div class="fx fx-slide-left push-bottom"><h1>Pick a Station</h1></div>
<div class="fx fx-slide-left fx-delay-1 push-bottom">This is a music streaming player for the channels provided by SomaFM.com. Just pick a station from the sidebar to the right to start listening.</div>
<div class="fx fx-slide-up fx-delay-2 pad-top"><button class="cta-btn focus-box" type="button" @click="toggleSidebar( true )"><i class="ico ico-headphones"></i> View Stations</button></div>
</section>
<!-- show selected channel info if possible -->
<section class="player-channel flex-1" v-if="hasChannel && !hasErrors" :key="channel.id">
<div class="flex-autorow flex-top flex-stretch">
<!-- station details -->
<div class="flex-item flex-1">
<!-- station -->
<div class="push-bottom">
<div class="flex-row flex-middle pad-bottom">
<div class="fx fx-drop-in fx-delay-1">
<img class="img-round" :src="channel.largeimage" width="80" height="80" :alt="channel.title" />
</div>
<div class="pad-left">
<h3 class="text-clip fx fx-fade-in fx-delay-2">
<span>{{ channel.title }}</span>
</h3>
<div class="fx fx-fade-in fx-delay-3">
<fav-btn :id="channel.id" :active="channel.favorite" text="Favorite" @change="toggleFavorite"></fav-btn>
</div>
</div>
</div>
</div>
<!-- description -->
<div class="push-bottom pad-bottom fx fx-slide-up fx-delay-3">
<div class="push-bottom">
<span class="text-secondary">Mixed by DJ {{ channel.dj | toText( 'N/A' ) }}.</span> <br />
<span class="text-bright text-capitalize">{{ channel.title }}</span> -
<span class="text-bright text-capitalize">{{ channel.genre | toText( 'Station' ) }}.</span> <br />
<span>{{ channel.description }}</span>
</div>
<div class="flex-row flex-middle">
<div class="fx fx-slide-up fx-delay-2 push-right" v-if="channel.infourl">
<a class="cta-btn text-nowrap focus-box" :href="channel.infourl" title="Channel page" target="_blank">
<i class="ico ico-earth"></i> Webpage
</a>
</div>
<div class="fx fx-slide-up fx-delay-3 push-right" v-if="channel.plsfile">
<a class="cta-btn text-nowrap focus-box" :href="channel.plsfile" title="Download PLS" target="_blank">
<i class="ico ico-download"></i> PLS
</a>
</div>
<div class="fx fx-slide-up fx-delay-4 push-right" v-if="channel.twitter">
<a class="cta-btn text-nowrap focus-box" :href="channel.twitter" title="Twitter page" target="_blank">
<i class="ico ico-twitter"></i>
</a>
</div>
</div>
</div>
<!-- heading -->
<div class="flex-row flex-middle push-bottom">
<div class="push-right">
<h5 class="text-nowrap fx fx-fade-in fx-delay-2"><i class="ico ico-playing"></i> Now Playing</h5>
</div>
<div class="fx fx-slide-left fx-delay-3" :key="channel.listeners">
<i class="ico ico-headphones"></i> {{ channel.listeners | toCommas( 0 ) }} listening
</div>
</div>
<!-- current track -->
<div class="card fx fx-slide-left fx-delay-4" :key="track.date">
<div><span class="text-secondary">{{ track.title | toText( 'N/A' ) }}</span></div>
<div><span class="text-faded">From:</span> <span class="text-bright">{{ track.album | toText( 'N/A' ) }}</span></div>
<div><span class="text-faded">By:</span> <span class="text-default">{{ track.artist | toText( 'N/A' ) }}</span></div>
</div>
</div>
<!-- songs list -->
<div class="flex-item flex-1">
<div class="push-bottom">
<h5 class="text-nowrap fx fx-fade-in fx-delay-1">
<i class="ico ico-collection"></i> Recent Tracks
</h5>
</div>
<div class="card push-bottom fx fx-slide-left fx-delay-4" v-if="!hasSongs">
There are no songs loaded yet for this station.
</div>
<ul class="player-tracklist push-bottom" v-if="hasSongs">
<li v-for="( s, i ) of songsList" :key="s.date" class="card fx" :class="'fx-slide-left fx-delay-' + ( i + 4 )">
<div><span class="text-secondary">{{ s.title | toText( 'N/A' ) }}</span></div>
<div><span class="text-faded">From:</span> <span class="text-bright">{{ s.album | toText( 'N/A' ) }}</span></div>
<div><span class="text-faded">By:</span> <span class="text-default">{{ s.artist | toText( 'N/A' ) }}</span></div>
</li>
</ul>
</div>
</div>
</section>
<!-- show error messages -->
<section class="player-errors flex-1 text-center" v-if="hasErrors" key="errors">
<div class="push-bottom fx fx-drop-in fx-delay-1">
<i class="ico ico-unplugged text-huge"></i>
</div>
<div class="fx fx-slide-up fx-delay-2">
<h3>Oops, there's a problem!</h3>
</div>
<hr />
<div v-for="( e, i ) of errors" class="push-bottom fx fx-slide-up" :class="'fx-delay-' + ( i + 3 )">
<span class="text-primary">{{ e }}</span>
</div>
<hr />
<button class="cta-btn text-nowrap focus-box fx fx-slide-up fx-delay-4" type="button" @click="tryAgain">
<i class="ico ico-waveform"></i> Try again
</button>
</section>
</main>
<!-- player footer with controls -->
<footer class="player-footer flex-row flex-middle flex-space">
<!-- player controls -->
<section class="player-controls flex-row flex-middle push-right" :class="{ 'disabled': !canPlay }">
<button class="common-btn focus-text" type="button" @click="togglePlay">
<i v-if="loading" class="ico ico-loader fx fx-spin-right" key="wait"></i>
<i v-else-if="playing" class="ico ico-stop fx fx-drop-in" key="stop"></i>
<i v-else class="ico ico-play fx fx-drop-in" key="play"></i>
</button>
<div class="form-slider push-left">
<span>
<i v-if="volume >= 75" class="ico ico-volume-4"></i>
<i v-else-if="volume >= 50" class="ico ico-volume-3"></i>
<i v-else-if="volume >= 25"class="ico ico-volume-2"></i>
<i v-else class="ico ico-volume-1"></i>
</span>
<input class="common-slider" type="range" min="0" max="100" step="1" value="100" v-model="volume" @change="saveVolume()" />
</div>
<div class="text-clip push-left">
<span>{{ timeDisplay }}</span>
<span class="text-faded" v-if="hasChannel"> | </span>
<span class="fx fx-fade-in fx-delay-1" v-if="hasChannel" :key="channel.id">{{ channel.title }}</span>
</div>
</section>
<!-- player links -->
<section class="player-links text-nowrap">
<a class="common-btn text-faded focus-text" href="https://github.com/rainner" title="Github profile" target="_blank">
<i class="ico ico-github"></i>
</a>
</section>
</footer>
</section> <!-- layout wrapper -->
<!-- player stations overlay + sidebar -->
<section class="player-stations" :class="{ 'active': sbActive, 'visible': sbVisible }" @click="toggleSidebar( false )" tabindex="-1" ref="sidebarDrawer">
<aside class="player-stations-sidebar" @click.stop>
<!-- sidebar search -->
<header class="player-stations-header flex-row flex-middle flex-stretch">
<div class="form-input push-right">
<i class="ico ico-search"></i>
<input type="text" placeholder="Search station..." v-model="searchText" />
</div>
<button class="common-btn focus-text" type="button" @click="toggleSidebar( false )" title="Close stations menu"><i class="ico ico-close"></i></button>
</header>
<!-- sidebar stations list -->
<ul class="player-stations-list">
<li class="player-stations-list-item flex-row flex-top flex-stretch" tabindex="0" v-for="c of channelsList" :key="c.id" @click="selectChannel( c, true )" :class="{ 'active': c.active }" :title="c.title">
<figure class="push-right">
<img class="img-round" width="70" height="70" :src="c.largeimage" :alt="c.title" />
</figure>
<aside class="flex-1">
<div class="flex-row flex-middle flex-space">
<div class="player-stations-list-title text-bright text-clip">{{ c.title }}</div>
<div class="text-nowrap">
<span class="text-secondary"><i class="ico ico-headphones"></i> {{ c.listeners | toCommas( 0 ) }} </span>
<fav-btn :id="c.id" :active="c.favorite" @change="toggleFavorite"></fav-btn>
</div>
</div>
<div class="text-small">
<span class="text-faded text-uppercase text-small">{{ c.genre | toText }}</span> <br />
{{ c.description }}
</div>
</aside>
</li>
</ul>
<!-- sidebar sort options -->
<footer class="player-stations-footer flex-row flex-middle flex-stretch">
<div class="flex-1 push-right">
<span @click="toggleSortOrder()" class="ico clickable" :class="{ 'ico-sort-desc': sortOrder === 'desc', 'ico-sort-asc': sortOrder === 'asc' }"> </span>
<span class="text-faded">Sort: </span>
<span class="text-bright popover">
<span class="clickable">{{ sortLabel }}</span>
<span class="popover-box popover-top">
<button type="button" @click="sortBy( 'title', 'asc' )"><i class="text-faded ico ico-sort-asc"></i> Station Name</button>
<button type="button" @click="sortBy( 'listeners', 'desc' )"><i class="text-faded ico ico-headphones"></i> Listeners Count</button>
<button type="button" @click="sortBy( 'favorite', 'desc' )"><i class="text-faded ico ico-favs-check"></i> Saved Favorites</button>
<button type="button" @click="sortBy( 'genre', 'asc' )"><i class="text-faded ico ico-collection"></i> Music Genre</button>
</span>
</span>
</div>
<div>
<button type="button" @click.stop="saveFavorites()" title="Download Favorites PLS">
<i class="ico ico-download"></i>
</button>
</div>
</footer>
</aside>
</section>
</main> <!-- player -->
</div> <!-- wrapper -->
<!-- app styles -->
<link rel="stylesheet" href="/public/css/fonts.css" />
<link rel="stylesheet" href="/public/bundles/app.min.css" />
<!-- app scripts -->
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/96/three.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.26.1/axios.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/2.6.14/vue.min.js" defer></script>
<script src="/public/bundles/app.min.js" defer></script>
</body>
</html>