Station.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. <template>
  2. <official-header v-if='type == "official"'></official-header>
  3. <community-header v-if='type == "community"'></community-header>
  4. <song-queue v-if='modals.addSongToQueue'></song-queue>
  5. <edit-playlist v-if='modals.editPlaylist'></edit-playlist>
  6. <create-playlist v-if='modals.createPlaylist'></create-playlist>
  7. <edit-station v-if='modals.editStation'></edit-station>
  8. <report v-if='modals.report'></report>
  9. <songs-list-sidebar v-if='sidebars.songslist'></songs-list-sidebar>
  10. <playlist-sidebar v-if='sidebars.playlist'></playlist-sidebar>
  11. <users-sidebar v-if='sidebars.users'></users-sidebar>
  12. <div class="station">
  13. <div v-show="noSong" class="no-song">
  14. <h1>No song is currently playing</h1>
  15. <h4 v-if='type === "community" && station.partyMode'>
  16. <a href='#' class='no-song' @click='modals.addSongToQueue = true'>Add a Song to the Queue</a>
  17. </h4>
  18. <h4 v-if='type === "community" && !station.partyMode && $parent.userId === station.owner && !station.privatePlaylist'>
  19. <a href='#' class='no-song' @click='sidebars.playlist = true'>Play a private playlist</a>
  20. </h4>
  21. <h1 v-if='type === "community" && !station.partyMode && $parent.userId === station.owner && station.privatePlaylist'>Maybe you can add some songs to your selected private playlist and then press the skip button</h1>
  22. </div>
  23. <div class="columns is-mobile" v-show="!noSong">
  24. <div class="column is-8-desktop is-offset-2-desktop is-12-mobile">
  25. <div class="video-container">
  26. <div id="player"></div>
  27. <div class="seeker-bar-container white" id="preview-progress">
  28. <div class="seeker-bar light-blue" style="width: 0%;"></div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="columns is-mobile" v-show="!noSong">
  34. <div class="column is-8-desktop is-offset-2-desktop is-12-mobile">
  35. <div class="columns is-mobile">
  36. <div class="column is-12-mobile" v-bind:class="{'is-8-desktop': !simpleSong}">
  37. <h4 id="time-display">{{timeElapsed}} / {{formatTime(currentSong.duration)}}</h4>
  38. <h3>{{currentSong.title}}</h3>
  39. <h4 class="thin" style="margin-left: 0">{{currentSong.artists}}</h4>
  40. <div class="columns is-mobile">
  41. <form style="margin-top: 12px; margin-bottom: 0;" action="#" class="column is-7-desktop is-4-mobile">
  42. <p class='volume-slider-wrapper'>
  43. <i class="material-icons" @click='toggleMute()' v-if='muted'>volume_mute</i>
  44. <i class="material-icons" @click='toggleMute()' v-else>volume_down</i>
  45. <input type="range" id="volumeSlider" min="0" max="100" class="active" v-on:change="changeVolume()" v-on:input="changeVolume()">
  46. <i class="material-icons" @click='toggleMaxVolume()'>volume_up</i>
  47. </p>
  48. </form>
  49. <div class="column is-8-mobile is-5-desktop" style="float: right;">
  50. <ul id="ratings" v-if="currentSong.likes !== -1 && currentSong.dislikes !== -1">
  51. <li id="like" class="right" @click="toggleLike()">
  52. <span class="flow-text">{{currentSong.likes}} </span>
  53. <i id="thumbs_up" class="material-icons grey-text" v-bind:class="{ liked: liked }">thumb_up</i>
  54. <a class='absolute-a behind' @click="toggleLike()" href='#'></a>
  55. </li>
  56. <li style="margin-right: 10px;" id="dislike" class="right" @click="toggleDislike()">
  57. <span class="flow-text">{{currentSong.dislikes}} </span>
  58. <i id="thumbs_down" class="material-icons grey-text" v-bind:class="{ disliked: disliked }">thumb_down</i>
  59. <a class='absolute-a behind' @click="toggleDislike()" href='#'></a>
  60. </li>
  61. </ul>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="column is-4-desktop" v-if="!simpleSong">
  66. <img class="image" id="song-thumbnail" style="margin-top: 10px !important" :src="currentSong.thumbnail" alt="Song Thumbnail" onerror="this.src='/assets/notes-transparent.png'" />
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </template>
  73. <script>
  74. import { Toast } from 'vue-roaster';
  75. import SongQueue from '../Modals/AddSongToQueue.vue';
  76. import EditPlaylist from '../Modals/Playlists/Edit.vue';
  77. import CreatePlaylist from '../Modals/Playlists/Create.vue';
  78. import EditStation from '../Modals/EditStation.vue';
  79. import Report from '../Modals/Report.vue';
  80. import SongsListSidebar from '../Sidebars/SongsList.vue';
  81. import PlaylistSidebar from '../Sidebars/Playlist.vue';
  82. import UsersSidebar from '../Sidebars/UsersList.vue';
  83. import OfficialHeader from './OfficialHeader.vue';
  84. import CommunityHeader from './CommunityHeader.vue';
  85. import io from '../../io';
  86. import auth from '../../auth';
  87. export default {
  88. data() {
  89. return {
  90. type: '',
  91. playerReady: false,
  92. previousSong: null,
  93. currentSong: {},
  94. player: undefined,
  95. timePaused: 0,
  96. paused: false,
  97. muted: false,
  98. timeElapsed: '0:00',
  99. liked: false,
  100. disliked: false,
  101. modals: {
  102. addSongToQueue: false,
  103. editPlaylist: false,
  104. createPlaylist: false,
  105. editStation: false,
  106. report: false
  107. },
  108. sidebars: {
  109. songslist: false,
  110. users: false,
  111. playlist: false
  112. },
  113. noSong: false,
  114. simpleSong: false,
  115. songsList: [],
  116. timeBeforePause: 0,
  117. station: {},
  118. skipVotes: 0,
  119. privatePlaylistQueueSelected: null,
  120. automaticallyRequestedSongId: null,
  121. systemDifference: 0
  122. }
  123. },
  124. methods: {
  125. editPlaylist: function (id) {
  126. this.playlistBeingEdited = id;
  127. this.modals.editPlaylist = !this.modals.editPlaylist;
  128. },
  129. toggleSidebar: function (type) {
  130. Object.keys(this.sidebars).forEach(sidebar => {
  131. if (sidebar !== type) this.sidebars[sidebar] = false;
  132. else this.sidebars[type] = !this.sidebars[type];
  133. });
  134. },
  135. youtubeReady: function() {
  136. let local = this;
  137. if (!local.player) {
  138. local.player = new YT.Player("player", {
  139. height: 270,
  140. width: 480,
  141. videoId: local.currentSong._id,
  142. startSeconds: local.getTimeElapsed() / 1000 + local.currentSong.skipDuration,
  143. playerVars: {controls: 0, iv_load_policy: 3, rel: 0, showinfo: 0},
  144. events: {
  145. 'onReady': function (event) {
  146. local.playerReady = true;
  147. let volume = parseInt(localStorage.getItem("volume"));
  148. volume = (typeof volume === "number") ? volume : 20;
  149. local.player.setVolume(volume);
  150. if (volume > 0) local.player.unMute();
  151. local.playVideo();
  152. },
  153. 'onError': function(err) {
  154. console.log("iframe error", err);
  155. local.voteSkipStation();
  156. },
  157. 'onStateChange': function (event) {
  158. if (event.data === 1 && local.videoLoading === true) {
  159. local.videoLoading = false;
  160. local.player.seekTo(local.getTimeElapsed() / 1000 + local.currentSong.skipDuration, true);
  161. if (local.paused) local.player.pauseVideo();
  162. } else if (event.data === 1 && local.paused) {
  163. local.player.seekTo(local.timeBeforePause / 1000, true);
  164. local.player.pauseVideo();
  165. }
  166. if (event.data === 2 && !local.paused && !local.noSong && (local.player.getDuration() / 1000) < local.currentSong.duration) {
  167. local.player.seekTo(local.getTimeElapsed() / 1000 + local.currentSong.skipDuration, true);
  168. local.player.playVideo();
  169. }
  170. }
  171. }
  172. });
  173. }
  174. },
  175. getTimeElapsed: function() {
  176. let local = this;
  177. if (local.currentSong) return Date.currently() - local.startedAt - local.timePaused;
  178. else return 0;
  179. },
  180. playVideo: function() {
  181. let local = this;
  182. if (local.playerReady) {
  183. local.videoLoading = true;
  184. local.player.loadVideoById(local.currentSong._id, local.getTimeElapsed() / 1000 + local.currentSong.skipDuration);
  185. if (local.currentSong.artists) local.currentSong.artists = local.currentSong.artists.join(", ");
  186. if (window.stationInterval !== 0) clearInterval(window.stationInterval);
  187. window.stationInterval = setInterval(function () {
  188. local.resizeSeekerbar();
  189. local.calculateTimeElapsed();
  190. }, 250);
  191. }
  192. },
  193. resizeSeekerbar: function() {
  194. let local = this;
  195. if (!local.paused) {
  196. $(".seeker-bar").width(parseInt(((local.getTimeElapsed() / 1000) / local.currentSong.duration * 100)) + "%");
  197. }
  198. },
  199. formatTime: function(duration) {
  200. let d = moment.duration(duration, 'seconds');
  201. if (duration < 0) return "0:00";
  202. return ((d.hours() > 0) ? (d.hours() < 10 ? ("0" + d.hours() + ":") : (d.hours() + ":")) : "") + (d.minutes() + ":") + (d.seconds() < 10 ? ("0" + d.seconds()) : d.seconds());
  203. },
  204. calculateTimeElapsed: function() {
  205. let local = this;
  206. let currentTime = Date.currently();
  207. if (local.currentTime !== undefined && local.paused) {
  208. local.timePaused += (Date.currently() - local.currentTime);
  209. local.currentTime = undefined;
  210. }
  211. let duration = (Date.currently() - local.startedAt - local.timePaused) / 1000;
  212. let songDuration = local.currentSong.duration;
  213. if (songDuration <= duration) local.player.pauseVideo();
  214. if ((!local.paused) && duration <= songDuration) local.timeElapsed = local.formatTime(duration);
  215. },
  216. changeVolume: function() {
  217. let local = this;
  218. let volume = $("#volumeSlider").val();
  219. localStorage.setItem("volume", volume);
  220. if (local.playerReady) {
  221. local.player.setVolume(volume);
  222. if (volume > 0) local.player.unMute();
  223. }
  224. },
  225. resumeLocalStation: function() {
  226. this.paused = false;
  227. if (!this.noSong) {
  228. if (this.playerReady) {
  229. this.player.seekTo(this.getTimeElapsed() / 1000 + this.currentSong.skipDuration);
  230. this.player.playVideo();
  231. }
  232. }
  233. },
  234. pauseLocalStation: function() {
  235. this.paused = true;
  236. if (!this.noSong) {
  237. this.timeBeforePause = this.getTimeElapsed();
  238. if (this.playerReady) this.player.pauseVideo();
  239. }
  240. },
  241. skipStation: function () {
  242. let _this = this;
  243. _this.socket.emit('stations.forceSkip', _this.stationId, data => {
  244. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  245. else Toast.methods.addToast('Successfully skipped the station\'s current song.', 4000);
  246. });
  247. },
  248. voteSkipStation: function () {
  249. let _this = this;
  250. _this.socket.emit('stations.voteSkip', _this.stationId, data => {
  251. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  252. else Toast.methods.addToast('Successfully voted to skip the current song.', 4000);
  253. });
  254. },
  255. resumeStation: function () {
  256. let _this = this;
  257. _this.socket.emit('stations.resume', _this.stationId, data => {
  258. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  259. else Toast.methods.addToast('Successfully resumed the station.', 4000);
  260. });
  261. },
  262. pauseStation: function () {
  263. let _this = this;
  264. _this.socket.emit('stations.pause', _this.stationId, data => {
  265. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  266. else Toast.methods.addToast('Successfully paused the station.', 4000);
  267. });
  268. },
  269. toggleMute: function () {
  270. if (this.playerReady) {
  271. let previousVolume = parseInt(localStorage.getItem("volume"));
  272. let volume = this.player.getVolume() <= 0 ? previousVolume : 0;
  273. this.muted = !this.muted;
  274. $("#volumeSlider").val(volume);
  275. this.player.setVolume(volume);
  276. }
  277. },
  278. toggleMaxVolume: function () {
  279. if (this.playerReady) {
  280. let previousVolume = parseInt(localStorage.getItem("volume"));
  281. let volume = this.player.getVolume() <= previousVolume ? 100 : previousVolume;
  282. $("#volumeSlider").val(volume);
  283. this.player.setVolume(volume);
  284. }
  285. },
  286. toggleLike: function() {
  287. let _this = this;
  288. if (_this.liked) _this.socket.emit('songs.unlike', _this.currentSong._id, data => {
  289. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  290. }); else _this.socket.emit('songs.like', _this.currentSong._id, data => {
  291. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  292. });
  293. },
  294. toggleDislike: function() {
  295. let _this = this;
  296. if (_this.disliked) return _this.socket.emit('songs.undislike', _this.currentSong._id, data => {
  297. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  298. });
  299. _this.socket.emit('songs.dislike', _this.currentSong._id, data => {
  300. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  301. });
  302. },
  303. addFirstPrivatePlaylistSongToQueue: function() {
  304. let _this = this;
  305. let isInQueue = false;
  306. let userId = _this.$parent.userId;
  307. if (_this.type === 'community') {
  308. _this.songsList.forEach((queueSong) => {
  309. if (queueSong.requestedBy === userId) isInQueue = true;
  310. });
  311. if (!isInQueue && _this.privatePlaylistQueueSelected) {
  312. _this.socket.emit('playlists.getFirstSong', _this.privatePlaylistQueueSelected, data => {
  313. if (data.status === 'success') {
  314. let songId = data.song._id;
  315. _this.automaticallyRequestedSongId = songId;
  316. _this.socket.emit('stations.addToQueue', _this.stationId, songId, data => {
  317. if (data.status === 'success') {
  318. _this.socket.emit('playlists.moveSongToBottom', _this.privatePlaylistQueueSelected, songId, data => {
  319. if (data.status === 'success') {}
  320. });
  321. }
  322. });
  323. }
  324. });
  325. }
  326. }
  327. },
  328. joinStation: function () {
  329. let _this = this;
  330. _this.socket.emit('stations.join', _this.stationId, res => {
  331. if (res.status === 'success') {
  332. _this.station = {
  333. displayName: res.data.displayName,
  334. description: res.data.description,
  335. privacy: res.data.privacy,
  336. partyMode: res.data.partyMode,
  337. owner: res.data.owner,
  338. privatePlaylist: res.data.privatePlaylist
  339. };
  340. _this.currentSong = (res.data.currentSong) ? res.data.currentSong : {};
  341. _this.type = res.data.type;
  342. _this.startedAt = res.data.startedAt;
  343. _this.paused = res.data.paused;
  344. _this.timePaused = res.data.timePaused;
  345. if (res.data.currentSong) {
  346. _this.noSong = false;
  347. _this.simpleSong = (res.data.currentSong.likes === -1 && res.data.currentSong.dislikes === -1);
  348. if (_this.simpleSong) {
  349. _this.currentSong.skipDuration = 0;
  350. }
  351. _this.youtubeReady();
  352. _this.playVideo();
  353. _this.socket.emit('songs.getOwnSongRatings', res.data.currentSong._id, data => {
  354. if (_this.currentSong._id === data.songId) {
  355. _this.liked = data.liked;
  356. _this.disliked = data.disliked;
  357. }
  358. });
  359. } else {
  360. if (_this.playerReady) _this.player.pauseVideo();
  361. _this.noSong = true;
  362. }
  363. if (_this.type === 'community') {
  364. _this.socket.emit('stations.getQueue', _this.stationId, data => {
  365. if (data.status === 'success') _this.songsList = data.queue;
  366. });
  367. }
  368. }
  369. _this.socket.emit('stations.getPlaylist', _this.stationId, res => {
  370. if (res.status == 'success') _this.songsList = res.data;
  371. });
  372. // UNIX client time before ping
  373. let beforePing = Date.now();
  374. _this.socket.emit('apis.ping', res => {
  375. // UNIX client time after ping
  376. let afterPing = Date.now();
  377. // Average time in MS it took between the server responding and the client receiving
  378. let connectionLatency = (afterPing - beforePing) / 2;
  379. console.log(connectionLatency, beforePing - afterPing);
  380. // UNIX server time
  381. let serverDate = res.date;
  382. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  383. let difference = (serverDate + connectionLatency) - afterPing;
  384. console.log("Difference: ", difference);
  385. if (difference > 3000 || difference < -3000) {
  386. console.log("System time difference is bigger than 3 seconds.");
  387. }
  388. _this.systemDifference = difference;
  389. });
  390. });
  391. }
  392. },
  393. ready: function() {
  394. let _this = this;
  395. Date.currently = () => {
  396. return new Date().getTime() + _this.systemDifference;
  397. };
  398. _this.stationId = _this.$route.params.id;
  399. window.stationInterval = 0;
  400. auth.getStatus(isLoggedIn => {
  401. if (!isLoggedIn) _this.$router.go('/404');
  402. });
  403. io.getSocket(socket => {
  404. _this.socket = socket;
  405. io.removeAllListeners();
  406. if (_this.socket.connected) _this.joinStation();
  407. io.onConnect(() => {
  408. _this.joinStation();
  409. });
  410. _this.socket.emit('stations.find', _this.stationId, res => {
  411. if (res.status === 'error') {
  412. _this.$router.go('/404');
  413. Toast.methods.addToast(res.message, 3000);
  414. console.log('yup')
  415. }
  416. });
  417. _this.socket.on('event:songs.next', data => {
  418. _this.previousSong = (_this.currentSong._id) ? _this.currentSong : null;
  419. _this.currentSong = (data.currentSong) ? data.currentSong : {};
  420. _this.startedAt = data.startedAt;
  421. _this.paused = data.paused;
  422. _this.timePaused = data.timePaused;
  423. if (data.currentSong) {
  424. _this.noSong = false;
  425. _this.simpleSong = (data.currentSong.likes === -1 && data.currentSong.dislikes === -1);
  426. if (_this.simpleSong) _this.currentSong.skipDuration = 0;
  427. if (!_this.playerReady) _this.youtubeReady();
  428. else _this.playVideo();
  429. _this.socket.emit('songs.getOwnSongRatings', data.currentSong._id, (data) => {
  430. if (_this.currentSong._id === data.songId) {
  431. _this.liked = data.liked;
  432. _this.disliked = data.disliked;
  433. }
  434. });
  435. } else {
  436. if (_this.playerReady) _this.player.pauseVideo();
  437. _this.noSong = true;
  438. }
  439. let isInQueue = false;
  440. let userId = _this.$parent.userId;
  441. _this.songsList.forEach((queueSong) => {
  442. if (queueSong.requestedBy === userId) isInQueue = true;
  443. });
  444. if (!isInQueue && _this.privatePlaylistQueueSelected && (_this.automaticallyRequestedSongId !== _this.currentSong._id || !_this.currentSong._id)) {
  445. _this.addFirstPrivatePlaylistSongToQueue();
  446. }
  447. });
  448. _this.socket.on('event:stations.pause', data => {
  449. _this.pauseLocalStation();
  450. });
  451. _this.socket.on('event:stations.resume', data => {
  452. _this.timePaused = data.timePaused;
  453. _this.resumeLocalStation();
  454. });
  455. _this.socket.on('event:song.like', data => {
  456. if (!this.noSong) {
  457. if (data.songId === _this.currentSong._id) {
  458. _this.currentSong.dislikes = data.dislikes;
  459. _this.currentSong.likes = data.likes;
  460. }
  461. }
  462. });
  463. _this.socket.on('event:song.dislike', data => {
  464. if (!this.noSong) {
  465. if (data.songId === _this.currentSong._id) {
  466. _this.currentSong.dislikes = data.dislikes;
  467. _this.currentSong.likes = data.likes;
  468. }
  469. }
  470. });
  471. _this.socket.on('event:song.unlike', data => {
  472. if (!this.noSong) {
  473. if (data.songId === _this.currentSong._id) {
  474. _this.currentSong.dislikes = data.dislikes;
  475. _this.currentSong.likes = data.likes;
  476. }
  477. }
  478. });
  479. _this.socket.on('event:song.undislike', data => {
  480. if (!this.noSong) {
  481. if (data.songId === _this.currentSong._id) {
  482. _this.currentSong.dislikes = data.dislikes;
  483. _this.currentSong.likes = data.likes;
  484. }
  485. }
  486. });
  487. _this.socket.on('event:song.newRatings', data => {
  488. if (!this.noSong) {
  489. if (data.songId === _this.currentSong._id) {
  490. _this.liked = data.liked;
  491. _this.disliked = data.disliked;
  492. }
  493. }
  494. });
  495. _this.socket.on('event:queue.update', queue => {
  496. if (this.type === 'community') this.songsList = queue;
  497. });
  498. _this.socket.on('event:song.voteSkipSong', () => {
  499. if (this.currentSong) this.currentSong.skipVotes++;
  500. });
  501. _this.socket.on('event:privatePlaylist.selected', (playlistId) => {
  502. if (this.type === 'community') {
  503. this.station.privatePlaylist = playlistId;
  504. }
  505. });
  506. _this.socket.on('event:partyMode.updated', (partyMode) => {
  507. if (this.type === 'community') {
  508. this.station.partyMode = partyMode;
  509. }
  510. });
  511. _this.socket.on('event:newOfficialPlaylist', (playlist) => {
  512. console.log(playlist);
  513. if (this.type === 'official') {
  514. this.songsList = playlist;
  515. }
  516. });
  517. });
  518. let volume = parseInt(localStorage.getItem("volume"));
  519. volume = (typeof volume === "number" && !isNaN(volume)) ? volume : 20;
  520. localStorage.setItem("volume", volume);
  521. $("#volumeSlider").val(volume);
  522. },
  523. components: {
  524. OfficialHeader,
  525. CommunityHeader,
  526. SongQueue,
  527. EditPlaylist,
  528. CreatePlaylist,
  529. EditStation,
  530. Report,
  531. SongsListSidebar,
  532. PlaylistSidebar,
  533. UsersSidebar
  534. }
  535. }
  536. </script>
  537. <style lang="scss">
  538. .no-song {
  539. color: #03A9F4;
  540. text-align: center;
  541. }
  542. #volumeSlider {
  543. padding: 0 15px;
  544. background: transparent;
  545. }
  546. .volume-slider-wrapper {
  547. margin-top: 0;
  548. position: relative;
  549. display: flex;
  550. align-items: center;
  551. }
  552. .material-icons { cursor: pointer; }
  553. .stationDisplayName {
  554. color: white !important;
  555. }
  556. .slideout {
  557. top: 50px;
  558. height: 100%;
  559. position: fixed;
  560. right: 0;
  561. width: 350px;
  562. background-color: white;
  563. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  564. .slideout-header {
  565. text-align: center;
  566. background-color: rgb(3, 169, 244) !important;
  567. margin: 0;
  568. padding-top: 5px;
  569. padding-bottom: 7px;
  570. color: white;
  571. }
  572. .slideout-content {
  573. height: 100%;
  574. }
  575. }
  576. .modal-large {
  577. width: 75%;
  578. }
  579. .station {
  580. flex: 1 0 auto;
  581. padding-top: 0.5vw;
  582. transition: all 0.1s;
  583. margin: 0 auto;
  584. max-width: 1280px;
  585. width: 90%;
  586. @media only screen and (min-width: 993px) {
  587. width: 70%;
  588. }
  589. @media only screen and (min-width: 601px) {
  590. width: 85%;
  591. }
  592. input[type=range] {
  593. -webkit-appearance: none;
  594. width: 100%;
  595. margin: 7.3px 0;
  596. }
  597. input[type=range]:focus {
  598. outline: none;
  599. }
  600. input[type=range]::-webkit-slider-runnable-track {
  601. width: 100%;
  602. height: 5.2px;
  603. cursor: pointer;
  604. box-shadow: 0;
  605. background: #c2c0c2;
  606. border-radius: 0;
  607. border: 0;
  608. }
  609. input[type=range]::-webkit-slider-thumb {
  610. box-shadow: 0;
  611. border: 0;
  612. height: 19px;
  613. width: 19px;
  614. border-radius: 15px;
  615. background: #03a9f4;
  616. cursor: pointer;
  617. -webkit-appearance: none;
  618. margin-top: -6.5px;
  619. }
  620. input[type=range]::-moz-range-track {
  621. width: 100%;
  622. height: 5.2px;
  623. cursor: pointer;
  624. box-shadow: 0;
  625. background: #c2c0c2;
  626. border-radius: 0;
  627. border: 0;
  628. }
  629. input[type=range]::-moz-range-thumb {
  630. box-shadow: 0;
  631. border: 0;
  632. height: 19px;
  633. width: 19px;
  634. border-radius: 15px;
  635. background: #03a9f4;
  636. cursor: pointer;
  637. -webkit-appearance: none;
  638. margin-top: -6.5px;
  639. }
  640. input[type=range]::-ms-track {
  641. width: 100%;
  642. height: 5.2px;
  643. cursor: pointer;
  644. box-shadow: 0;
  645. background: #c2c0c2;
  646. border-radius: 1.3px;
  647. }
  648. input[type=range]::-ms-fill-lower {
  649. background: #c2c0c2;
  650. border: 0;
  651. border-radius: 0;
  652. box-shadow: 0;
  653. }
  654. input[type=range]::-ms-fill-upper {
  655. background: #c2c0c2;
  656. border: 0;
  657. border-radius: 0;
  658. box-shadow: 0;
  659. }
  660. input[type=range]::-ms-thumb {
  661. box-shadow: 0;
  662. border: 0;
  663. height: 15px;
  664. width: 15px;
  665. border-radius: 15px;
  666. background: #03a9f4;
  667. cursor: pointer;
  668. -webkit-appearance: none;
  669. margin-top: 1.5px;
  670. }
  671. .video-container {
  672. position: relative;
  673. padding-bottom: 56.25%;
  674. height: 0;
  675. overflow: hidden;
  676. iframe {
  677. position: absolute;
  678. top: 0;
  679. left: 0;
  680. width: 100%;
  681. height: 100%;
  682. }
  683. }
  684. .video-col {
  685. padding-right: 0.75rem;
  686. padding-left: 0.75rem;
  687. }
  688. }
  689. .room-title {
  690. left: 50%;
  691. -webkit-transform: translateX(-50%);
  692. transform: translateX(-50%);
  693. font-size: 2.1em;
  694. }
  695. #ratings {
  696. span {
  697. font-size: 1.68rem;
  698. }
  699. i {
  700. color: #9e9e9e !important;
  701. cursor: pointer;
  702. transition: 0.1s color;
  703. }
  704. }
  705. #time-display {
  706. margin-top: 30px;
  707. float: right;
  708. }
  709. #thumbs_up:hover, #thumbs_up.liked {
  710. color: #87D37C !important;
  711. }
  712. #thumbs_down:hover, #thumbs_down.disliked {
  713. color: #EC644B !important;
  714. }
  715. #song-thumbnail {
  716. max-width: 100%;
  717. width: 85%;
  718. }
  719. .seeker-bar-container {
  720. position: relative;
  721. height: 5px;
  722. display: block;
  723. width: 100%;
  724. overflow: hidden;
  725. }
  726. .seeker-bar {
  727. top: 0;
  728. left: 0;
  729. bottom: 0;
  730. position: absolute;
  731. }
  732. ul {
  733. list-style: none;
  734. margin: 0;
  735. display: block;
  736. }
  737. h1, h2, h3, h4, h5, h6 {
  738. font-weight: 400;
  739. line-height: 1.1;
  740. }
  741. h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
  742. font-weight: inherit;
  743. }
  744. h1 {
  745. font-size: 4.2rem;
  746. line-height: 110%;
  747. margin: 2.1rem 0 1.68rem 0;
  748. }
  749. h2 {
  750. font-size: 3.56rem;
  751. line-height: 110%;
  752. margin: 1.78rem 0 1.424rem 0;
  753. }
  754. h3 {
  755. font-size: 2.92rem;
  756. line-height: 110%;
  757. margin: 1.46rem 0 1.168rem 0;
  758. }
  759. h4 {
  760. font-size: 2.28rem;
  761. line-height: 110%;
  762. margin: 1.14rem 0 0.912rem 0;
  763. }
  764. h5 {
  765. font-size: 1.64rem;
  766. line-height: 110%;
  767. margin: 0.82rem 0 0.656rem 0;
  768. }
  769. h6 {
  770. font-size: 1rem;
  771. line-height: 110%;
  772. margin: 0.5rem 0 0.4rem 0;
  773. }
  774. .thin {
  775. font-weight: 200;
  776. }
  777. .left {
  778. float: left !important;
  779. }
  780. .right {
  781. float: right !important;
  782. }
  783. .light-blue {
  784. background-color: #03a9f4 !important;
  785. }
  786. .white {
  787. background-color: #FFFFFF !important;
  788. }
  789. .btn-search {
  790. font-size: 14px;
  791. }
  792. .menu { padding: 0 10px; }
  793. .menu-list li a:hover { color: #000 !important; }
  794. .menu-list li {
  795. display: flex;
  796. justify-content: space-between;
  797. }
  798. .menu-list a {
  799. /*padding: 0 10px !important;*/
  800. }
  801. .menu-list a:hover {
  802. background-color : transparent;
  803. }
  804. .icons-group { display: flex; }
  805. #like, #dislike {
  806. position: relative;
  807. }
  808. .behind {
  809. z-index: -1;
  810. }
  811. .behind:focus {
  812. z-index: 0;
  813. }
  814. </style>