forked from rainner/soma-fm-player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
269 lines (232 loc) · 14.1 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
<!DOCTYPE html>
<html 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" />
<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; }
#_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; color: antiquewhite; }
#_spnr svg { display: block; margin: 0; padding: 0; animation: _spin 1s linear infinite; }
#_spnr noscript { max-width: 500px; }
#_spnr a { color: crimson; }
</style>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto+Condensed:700" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="public/bundles/app.min.css" />
</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"></canvas>
<!-- main player layout -->
<section class="player-layout">
<!-- player top header -->
<header class="player-header flex-row flex-middle flex-stretch">
<h2 class="text-clip flex-1"><i class="fa fa-headphones"></i> <span>Soma FM Player</span></h2>
<button class="text-nowrap common-btn" @click="toggleSidebar( true )"><i class="fa fa-bars"></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" @click="toggleSidebar( true )"><i class="fa fa-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">
<img class="img-round fx fx-drop-in fx-delay-1" :src="channel.largeimage" width="80" height="80" :alt="channel.title" />
<div class="pad-left fx fx-slide-left fx-delay-2">
<h3 class="text-clip">{{ channel.title }}</h3>
<div class="text-nowrap">
<span class="text-clip text-uppercase">{{ channel.genre | toText }} </span>
<fav-btn :id="channel.id" :active="channel.favorite" @change="toggleFavorite"></fav-btn>
</div>
</div>
</div>
</div>
<!-- description -->
<div class="card push-bottom fx fx-slide-up fx-delay-3">
<div class="text-secondary">Mixed by DJ {{ channel.dj | toText( 'N/A' ) }}.</div>
<div>{{ channel.description }}</div>
</div>
<!-- current track -->
<div class="card push-bottom fx fx-slide-up 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>
<!-- buttons -->
<div class="push-bottom text-nowrap">
<a class="cta-btn text-nowrap fx fx-slide-up fx-delay-5" :href="channel.infourl" title="Channel page" target="_blank">
<span class="fx fx-notx fx-ibk fx-drop-in" :key="channel.listeners"><i class="fa fa-headphones"></i> {{ channel.listeners | toCommas( 0 ) }}</span>
</a>
<a class="cta-btn text-nowrap fx fx-slide-up fx-delay-6" :href="channel.twitter" title="Twitter page" target="_blank">
<i class="fa fa-twitter"></i>
</a>
<a class="cta-btn text-nowrap fx fx-slide-up fx-delay-7" :href="channel.plsfile" title="Download PLS" target="_blank">
<i class="fa fa-download"></i>
</a>
</div>
</div>
<!-- songs list -->
<div class="flex-item flex-1">
<div class="push-bottom">
<h4 class="text-nowrap fx fx-slide-left fx-delay-1">Recent Tracks</h4>
</div>
<div class="card push-bottom" 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 + 2 )">
<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="fa fa-plug text-huge text-faded"></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 fx fx-slide-up fx-delay-4" @click="tryAgain">
<i class="fa fa-refresh"></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" @click="togglePlay()">
<i v-if="loading" class="fa fa-circle-o-notch fx fx-spin-right" key="wait"></i>
<i v-else-if="playing" class="fa fa-stop fx fx-drop-in" key="stop"></i>
<i v-else class="fa fa-play fx fx-drop-in" key="play"></i>
</button>
<div class="form-slider push-left">
<i class="fa fa-volume-down"></i>
<input class="common-slider" type="range" min="0.0" max="1.0" step="0.1" value="0.5" v-model="volume" />
<i class="fa fa-volume-up"></i>
</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" href="https://github.com/rainner/soma-fm-player" title="View on Github" target="_blank">
<i class="fa fa-github"></i>
</a>
<a class="common-btn text-faded" href="https://codepen.io/rainner" title="Codepen Projects" target="_blank">
<i class="fa fa-codepen"></i>
</a>
</section>
</footer>
</section> <!-- layout wrapper -->
<!-- player stations overlay + sidebar -->
<section class="player-stations" :class="{ 'visible': sidebar }" @click="toggleSidebar( false )">
<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="fa fa-search"></i>
<input type="text" placeholder="Search station..." v-model="searchText" />
</div>
<button class="common-btn" @click="toggleSidebar( false )"><i class="fa fa-times-circle"></i></button>
</header>
<!-- sidebar stations list -->
<ul class="player-stations-list">
<li class="player-stations-list-item flex-row flex-top flex-stretch" v-for="c of channelsList" :key="c.id" @click="setRoute( c.route )" :class="{ 'active': c.active }">
<figure class="push-right if-small">
<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="fa fa-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="fa clickable" :class="{ 'fa-sort-amount-desc': sortOrder === 'desc', 'fa-sort-amount-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 @click="sortBy( 'title', 'asc' )"><i class="text-faded fa fa-font"> </i> Station Name</button>
<button @click="sortBy( 'listeners', 'desc' )"><i class="text-faded fa fa-headphones"> </i> Listeners Count</button>
<button @click="sortBy( 'favorite', 'desc' )"><i class="text-faded fa fa-heart"> </i> Saved Favorites</button>
<button @click="sortBy( 'genre', 'asc' )"><i class="text-faded fa fa-music"> </i> Music Genre</button>
</span>
</span>
</div>
<div>
<button title="Download Favorites PLS" @click.stop="saveFavorites()">
<i class="fa fa-download"></i>
</button>
</div>
</footer>
</aside>
</section>
</main> <!-- player -->
</div> <!-- wrapper -->
<!-- app scripts -->
<script src="//cdnjs.cloudflare.com/ajax/libs/three.js/96/three.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js"></script>
<script src="public/bundles/app.min.js"></script>
</body>
</html>