Station.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737
  1. <template>
  2. <div>
  3. <metadata v-bind:title="`${station.displayName}`" />
  4. <station-header v-if="exists" />
  5. <song-queue v-if="modals.addSongToQueue" />
  6. <add-to-playlist v-if="modals.addSongToPlaylist" />
  7. <edit-playlist v-if="modals.editPlaylist" />
  8. <create-playlist v-if="modals.createPlaylist" />
  9. <edit-station v-show="modals.editStation" />
  10. <report v-if="modals.report" />
  11. <transition name="slide">
  12. <songs-list-sidebar v-if="sidebars.songslist" />
  13. </transition>
  14. <transition name="slide">
  15. <playlist-sidebar v-if="sidebars.playlist" />
  16. </transition>
  17. <transition name="slide">
  18. <users-sidebar v-if="sidebars.users" />
  19. </transition>
  20. <div v-show="loading" class="progress" />
  21. <div v-show="!loading && exists" class="station">
  22. <div v-show="noSong" class="no-song">
  23. <h1>No song is currently playing</h1>
  24. <h4
  25. v-if="
  26. station.type === 'community' &&
  27. station.partyMode &&
  28. this.loggedIn &&
  29. (!station.locked ||
  30. (station.locked &&
  31. this.userId === station.owner))
  32. "
  33. >
  34. <a
  35. href="#"
  36. class="no-song"
  37. @click="
  38. openModal({
  39. sector: 'station',
  40. modal: 'addSongToQueue'
  41. })
  42. "
  43. >Add a song to the queue</a
  44. >
  45. </h4>
  46. <h4
  47. v-if="
  48. station.type === 'community' &&
  49. !station.partyMode &&
  50. this.userId === station.owner &&
  51. !station.privatePlaylist
  52. "
  53. >
  54. <a
  55. href="#"
  56. class="no-song"
  57. @click="sidebars.playlist = true"
  58. >Play a private playlist</a
  59. >
  60. </h4>
  61. <h1
  62. v-if="
  63. station.type === 'community' &&
  64. !station.partyMode &&
  65. this.userId === station.owner &&
  66. station.privatePlaylist
  67. "
  68. >
  69. Maybe you can add some songs to your selected private
  70. playlist and then press the skip button
  71. </h1>
  72. </div>
  73. <div v-show="!noSong" class="columns">
  74. <div
  75. class="column is-8-desktop is-offset-2-desktop is-12-mobile"
  76. >
  77. <div class="video-container">
  78. <div id="player" />
  79. <div
  80. class="player-can-not-autoplay"
  81. v-if="!canAutoplay"
  82. >
  83. <p>
  84. Please click anywhere on the screen for the
  85. video to start
  86. </p>
  87. </div>
  88. </div>
  89. <div
  90. id="preview-progress"
  91. class="seeker-bar-container white"
  92. >
  93. <div class="seeker-bar light-blue" style="width: 0%;" />
  94. </div>
  95. </div>
  96. <div
  97. class="desktop-only column is-3-desktop card playlistCard experimental"
  98. >
  99. <div v-if="station.type === 'community'" class="title">
  100. Queue
  101. </div>
  102. <div v-else class="title">
  103. Playlist
  104. </div>
  105. <article v-if="!noSong" class="media">
  106. <figure class="media-left">
  107. <p class="image is-64x64">
  108. <img
  109. :src="currentSong.thumbnail"
  110. onerror="this.src='/assets/notes-transparent.png'"
  111. />
  112. </p>
  113. </figure>
  114. <div class="media-content">
  115. <div class="content">
  116. <p>
  117. Current Song:
  118. <br />
  119. <strong>{{ currentSong.title }}</strong>
  120. <br />
  121. <small>{{ currentSong.artists }}</small>
  122. </p>
  123. </div>
  124. </div>
  125. <div class="media-right">
  126. {{ formatTime(currentSong.duration) }}
  127. </div>
  128. </article>
  129. <p v-if="noSong" class="center">
  130. There is currently no song playing.
  131. </p>
  132. <article
  133. v-for="(song, index) in songsList"
  134. :key="index"
  135. class="media"
  136. >
  137. <div class="media-content">
  138. <div class="content">
  139. <strong class="songTitle">{{
  140. song.title
  141. }}</strong>
  142. <br />
  143. <small>{{ song.artists.join(", ") }}</small>
  144. <br />
  145. <div v-if="station.partyMode">
  146. <br />
  147. <small>
  148. Requested by
  149. <b>
  150. <user-id-to-username
  151. :userId="song.requestedBy"
  152. :link="true"
  153. />
  154. </b>
  155. </small>
  156. <button
  157. v-if="isOwnerOnly() || isAdminOnly()"
  158. class="button"
  159. @click="removeFromQueue(song.songId)"
  160. >
  161. REMOVE
  162. </button>
  163. </div>
  164. </div>
  165. </div>
  166. <div class="media-right">
  167. {{ formatTime(song.duration) }}
  168. </div>
  169. </article>
  170. <a
  171. v-if="station.type === 'community' && loggedIn"
  172. class="button add-to-queue"
  173. href="#"
  174. @click="
  175. openModal({
  176. sector: 'station',
  177. modal: 'addSongToQueue'
  178. })
  179. "
  180. >Add a song to the queue</a
  181. >
  182. </div>
  183. </div>
  184. <div v-show="!noSong" class="desktop-only columns is-mobile">
  185. <div
  186. class="column is-8-desktop is-offset-2-desktop is-12-mobile"
  187. >
  188. <div class="columns is-mobile">
  189. <div class="column is-12-desktop">
  190. <h4 id="time-display">
  191. {{ timeElapsed }} /
  192. {{ formatTime(currentSong.duration) }}
  193. </h4>
  194. <h3>{{ currentSong.title }}</h3>
  195. <h4 class="thin" style="margin-left: 0">
  196. {{ currentSong.artists }}
  197. </h4>
  198. <div class="columns is-mobile">
  199. <form
  200. style="margin-top: 12px; margin-bottom: 0;"
  201. action="#"
  202. class="column is-7-desktop is-4-mobile"
  203. >
  204. <p class="volume-slider-wrapper">
  205. <i
  206. v-if="muted"
  207. class="material-icons"
  208. @click="toggleMute()"
  209. >volume_mute</i
  210. >
  211. <i
  212. v-else
  213. class="material-icons"
  214. @click="toggleMute()"
  215. >volume_down</i
  216. >
  217. <input
  218. id="volumeSlider"
  219. type="range"
  220. min="0"
  221. max="10000"
  222. class="active"
  223. @change="changeVolume()"
  224. @input="changeVolume()"
  225. />
  226. <i
  227. class="material-icons"
  228. @click="increaseVolume()"
  229. >volume_up</i
  230. >
  231. </p>
  232. </form>
  233. <div
  234. class="column is-8-mobile is-5-desktop"
  235. style="float: right;"
  236. >
  237. <ul
  238. v-if="
  239. currentSong.likes !== -1 &&
  240. currentSong.dislikes !== -1
  241. "
  242. id="ratings"
  243. >
  244. <li
  245. id="like"
  246. class="right"
  247. @click="toggleLike()"
  248. >
  249. <span class="flow-text">{{
  250. currentSong.likes
  251. }}</span>
  252. <i
  253. id="thumbs_up"
  254. class="material-icons grey-text"
  255. :class="{ liked: liked }"
  256. >thumb_up</i
  257. >
  258. <a
  259. class="absolute-a behind"
  260. href="#"
  261. @click="toggleLike()"
  262. />
  263. </li>
  264. <li
  265. id="dislike"
  266. style="margin-right: 10px;"
  267. class="right"
  268. @click="toggleDislike()"
  269. >
  270. <span class="flow-text">{{
  271. currentSong.dislikes
  272. }}</span>
  273. <i
  274. id="thumbs_down"
  275. class="material-icons grey-text"
  276. :class="{
  277. disliked: disliked
  278. }"
  279. >thumb_down</i
  280. >
  281. <a
  282. class="absolute-a behind"
  283. href="#"
  284. @click="toggleDislike()"
  285. />
  286. </li>
  287. </ul>
  288. </div>
  289. </div>
  290. </div>
  291. <div
  292. v-if="!currentSong.simpleSong"
  293. class="column is-3-desktop experimental"
  294. >
  295. <img
  296. class="image"
  297. :src="currentSong.thumbnail"
  298. alt="Song Thumbnail"
  299. onerror="this.src='/assets/notes-transparent.png'"
  300. />
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. <div v-show="!noSong" class="mobile-only">
  306. <div>
  307. <div>
  308. <div>
  309. <h3>{{ currentSong.title }}</h3>
  310. <h4 class="thin">
  311. {{ currentSong.artists }}
  312. </h4>
  313. <h5>
  314. {{ timeElapsed }} /
  315. {{ formatTime(currentSong.duration) }}
  316. </h5>
  317. <div>
  318. <form class="columns" action="#">
  319. <p
  320. class="column is-11-mobile volume-slider-wrapper"
  321. >
  322. <i
  323. v-if="muted"
  324. class="material-icons"
  325. @click="toggleMute()"
  326. >volume_mute</i
  327. >
  328. <i
  329. v-else
  330. class="material-icons"
  331. @click="toggleMute()"
  332. >volume_down</i
  333. >
  334. <input
  335. id="volumeSlider"
  336. type="range"
  337. min="0"
  338. max="10000"
  339. class="active"
  340. @change="changeVolume()"
  341. @input="changeVolume()"
  342. />
  343. <i
  344. class="material-icons"
  345. @click="increaseVolume()"
  346. >volume_up</i
  347. >
  348. </p>
  349. </form>
  350. <div>
  351. <ul
  352. v-if="
  353. currentSong.likes !== -1 &&
  354. currentSong.dislikes !== -1
  355. "
  356. id="ratings"
  357. style="display: inline-block;"
  358. >
  359. <li
  360. id="dislike"
  361. style="display: inline-block;margin-right: 10px;"
  362. @click="toggleDislike()"
  363. >
  364. <span class="flow-text">{{
  365. currentSong.dislikes
  366. }}</span>
  367. <i
  368. id="thumbs_down"
  369. class="material-icons grey-text"
  370. :class="{
  371. disliked: disliked
  372. }"
  373. >thumb_down</i
  374. >
  375. <a
  376. class="absolute-a behind"
  377. href="#"
  378. @click="toggleDislike()"
  379. />
  380. </li>
  381. <li
  382. id="like"
  383. style="display: inline-block;"
  384. @click="toggleLike()"
  385. >
  386. <span class="flow-text">{{
  387. currentSong.likes
  388. }}</span>
  389. <i
  390. id="thumbs_up"
  391. class="material-icons grey-text"
  392. :class="{ liked: liked }"
  393. >thumb_up</i
  394. >
  395. <a
  396. class="absolute-a behind"
  397. href="#"
  398. @click="toggleLike()"
  399. />
  400. </li>
  401. </ul>
  402. </div>
  403. </div>
  404. </div>
  405. </div>
  406. </div>
  407. </div>
  408. </div>
  409. <Z404 v-if="!exists"></Z404>
  410. </div>
  411. </template>
  412. <script>
  413. import { mapState, mapActions } from "vuex";
  414. import { Toast } from "vue-roaster";
  415. import StationHeader from "./StationHeader.vue";
  416. import UserIdToUsername from "../UserIdToUsername.vue";
  417. import Z404 from "../404.vue";
  418. import io from "../../io";
  419. export default {
  420. data() {
  421. return {
  422. title: "Station",
  423. loading: true,
  424. ready: false,
  425. exists: true,
  426. playerReady: false,
  427. player: undefined,
  428. timePaused: 0,
  429. muted: false,
  430. timeElapsed: "0:00",
  431. liked: false,
  432. disliked: false,
  433. sidebars: {
  434. songslist: false,
  435. users: false,
  436. playlist: false
  437. },
  438. timeBeforePause: 0,
  439. skipVotes: 0,
  440. privatePlaylistQueueSelected: null,
  441. automaticallyRequestedSongId: null,
  442. systemDifference: 0,
  443. attemptsToPlayVideo: 0,
  444. canAutoplay: true,
  445. lastTimeRequestedIfCanAutoplay: 0
  446. };
  447. },
  448. computed: {
  449. ...mapState("modals", {
  450. modals: state => state.modals.station
  451. }),
  452. ...mapState("station", {
  453. station: state => state.station,
  454. currentSong: state => state.currentSong,
  455. songsList: state => state.songsList,
  456. paused: state => state.paused,
  457. noSong: state => state.noSong
  458. }),
  459. ...mapState({
  460. loggedIn: state => state.user.auth.loggedIn,
  461. userId: state => state.user.auth.userId,
  462. role: state => state.user.auth.role
  463. })
  464. },
  465. methods: {
  466. isOwnerOnly() {
  467. return this.loggedIn && this.userId === this.station.owner;
  468. },
  469. isAdminOnly() {
  470. return this.loggedIn && this.role === "admin";
  471. },
  472. removeFromQueue(songId) {
  473. window.socket.emit(
  474. "stations.removeFromQueue",
  475. this.station._id,
  476. songId,
  477. res => {
  478. if (res.status === "success") {
  479. Toast.methods.addToast(
  480. "Successfully removed song from the queue.",
  481. 4000
  482. );
  483. } else Toast.methods.addToast(res.message, 8000);
  484. }
  485. );
  486. },
  487. toggleSidebar(type) {
  488. Object.keys(this.sidebars).forEach(sidebar => {
  489. if (sidebar !== type) this.sidebars[sidebar] = false;
  490. else this.sidebars[type] = !this.sidebars[type];
  491. });
  492. },
  493. youtubeReady() {
  494. if (!this.player) {
  495. this.player = new window.YT.Player("player", {
  496. height: 270,
  497. width: 480,
  498. videoId: this.currentSong.songId,
  499. startSeconds:
  500. this.getTimeElapsed() / 1000 +
  501. this.currentSong.skipDuration,
  502. playerVars: {
  503. controls: 0,
  504. iv_load_policy: 3,
  505. rel: 0,
  506. showinfo: 0
  507. },
  508. events: {
  509. onReady: () => {
  510. this.playerReady = true;
  511. let volume = parseInt(
  512. localStorage.getItem("volume")
  513. );
  514. volume = typeof volume === "number" ? volume : 20;
  515. this.player.setVolume(volume);
  516. if (volume > 0) {
  517. this.player.unMute();
  518. }
  519. if (this.muted) this.player.mute();
  520. this.playVideo();
  521. },
  522. onError: err => {
  523. console.log("iframe error", err);
  524. this.voteSkipStation();
  525. },
  526. onStateChange: event => {
  527. if (
  528. event.data === 1 &&
  529. this.videoLoading === true
  530. ) {
  531. this.videoLoading = false;
  532. this.player.seekTo(
  533. this.getTimeElapsed() / 1000 +
  534. this.currentSong.skipDuration,
  535. true
  536. );
  537. if (this.paused) this.player.pauseVideo();
  538. } else if (event.data === 1 && this.paused) {
  539. this.player.seekTo(
  540. this.timeBeforePause / 1000,
  541. true
  542. );
  543. this.player.pauseVideo();
  544. }
  545. if (
  546. event.data === 2 &&
  547. !this.paused &&
  548. !this.noSong &&
  549. this.player.getDuration() / 1000 <
  550. this.currentSong.duration
  551. ) {
  552. this.player.seekTo(
  553. this.getTimeElapsed() / 1000 +
  554. this.currentSong.skipDuration,
  555. true
  556. );
  557. this.player.playVideo();
  558. }
  559. }
  560. }
  561. });
  562. }
  563. },
  564. getTimeElapsed() {
  565. if (this.currentSong) {
  566. let { timePaused } = this;
  567. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  568. return Date.currently() - this.startedAt - timePaused;
  569. }
  570. return 0;
  571. },
  572. playVideo() {
  573. if (this.playerReady) {
  574. this.videoLoading = true;
  575. this.player.loadVideoById(
  576. this.currentSong.songId,
  577. this.getTimeElapsed() / 1000 + this.currentSong.skipDuration
  578. );
  579. if (window.stationInterval !== 0)
  580. clearInterval(window.stationInterval);
  581. window.stationInterval = setInterval(() => {
  582. this.resizeSeekerbar();
  583. this.calculateTimeElapsed();
  584. }, 150);
  585. }
  586. },
  587. resizeSeekerbar() {
  588. if (!this.paused) {
  589. document.getElementsByClassName(
  590. "seeker-bar"
  591. )[0].style.width = `${parseFloat(
  592. (this.getTimeElapsed() / 1000 / this.currentSong.duration) *
  593. 100
  594. )}%`;
  595. }
  596. },
  597. formatTime(duration) {
  598. if (duration) {
  599. if (duration < 0) return "0:00";
  600. const hours = Math.floor(duration / (60 * 60));
  601. const minutes = Math.floor((duration - hours) / 60);
  602. const seconds = Math.floor(
  603. duration - hours * 60 * 60 - minutes * 60
  604. );
  605. const formatHours = () => {
  606. if (hours > 0) {
  607. if (hours < 10) return `0${hours}:`;
  608. return `${hours}:`;
  609. }
  610. return "";
  611. };
  612. return `${formatHours()}${minutes}:${
  613. seconds < 10 ? `0${seconds}` : seconds
  614. }`;
  615. }
  616. return false;
  617. },
  618. calculateTimeElapsed() {
  619. if (
  620. this.playerReady &&
  621. this.currentSong &&
  622. this.player.getPlayerState() === -1
  623. ) {
  624. if (this.attemptsToPlayVideo >= 5) {
  625. if (
  626. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  627. 2000
  628. ) {
  629. this.lastTimeRequestedIfCanAutoplay = Date.now();
  630. window.canAutoplay.video().then(({ result }) => {
  631. if (result) {
  632. this.attemptsToPlayVideo = 0;
  633. this.canAutoplay = true;
  634. } else {
  635. this.canAutoplay = false;
  636. }
  637. });
  638. }
  639. } else {
  640. this.player.playVideo();
  641. this.attemptsToPlayVideo += 1;
  642. }
  643. }
  644. if (!this.paused) {
  645. const timeElapsed = this.getTimeElapsed();
  646. const currentPlayerTime = this.player.getCurrentTime() * 1000;
  647. const difference = timeElapsed - currentPlayerTime;
  648. // console.log(difference123);
  649. if (difference < -200) {
  650. // console.log("Difference0.8");
  651. this.player.setPlaybackRate(0.8);
  652. } else if (difference < -50) {
  653. // console.log("Difference0.9");
  654. this.player.setPlaybackRate(0.9);
  655. } else if (difference < -25) {
  656. // console.log("Difference0.99");
  657. this.player.setPlaybackRate(0.99);
  658. } else if (difference > 200) {
  659. // console.log("Difference1.2");
  660. this.player.setPlaybackRate(1.2);
  661. } else if (difference > 50) {
  662. // console.log("Difference1.1");
  663. this.player.setPlaybackRate(1.1);
  664. } else if (difference > 25) {
  665. // console.log("Difference1.01");
  666. this.player.setPlaybackRate(1.01);
  667. } else if (this.player.getPlaybackRate !== 1.0) {
  668. // console.log("NDifference1.0");
  669. this.player.setPlaybackRate(1.0);
  670. }
  671. }
  672. /* if (this.currentTime !== undefined && this.paused) {
  673. this.timePaused += Date.currently() - this.currentTime;
  674. this.currentTime = undefined;
  675. } */
  676. let { timePaused } = this;
  677. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  678. const duration =
  679. (Date.currently() - this.startedAt - timePaused) / 1000;
  680. const songDuration = this.currentSong.duration;
  681. if (songDuration <= duration) this.player.pauseVideo();
  682. if (!this.paused && duration <= songDuration)
  683. this.timeElapsed = this.formatTime(duration);
  684. },
  685. toggleLock() {
  686. window.socket.emit("stations.toggleLock", this.station._id, res => {
  687. if (res.status === "success") {
  688. Toast.methods.addToast(
  689. "Successfully toggled the queue lock.",
  690. 4000
  691. );
  692. } else Toast.methods.addToast(res.message, 8000);
  693. });
  694. },
  695. changeVolume() {
  696. const volume = document.getElementById("volumeSlider").value;
  697. localStorage.setItem("volume", volume / 100);
  698. if (this.playerReady) {
  699. this.player.setVolume(volume / 100);
  700. if (volume > 0) {
  701. this.player.unMute();
  702. localStorage.setItem("muted", false);
  703. this.muted = false;
  704. }
  705. }
  706. },
  707. resumeLocalStation() {
  708. this.updatePaused(false);
  709. if (!this.noSong) {
  710. if (this.playerReady) {
  711. this.player.seekTo(
  712. this.getTimeElapsed() / 1000 +
  713. this.currentSong.skipDuration
  714. );
  715. this.player.playVideo();
  716. }
  717. }
  718. },
  719. pauseLocalStation() {
  720. this.updatePaused(true);
  721. if (!this.noSong) {
  722. this.timeBeforePause = this.getTimeElapsed();
  723. if (this.playerReady) this.player.pauseVideo();
  724. }
  725. },
  726. skipStation() {
  727. this.socket.emit("stations.forceSkip", this.station._id, data => {
  728. if (data.status !== "success")
  729. Toast.methods.addToast(`Error: ${data.message}`, 8000);
  730. else
  731. Toast.methods.addToast(
  732. "Successfully skipped the station's current song.",
  733. 4000
  734. );
  735. });
  736. },
  737. voteSkipStation() {
  738. this.socket.emit("stations.voteSkip", this.station._id, data => {
  739. if (data.status !== "success")
  740. Toast.methods.addToast(`Error: ${data.message}`, 8000);
  741. else
  742. Toast.methods.addToast(
  743. "Successfully voted to skip the current song.",
  744. 4000
  745. );
  746. });
  747. },
  748. resumeStation() {
  749. this.socket.emit("stations.resume", this.station._id, data => {
  750. if (data.status !== "success")
  751. Toast.methods.addToast(`Error: ${data.message}`, 8000);
  752. else
  753. Toast.methods.addToast(
  754. "Successfully resumed the station.",
  755. 4000
  756. );
  757. });
  758. },
  759. pauseStation() {
  760. this.socket.emit("stations.pause", this.station._id, data => {
  761. if (data.status !== "success")
  762. Toast.methods.addToast(`Error: ${data.message}`, 8000);
  763. else
  764. Toast.methods.addToast(
  765. "Successfully paused the station.",
  766. 4000
  767. );
  768. });
  769. },
  770. toggleMute() {
  771. if (this.playerReady) {
  772. const previousVolume = parseFloat(
  773. localStorage.getItem("volume")
  774. );
  775. const volume =
  776. this.player.getVolume() * 100 <= 0 ? previousVolume : 0;
  777. this.muted = !this.muted;
  778. localStorage.setItem("muted", this.muted);
  779. document.getElementById("volumeSlider").value = volume * 100;
  780. this.player.setVolume(volume);
  781. if (!this.muted) localStorage.setItem("volume", volume);
  782. }
  783. },
  784. increaseVolume() {
  785. if (this.playerReady) {
  786. const previousVolume = parseInt(localStorage.getItem("volume"));
  787. let volume = previousVolume + 5;
  788. if (previousVolume === 0) {
  789. this.muted = false;
  790. localStorage.setItem("muted", false);
  791. }
  792. if (volume > 100) volume = 100;
  793. document.getElementById("volumeSlider").value = volume * 100;
  794. this.player.setVolume(volume);
  795. localStorage.setItem("volume", volume);
  796. }
  797. },
  798. toggleLike() {
  799. if (this.liked)
  800. this.socket.emit(
  801. "songs.unlike",
  802. this.currentSong.songId,
  803. data => {
  804. if (data.status !== "success")
  805. Toast.methods.addToast(
  806. `Error: ${data.message}`,
  807. 8000
  808. );
  809. }
  810. );
  811. else
  812. this.socket.emit(
  813. "songs.like",
  814. this.currentSong.songId,
  815. data => {
  816. if (data.status !== "success")
  817. Toast.methods.addToast(
  818. `Error: ${data.message}`,
  819. 8000
  820. );
  821. }
  822. );
  823. },
  824. toggleDislike() {
  825. if (this.disliked)
  826. return this.socket.emit(
  827. "songs.undislike",
  828. this.currentSong.songId,
  829. data => {
  830. if (data.status !== "success")
  831. Toast.methods.addToast(
  832. `Error: ${data.message}`,
  833. 8000
  834. );
  835. }
  836. );
  837. return this.socket.emit(
  838. "songs.dislike",
  839. this.currentSong.songId,
  840. data => {
  841. if (data.status !== "success")
  842. Toast.methods.addToast(`Error: ${data.message}`, 8000);
  843. }
  844. );
  845. },
  846. addFirstPrivatePlaylistSongToQueue() {
  847. let isInQueue = false;
  848. if (this.station.type === "community") {
  849. this.songsList.forEach(queueSong => {
  850. if (queueSong.requestedBy === this.userId) isInQueue = true;
  851. });
  852. if (!isInQueue && this.privatePlaylistQueueSelected) {
  853. this.socket.emit(
  854. "playlists.getFirstSong",
  855. this.privatePlaylistQueueSelected,
  856. data => {
  857. if (data.status === "success") {
  858. if (data.song.duration < 15 * 60) {
  859. this.automaticallyRequestedSongId =
  860. data.song.songId;
  861. this.socket.emit(
  862. "stations.addToQueue",
  863. this.station._id,
  864. data.song.songId,
  865. data2 => {
  866. if (data2.status === "success") {
  867. this.socket.emit(
  868. "playlists.moveSongToBottom",
  869. this
  870. .privatePlaylistQueueSelected,
  871. data.song.songId,
  872. data3 => {
  873. if (
  874. data3.status ===
  875. "success"
  876. ) {} // eslint-disable-line
  877. }
  878. );
  879. }
  880. }
  881. );
  882. } else {
  883. Toast.methods.addToast(
  884. `Top song in playlist was too long to be added.`,
  885. 3000
  886. );
  887. this.socket.emit(
  888. "playlists.moveSongToBottom",
  889. this.privatePlaylistQueueSelected,
  890. data.song.songId,
  891. data3 => {
  892. if (data3.status === "success") {
  893. setTimeout(() => {
  894. this.addFirstPrivatePlaylistSongToQueue();
  895. }, 3000);
  896. }
  897. }
  898. );
  899. }
  900. }
  901. }
  902. );
  903. }
  904. }
  905. },
  906. join() {
  907. this.socket.emit("stations.join", this.stationName, res => {
  908. if (res.status === "success") {
  909. this.loading = false;
  910. const {
  911. _id,
  912. displayName,
  913. description,
  914. privacy,
  915. locked,
  916. partyMode,
  917. owner,
  918. privatePlaylist,
  919. type
  920. } = res.data;
  921. this.joinStation({
  922. _id,
  923. name: this.stationName,
  924. displayName,
  925. description,
  926. privacy,
  927. locked,
  928. partyMode,
  929. owner,
  930. privatePlaylist,
  931. type
  932. });
  933. const currentSong = res.data.currentSong
  934. ? res.data.currentSong
  935. : {};
  936. if (currentSong.artists)
  937. currentSong.artists = currentSong.artists.join(", ");
  938. this.updateCurrentSong(currentSong);
  939. this.startedAt = res.data.startedAt;
  940. this.updatePaused(res.data.paused);
  941. this.timePaused = res.data.timePaused;
  942. this.updateUserCount(res.data.userCount);
  943. this.updateUsers(res.data.users);
  944. this.pausedAt = res.data.pausedAt;
  945. if (res.data.currentSong) {
  946. this.updateNoSong(false);
  947. this.youtubeReady();
  948. this.playVideo();
  949. this.socket.emit(
  950. "songs.getOwnSongRatings",
  951. res.data.currentSong.songId,
  952. data => {
  953. if (this.currentSong.songId === data.songId) {
  954. this.liked = data.liked;
  955. this.disliked = data.disliked;
  956. }
  957. }
  958. );
  959. } else {
  960. if (this.playerReady) this.player.pauseVideo();
  961. this.updateNoSong(true);
  962. }
  963. // UNIX client time before ping
  964. const beforePing = Date.now();
  965. this.socket.emit("apis.ping", pong => {
  966. // UNIX client time after ping
  967. const afterPing = Date.now();
  968. // Average time in MS it took between the server responding and the client receiving
  969. const connectionLatency = (afterPing - beforePing) / 2;
  970. console.log(connectionLatency, beforePing - afterPing);
  971. // UNIX server time
  972. const serverDate = pong.date;
  973. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  974. const difference =
  975. serverDate + connectionLatency - afterPing;
  976. console.log("Difference: ", difference);
  977. if (difference > 3000 || difference < -3000) {
  978. console.log(
  979. "System time difference is bigger than 3 seconds."
  980. );
  981. }
  982. this.systemDifference = difference;
  983. });
  984. } else {
  985. this.loading = false;
  986. this.exists = false;
  987. }
  988. });
  989. },
  990. ...mapActions("modals", ["openModal"]),
  991. ...mapActions("station", [
  992. "joinStation",
  993. "updateUserCount",
  994. "updateUsers",
  995. "updateCurrentSong",
  996. "updatePreviousSong",
  997. "updateSongsList",
  998. "updatePaused",
  999. "updateNoSong"
  1000. ])
  1001. },
  1002. mounted() {
  1003. Date.currently = () => {
  1004. return new Date().getTime() + this.systemDifference;
  1005. };
  1006. this.stationName = this.$route.params.id;
  1007. window.stationInterval = 0;
  1008. io.getSocket(socket => {
  1009. this.socket = socket;
  1010. io.removeAllListeners();
  1011. if (this.socket.connected) this.join();
  1012. io.onConnect(this.join);
  1013. this.socket.emit("stations.findByName", this.stationName, res => {
  1014. if (res.status === "failure") {
  1015. this.loading = false;
  1016. this.exists = false;
  1017. }
  1018. });
  1019. this.socket.on("event:songs.next", data => {
  1020. const previousSong = this.currentSong.songId
  1021. ? this.currentSong
  1022. : null;
  1023. this.updatePreviousSong(previousSong);
  1024. this.updateCurrentSong(
  1025. data.currentSong ? data.currentSong : {}
  1026. );
  1027. this.startedAt = data.startedAt;
  1028. this.updatePaused(data.paused);
  1029. this.timePaused = data.timePaused;
  1030. if (data.currentSong) {
  1031. this.updateNoSong(false);
  1032. if (this.currentSong.artists)
  1033. this.currentSong.artists = this.currentSong.artists.join(
  1034. ", "
  1035. );
  1036. if (!this.playerReady) this.youtubeReady();
  1037. else this.playVideo();
  1038. this.socket.emit(
  1039. "songs.getOwnSongRatings",
  1040. data.currentSong.songId,
  1041. song => {
  1042. if (this.currentSong.songId === song.songId) {
  1043. this.liked = song.liked;
  1044. this.disliked = song.disliked;
  1045. }
  1046. }
  1047. );
  1048. } else {
  1049. if (this.playerReady) this.player.pauseVideo();
  1050. this.updateNoSong(true);
  1051. }
  1052. let isInQueue = false;
  1053. this.songsList.forEach(queueSong => {
  1054. if (queueSong.requestedBy === this.userId) isInQueue = true;
  1055. });
  1056. if (
  1057. !isInQueue &&
  1058. this.privatePlaylistQueueSelected &&
  1059. (this.automaticallyRequestedSongId !==
  1060. this.currentSong.songId ||
  1061. !this.currentSong.songId)
  1062. ) {
  1063. this.addFirstPrivatePlaylistSongToQueue();
  1064. }
  1065. });
  1066. this.socket.on("event:stations.pause", data => {
  1067. this.pausedAt = data.pausedAt;
  1068. this.pauseLocalStation();
  1069. });
  1070. this.socket.on("event:stations.resume", data => {
  1071. this.timePaused = data.timePaused;
  1072. this.resumeLocalStation();
  1073. });
  1074. this.socket.on("event:stations.remove", () => {
  1075. window.location.href = "/";
  1076. return true;
  1077. });
  1078. this.socket.on("event:song.like", data => {
  1079. if (!this.noSong) {
  1080. if (data.songId === this.currentSong.songId) {
  1081. this.currentSong.dislikes = data.dislikes;
  1082. this.currentSong.likes = data.likes;
  1083. }
  1084. }
  1085. });
  1086. this.socket.on("event:song.dislike", data => {
  1087. if (!this.noSong) {
  1088. if (data.songId === this.currentSong.songId) {
  1089. this.currentSong.dislikes = data.dislikes;
  1090. this.currentSong.likes = data.likes;
  1091. }
  1092. }
  1093. });
  1094. this.socket.on("event:song.unlike", data => {
  1095. if (!this.noSong) {
  1096. if (data.songId === this.currentSong.songId) {
  1097. this.currentSong.dislikes = data.dislikes;
  1098. this.currentSong.likes = data.likes;
  1099. }
  1100. }
  1101. });
  1102. this.socket.on("event:song.undislike", data => {
  1103. if (!this.noSong) {
  1104. if (data.songId === this.currentSong.songId) {
  1105. this.currentSong.dislikes = data.dislikes;
  1106. this.currentSong.likes = data.likes;
  1107. }
  1108. }
  1109. });
  1110. this.socket.on("event:song.newRatings", data => {
  1111. if (!this.noSong) {
  1112. if (data.songId === this.currentSong.songId) {
  1113. this.liked = data.liked;
  1114. this.disliked = data.disliked;
  1115. }
  1116. }
  1117. });
  1118. this.socket.on("event:queue.update", queue => {
  1119. if (this.station.type === "community")
  1120. this.updateSongsList(queue);
  1121. });
  1122. this.socket.on("event:song.voteSkipSong", () => {
  1123. if (this.currentSong) this.currentSong.skipVotes += 1;
  1124. });
  1125. this.socket.on("event:privatePlaylist.selected", playlistId => {
  1126. if (this.station.type === "community") {
  1127. this.station.privatePlaylist = playlistId;
  1128. }
  1129. });
  1130. this.socket.on("event:partyMode.updated", partyMode => {
  1131. if (this.station.type === "community") {
  1132. this.station.partyMode = partyMode;
  1133. }
  1134. });
  1135. this.socket.on("event:newOfficialPlaylist", playlist => {
  1136. if (this.station.type === "official") {
  1137. this.updateSongsList(playlist);
  1138. }
  1139. });
  1140. this.socket.on("event:users.updated", users => {
  1141. this.updateUsers(users);
  1142. });
  1143. this.socket.on("event:userCount.updated", userCount => {
  1144. this.updateUserCount(userCount);
  1145. });
  1146. this.socket.on("event:queueLockToggled", locked => {
  1147. this.station.locked = locked;
  1148. });
  1149. });
  1150. if (JSON.parse(localStorage.getItem("muted"))) {
  1151. this.muted = true;
  1152. this.player.setVolume(0);
  1153. document.getElementById("volumeSlider").value = 0 * 100;
  1154. } else {
  1155. let volume = parseFloat(localStorage.getItem("volume"));
  1156. volume =
  1157. typeof volume === "number" && !Number.isNaN(volume)
  1158. ? volume
  1159. : 20;
  1160. localStorage.setItem("volume", volume);
  1161. document.getElementById("volumeSlider").value = volume * 100;
  1162. }
  1163. },
  1164. components: {
  1165. StationHeader,
  1166. SongQueue: () => import("../Modals/AddSongToQueue.vue"),
  1167. AddToPlaylist: () => import("../Modals/AddSongToPlaylist.vue"),
  1168. EditPlaylist: () => import("../Modals/Playlists/Edit.vue"),
  1169. CreatePlaylist: () => import("../Modals/Playlists/Create.vue"),
  1170. EditStation: () => import("../Modals/EditStation.vue"),
  1171. Report: () => import("../Modals/Report.vue"),
  1172. SongsListSidebar: () => import("../Sidebars/SongsList.vue"),
  1173. PlaylistSidebar: () => import("../Sidebars/Playlist.vue"),
  1174. UsersSidebar: () => import("../Sidebars/UsersList.vue"),
  1175. UserIdToUsername,
  1176. Z404
  1177. }
  1178. };
  1179. </script>
  1180. <style lang="scss">
  1181. @import "styles/global.scss";
  1182. .player-can-not-autoplay {
  1183. position: absolute;
  1184. width: 100%;
  1185. height: 100%;
  1186. background: rgba(3, 169, 244, 0.95);
  1187. display: flex;
  1188. align-items: center;
  1189. justify-content: center;
  1190. p {
  1191. color: $white;
  1192. font-size: 26px;
  1193. text-align: center;
  1194. }
  1195. }
  1196. .slide-enter-active,
  1197. .slide-leave-active {
  1198. transition: all 0.3s ease;
  1199. }
  1200. .slide-enter,
  1201. .slide-leave-to {
  1202. transform: translateX(300px);
  1203. }
  1204. .no-song {
  1205. color: $primary-color;
  1206. text-align: center;
  1207. }
  1208. #volumeSlider {
  1209. padding: 0 15px;
  1210. background: transparent;
  1211. }
  1212. .volume-slider-wrapper {
  1213. margin-top: 0;
  1214. position: relative;
  1215. display: flex;
  1216. align-items: center;
  1217. .material-icons {
  1218. user-select: none;
  1219. }
  1220. }
  1221. .material-icons {
  1222. cursor: pointer;
  1223. }
  1224. .stationDisplayName {
  1225. color: $white !important;
  1226. }
  1227. .add-to-playlist {
  1228. display: flex;
  1229. align-items: center;
  1230. justify-content: center;
  1231. }
  1232. .slideout {
  1233. top: 50px;
  1234. height: 100%;
  1235. position: fixed;
  1236. right: 0;
  1237. width: 350px;
  1238. background-color: $white;
  1239. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1240. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1241. .slideout-header {
  1242. text-align: center;
  1243. background-color: rgb(3, 169, 244) !important;
  1244. margin: 0;
  1245. padding-top: 5px;
  1246. padding-bottom: 7px;
  1247. color: $white;
  1248. }
  1249. .slideout-content {
  1250. height: 100%;
  1251. }
  1252. }
  1253. .modal-large {
  1254. width: 75%;
  1255. }
  1256. .station {
  1257. flex: 1 0 auto;
  1258. padding-top: 0.5vw;
  1259. transition: all 0.1s;
  1260. margin: 0 auto;
  1261. max-width: 100%;
  1262. width: 90%;
  1263. @media only screen and (min-width: 993px) {
  1264. width: 70%;
  1265. }
  1266. @media only screen and (min-width: 601px) {
  1267. width: 85%;
  1268. }
  1269. @media (min-width: 999px) {
  1270. .mobile-only {
  1271. display: none;
  1272. }
  1273. .desktop-only {
  1274. display: block;
  1275. }
  1276. }
  1277. @media (max-width: 998px) {
  1278. .mobile-only {
  1279. display: block;
  1280. }
  1281. .desktop-only {
  1282. display: none;
  1283. visibility: hidden;
  1284. }
  1285. }
  1286. .mobile-only {
  1287. text-align: center;
  1288. }
  1289. .playlistCard {
  1290. margin: 10px;
  1291. position: relative;
  1292. padding-bottom: calc(31.25% + 7px);
  1293. height: 0;
  1294. overflow-y: scroll;
  1295. .title {
  1296. background-color: rgb(3, 169, 244);
  1297. text-align: center;
  1298. padding: 10px;
  1299. color: $white;
  1300. font-weight: 600;
  1301. }
  1302. .media {
  1303. padding: 0 25px;
  1304. }
  1305. .media-content .content {
  1306. min-height: 64px;
  1307. max-height: 64px;
  1308. display: flex;
  1309. align-items: center;
  1310. }
  1311. .content p strong {
  1312. word-break: break-word;
  1313. }
  1314. .content p small {
  1315. word-break: break-word;
  1316. }
  1317. .add-to-queue {
  1318. width: 100%;
  1319. margin-top: 25px;
  1320. height: 40px;
  1321. border-radius: 0;
  1322. background: rgb(3, 169, 244);
  1323. color: $white !important;
  1324. border: 0;
  1325. &:active,
  1326. &:focus {
  1327. border: 0;
  1328. }
  1329. }
  1330. .add-to-queue:focus {
  1331. background: $primary-color;
  1332. }
  1333. .media-right {
  1334. line-height: 64px;
  1335. }
  1336. .songTitle {
  1337. word-wrap: break-word;
  1338. overflow: hidden;
  1339. text-overflow: ellipsis;
  1340. display: -webkit-box;
  1341. -webkit-box-orient: vertical;
  1342. -webkit-line-clamp: 2;
  1343. line-height: 20px;
  1344. max-height: 40px;
  1345. width: 100%;
  1346. }
  1347. }
  1348. input[type="range"] {
  1349. -webkit-appearance: none;
  1350. width: 100%;
  1351. margin: 7.3px 0;
  1352. }
  1353. input[type="range"]:focus {
  1354. outline: none;
  1355. }
  1356. input[type="range"]::-webkit-slider-runnable-track {
  1357. width: 100%;
  1358. height: 5.2px;
  1359. cursor: pointer;
  1360. box-shadow: 0;
  1361. background: $light-grey-2;
  1362. border-radius: 0;
  1363. border: 0;
  1364. }
  1365. input[type="range"]::-webkit-slider-thumb {
  1366. box-shadow: 0;
  1367. border: 0;
  1368. height: 19px;
  1369. width: 19px;
  1370. border-radius: 15px;
  1371. background: $primary-color;
  1372. cursor: pointer;
  1373. -webkit-appearance: none;
  1374. margin-top: -6.5px;
  1375. }
  1376. input[type="range"]::-moz-range-track {
  1377. width: 100%;
  1378. height: 5.2px;
  1379. cursor: pointer;
  1380. box-shadow: 0;
  1381. background: $light-grey-2;
  1382. border-radius: 0;
  1383. border: 0;
  1384. }
  1385. input[type="range"]::-moz-range-thumb {
  1386. box-shadow: 0;
  1387. border: 0;
  1388. height: 19px;
  1389. width: 19px;
  1390. border-radius: 15px;
  1391. background: $primary-color;
  1392. cursor: pointer;
  1393. -webkit-appearance: none;
  1394. margin-top: -6.5px;
  1395. }
  1396. input[type="range"]::-ms-track {
  1397. width: 100%;
  1398. height: 5.2px;
  1399. cursor: pointer;
  1400. box-shadow: 0;
  1401. background: $light-grey-2;
  1402. border-radius: 1.3px;
  1403. }
  1404. input[type="range"]::-ms-fill-lower {
  1405. background: $light-grey-2;
  1406. border: 0;
  1407. border-radius: 0;
  1408. box-shadow: 0;
  1409. }
  1410. input[type="range"]::-ms-fill-upper {
  1411. background: $light-grey-2;
  1412. border: 0;
  1413. border-radius: 0;
  1414. box-shadow: 0;
  1415. }
  1416. input[type="range"]::-ms-thumb {
  1417. box-shadow: 0;
  1418. border: 0;
  1419. height: 15px;
  1420. width: 15px;
  1421. border-radius: 15px;
  1422. background: $primary-color;
  1423. cursor: pointer;
  1424. -webkit-appearance: none;
  1425. margin-top: 1.5px;
  1426. }
  1427. .video-container {
  1428. position: relative;
  1429. padding-bottom: 56.25%;
  1430. height: 0;
  1431. overflow: hidden;
  1432. iframe {
  1433. position: absolute;
  1434. top: 0;
  1435. left: 0;
  1436. width: 100%;
  1437. height: 100%;
  1438. }
  1439. }
  1440. .video-col {
  1441. padding-right: 0.75rem;
  1442. padding-left: 0.75rem;
  1443. }
  1444. }
  1445. .room-title {
  1446. left: 50%;
  1447. -webkit-transform: translateX(-50%);
  1448. transform: translateX(-50%);
  1449. font-size: 2.1em;
  1450. }
  1451. #ratings {
  1452. span {
  1453. font-size: 1.68rem;
  1454. }
  1455. i {
  1456. color: #9e9e9e !important;
  1457. cursor: pointer;
  1458. transition: 0.1s color;
  1459. }
  1460. }
  1461. #time-display {
  1462. margin-top: 30px;
  1463. float: right;
  1464. }
  1465. #thumbs_up:hover,
  1466. #thumbs_up.liked {
  1467. color: $green !important;
  1468. }
  1469. #thumbs_down:hover,
  1470. #thumbs_down.disliked {
  1471. color: $red !important;
  1472. }
  1473. #song-thumbnail {
  1474. max-width: 100%;
  1475. width: 85%;
  1476. }
  1477. .seeker-bar-container {
  1478. position: relative;
  1479. height: 7px;
  1480. display: block;
  1481. width: 100%;
  1482. overflow: hidden;
  1483. }
  1484. .seeker-bar {
  1485. top: 0;
  1486. left: 0;
  1487. bottom: 0;
  1488. position: absolute;
  1489. }
  1490. ul {
  1491. list-style: none;
  1492. margin: 0;
  1493. display: block;
  1494. }
  1495. h1,
  1496. h2,
  1497. h3,
  1498. h4,
  1499. h5,
  1500. h6 {
  1501. font-weight: 400;
  1502. line-height: 1.1;
  1503. }
  1504. h1 a,
  1505. h2 a,
  1506. h3 a,
  1507. h4 a,
  1508. h5 a,
  1509. h6 a {
  1510. font-weight: inherit;
  1511. }
  1512. h1 {
  1513. font-size: 4.2rem;
  1514. line-height: 110%;
  1515. margin: 2.1rem 0 1.68rem 0;
  1516. }
  1517. h2 {
  1518. font-size: 3.56rem;
  1519. line-height: 110%;
  1520. margin: 1.78rem 0 1.424rem 0;
  1521. }
  1522. h3 {
  1523. font-size: 2.92rem;
  1524. line-height: 110%;
  1525. margin: 1.46rem 0 1.168rem 0;
  1526. }
  1527. h4 {
  1528. font-size: 2.28rem;
  1529. line-height: 110%;
  1530. margin: 1.14rem 0 0.912rem 0;
  1531. }
  1532. h5 {
  1533. font-size: 1.64rem;
  1534. line-height: 110%;
  1535. margin: 0.82rem 0 0.656rem 0;
  1536. }
  1537. h6 {
  1538. font-size: 1rem;
  1539. line-height: 110%;
  1540. margin: 0.5rem 0 0.4rem 0;
  1541. }
  1542. .thin {
  1543. font-weight: 200;
  1544. }
  1545. .left {
  1546. float: left !important;
  1547. }
  1548. .right {
  1549. float: right !important;
  1550. }
  1551. .light-blue {
  1552. background-color: $primary-color !important;
  1553. }
  1554. .white {
  1555. background-color: $white !important;
  1556. }
  1557. .btn-search {
  1558. font-size: 14px;
  1559. }
  1560. .menu {
  1561. padding: 0 10px;
  1562. }
  1563. .menu-list li a:hover {
  1564. color: #000 !important;
  1565. }
  1566. .menu-list li {
  1567. display: flex;
  1568. justify-content: space-between;
  1569. }
  1570. .menu-list a {
  1571. /*padding: 0 10px !important;*/
  1572. }
  1573. .menu-list a:hover {
  1574. background-color: transparent;
  1575. }
  1576. .icons-group {
  1577. display: flex;
  1578. }
  1579. #like,
  1580. #dislike {
  1581. position: relative;
  1582. }
  1583. .behind {
  1584. z-index: -1;
  1585. }
  1586. .behind:focus {
  1587. z-index: 0;
  1588. }
  1589. .progress {
  1590. width: 50px;
  1591. animation: rotate 0.8s infinite linear;
  1592. border: 8px solid $primary-color;
  1593. border-right-color: transparent;
  1594. height: 50px;
  1595. position: absolute;
  1596. top: 50%;
  1597. left: 50%;
  1598. }
  1599. @keyframes rotate {
  1600. 0% {
  1601. transform: rotate(0deg);
  1602. }
  1603. 100% {
  1604. transform: rotate(360deg);
  1605. }
  1606. }
  1607. .experimental {
  1608. display: none !important;
  1609. }
  1610. </style>