index.vue 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025
  1. <template>
  2. <div>
  3. <page-metadata
  4. v-if="exists && !loading"
  5. :title="`${station.displayName}`"
  6. />
  7. <page-metadata v-else-if="!exists && !loading" :title="`Not found`" />
  8. <div id="page-loader-container" v-if="loading">
  9. <content-loader
  10. width="1920"
  11. height="1080"
  12. :primary-color="nightmode ? '#222' : '#fff'"
  13. :secondary-color="nightmode ? '#444' : '#ddd'"
  14. preserve-aspect-ratio="none"
  15. id="page-loader-content"
  16. >
  17. <rect x="55" y="105" rx="5" ry="5" width="670" height="149" />
  18. <rect x="55" y="283" rx="5" ry="5" width="670" height="640" />
  19. <rect x="745" y="108" rx="5" ry="5" width="1120" height="672" />
  20. <rect x="745" y="810" rx="5" ry="5" width="1120" height="110" />
  21. </content-loader>
  22. <content-loader
  23. width="1920"
  24. height="1080"
  25. :primary-color="nightmode ? '#222' : '#fff'"
  26. :secondary-color="nightmode ? '#444' : '#ddd'"
  27. preserve-aspect-ratio="none"
  28. id="page-loader-layout"
  29. >
  30. <rect x="0" y="0" rx="0" ry="0" width="1920" height="64" />
  31. <rect x="0" y="980" rx="0" ry="0" width="1920" height="100" />
  32. </content-loader>
  33. </div>
  34. <!-- More simplistic loading animation for mobile users -->
  35. <div v-show="loading" id="mobile-progress-animation" />
  36. <ul
  37. v-if="
  38. currentSong &&
  39. (currentSong.youtubeId === 'l9PxOanFjxQ' ||
  40. currentSong.youtubeId === 'xKVcVSYmesU' ||
  41. currentSong.youtubeId === '60ItHLz5WEA' ||
  42. currentSong.youtubeId === 'e6vkFbtSGm0')
  43. "
  44. class="bg-bubbles"
  45. >
  46. <li></li>
  47. <li></li>
  48. <li></li>
  49. <li></li>
  50. <li></li>
  51. <li></li>
  52. <li></li>
  53. <li></li>
  54. <li></li>
  55. <li></li>
  56. </ul>
  57. <div v-show="!loading && exists">
  58. <main-header />
  59. <div id="station-outer-container">
  60. <div
  61. id="station-inner-container"
  62. :class="{ 'nothing-here': noSong }"
  63. >
  64. <div id="station-left-column" class="column">
  65. <div id="about-station-container" class="quadrant">
  66. <div id="station-info">
  67. <div class="row" id="station-name">
  68. <h1>{{ station.displayName }}</h1>
  69. <i
  70. v-if="station.type === 'official'"
  71. class="material-icons verified-station"
  72. content="Verified Station"
  73. v-tippy
  74. >
  75. check_circle
  76. </i>
  77. <a>
  78. <!-- Favorite Station Button -->
  79. <i
  80. v-if="
  81. loggedIn && station.isFavorited
  82. "
  83. @click.prevent="unfavoriteStation()"
  84. content="Unfavorite Station"
  85. v-tippy
  86. class="material-icons"
  87. >star</i
  88. >
  89. <i
  90. v-if="
  91. loggedIn && !station.isFavorited
  92. "
  93. @click.prevent="favoriteStation()"
  94. class="material-icons"
  95. content="Favorite Station"
  96. v-tippy
  97. >star_border</i
  98. >
  99. </a>
  100. </div>
  101. <p>{{ station.description }}</p>
  102. </div>
  103. <div id="admin-buttons" v-if="isOwnerOrAdmin()">
  104. <!-- (Admin) Pause/Resume Button -->
  105. <button
  106. class="button is-danger"
  107. v-if="stationPaused"
  108. @click="resumeStation()"
  109. >
  110. <i class="material-icons icon-with-button"
  111. >play_arrow</i
  112. >
  113. <span> Resume Station </span>
  114. </button>
  115. <button
  116. class="button is-danger"
  117. @click="pauseStation()"
  118. v-else
  119. >
  120. <i class="material-icons icon-with-button"
  121. >pause</i
  122. >
  123. <span> Pause Station </span>
  124. </button>
  125. <!-- (Admin) Skip Button -->
  126. <button
  127. class="button is-danger"
  128. @click="skipStation()"
  129. >
  130. <i class="material-icons icon-with-button"
  131. >skip_next</i
  132. >
  133. <span> Force Skip </span>
  134. </button>
  135. <!-- (Admin) Station Settings Button -->
  136. <button
  137. class="button is-primary"
  138. @click="openModal('manageStation')"
  139. >
  140. <i class="material-icons icon-with-button"
  141. >settings</i
  142. >
  143. <span> Manage Station </span>
  144. </button>
  145. </div>
  146. </div>
  147. <div id="sidebar-container" class="quadrant">
  148. <station-sidebar />
  149. </div>
  150. </div>
  151. <div id="station-right-column" class="column">
  152. <div class="player-container quadrant" v-show="!noSong">
  153. <div id="video-container">
  154. <div
  155. id="stationPlayer"
  156. style="
  157. width: 100%;
  158. height: 100%;
  159. min-height: 200px;
  160. "
  161. />
  162. <div
  163. class="player-cannot-autoplay"
  164. v-if="!canAutoplay"
  165. @click="increaseVolume()"
  166. >
  167. <p>
  168. Please click anywhere on the screen for
  169. the video to start
  170. </p>
  171. </div>
  172. </div>
  173. <div id="seeker-bar-container">
  174. <div
  175. id="seeker-bar"
  176. :class="{
  177. 'christmas-seeker': christmas,
  178. nyan:
  179. currentSong &&
  180. currentSong.youtubeId ===
  181. 'QH2-TGUlwu4'
  182. }"
  183. />
  184. <div
  185. class="seeker-bar-cover"
  186. :style="{
  187. width: `calc(100% - ${seekerbarPercentage}%)`
  188. }"
  189. ></div>
  190. <img
  191. v-if="
  192. currentSong &&
  193. currentSong.youtubeId === 'QH2-TGUlwu4'
  194. "
  195. src="https://freepngimg.com/thumb/nyan_cat/1-2-nyan-cat-free-download-png.png"
  196. :style="{
  197. position: 'absolute',
  198. top: `-10px`,
  199. left: `${seekerbarPercentage}%`,
  200. width: '50px'
  201. }"
  202. />
  203. <img
  204. v-if="
  205. currentSong &&
  206. (currentSong.youtubeId ===
  207. 'DtVBCG6ThDk' ||
  208. currentSong.youtubeId ===
  209. 'sI66hcu9fIs' ||
  210. currentSong.youtubeId ===
  211. 'iYYRH4apXDo' ||
  212. currentSong.youtubeId ===
  213. 'tRcPA7Fzebw')
  214. "
  215. src="/assets/rocket.svg"
  216. :style="{
  217. position: 'absolute',
  218. top: `-21px`,
  219. left: `calc(${seekerbarPercentage}% - 35px)`,
  220. width: '50px',
  221. transform: 'rotate(45deg)'
  222. }"
  223. />
  224. <img
  225. v-if="
  226. currentSong &&
  227. currentSong.youtubeId === 'jofNR_WkoCE'
  228. "
  229. src="/assets/fox.svg"
  230. :style="{
  231. position: 'absolute',
  232. top: `-21px`,
  233. left: `calc(${seekerbarPercentage}% - 35px)`,
  234. width: '50px',
  235. transform: 'scaleX(-1)',
  236. opacity: 1
  237. }"
  238. />
  239. <img
  240. v-if="
  241. currentSong &&
  242. (currentSong.youtubeId ===
  243. 'l9PxOanFjxQ' ||
  244. currentSong.youtubeId ===
  245. 'xKVcVSYmesU' ||
  246. currentSong.youtubeId ===
  247. '60ItHLz5WEA' ||
  248. currentSong.youtubeId ===
  249. 'e6vkFbtSGm0')
  250. "
  251. src="/assets/old_logo.png"
  252. :style="{
  253. position: 'absolute',
  254. top: `-9px`,
  255. left: `calc(${seekerbarPercentage}% - 22px)`,
  256. 'background-color': 'rgb(96, 199, 169)',
  257. width: '25px',
  258. height: '25px',
  259. 'border-radius': '25px'
  260. }"
  261. />
  262. <img
  263. v-if="
  264. christmas &&
  265. currentSong &&
  266. ![
  267. 'QH2-TGUlwu4',
  268. 'DtVBCG6ThDk',
  269. 'sI66hcu9fIs',
  270. 'iYYRH4apXDo',
  271. 'tRcPA7Fzebw',
  272. 'jofNR_WkoCE',
  273. 'l9PxOanFjxQ',
  274. 'xKVcVSYmesU',
  275. '60ItHLz5WEA',
  276. 'e6vkFbtSGm0'
  277. ].includes(currentSong.youtubeId)
  278. "
  279. src="/assets/santa.png"
  280. :style="{
  281. position: 'absolute',
  282. top: `-30px`,
  283. left: `calc(${seekerbarPercentage}% - 25px)`,
  284. height: '50px',
  285. transform: 'scaleX(-1)'
  286. }"
  287. />
  288. </div>
  289. <div id="control-bar-container">
  290. <div id="left-buttons">
  291. <!-- Debug Box -->
  292. <button
  293. v-if="frontendDevMode === 'development'"
  294. class="button is-primary"
  295. @click="togglePlayerDebugBox()"
  296. @dblclick="resetPlayerDebugBox()"
  297. content="Debug"
  298. v-tippy
  299. >
  300. <i
  301. class="material-icons icon-with-button"
  302. >
  303. bug_report
  304. </i>
  305. </button>
  306. <!-- Local Pause/Resume Button -->
  307. <button
  308. class="button is-primary"
  309. @click="resumeLocalStation()"
  310. id="local-resume"
  311. v-if="localPaused"
  312. content="Unpause Playback"
  313. v-tippy
  314. >
  315. <i class="material-icons">play_arrow</i>
  316. </button>
  317. <button
  318. class="button is-primary"
  319. @click="pauseLocalStation()"
  320. id="local-pause"
  321. v-else
  322. content="Pause Playback"
  323. v-tippy
  324. >
  325. <i class="material-icons">pause</i>
  326. </button>
  327. <!-- Vote to Skip Button -->
  328. <button
  329. v-if="!skipVotesLoaded"
  330. class="button is-primary disabled"
  331. content="Skip votes have not been loaded yet"
  332. v-tippy
  333. >
  334. <i
  335. class="material-icons icon-with-button"
  336. >skip_next</i
  337. >
  338. </button>
  339. <button
  340. v-else-if="loggedIn"
  341. class="button is-primary"
  342. @click="voteSkipStation()"
  343. content="Vote to Skip Song"
  344. v-tippy
  345. >
  346. <i
  347. class="material-icons icon-with-button"
  348. >skip_next</i
  349. >
  350. {{ currentSong.skipVotes }}
  351. </button>
  352. <button
  353. v-else
  354. class="button is-primary disabled"
  355. content="Log in to vote to skip songs"
  356. v-tippy="{ theme: 'info' }"
  357. >
  358. <i
  359. class="material-icons icon-with-button"
  360. >skip_next</i
  361. >
  362. {{ currentSong.skipVotes }}
  363. </button>
  364. </div>
  365. <div id="duration">
  366. <p>
  367. {{ timeElapsed }} /
  368. {{
  369. utils.formatTime(
  370. currentSong.duration
  371. )
  372. }}
  373. </p>
  374. </div>
  375. <p id="volume-control" v-if="!isApple">
  376. <i
  377. class="material-icons"
  378. @click="toggleMute()"
  379. :content="`${
  380. muted ? 'Unmute' : 'Mute'
  381. }`"
  382. v-tippy
  383. >{{
  384. muted
  385. ? "volume_mute"
  386. : volumeSliderValue >= 50
  387. ? "volume_up"
  388. : "volume_down"
  389. }}</i
  390. >
  391. <input
  392. v-model="volumeSliderValue"
  393. type="range"
  394. min="0"
  395. max="100"
  396. class="volume-slider active"
  397. @change="changeVolume()"
  398. @input="changeVolume()"
  399. />
  400. </p>
  401. <div id="right-buttons" v-if="loggedIn">
  402. <!-- Ratings (Like/Dislike) Buttons -->
  403. <div
  404. id="ratings"
  405. v-if="ratingsLoaded && ownRatingsLoaded"
  406. :class="{
  407. liked: currentSong.liked,
  408. disliked: currentSong.disliked
  409. }"
  410. >
  411. <!-- Like Song Button -->
  412. <button
  413. class="button is-success like-song"
  414. id="like-song"
  415. @click="toggleLike()"
  416. content="Like Song"
  417. v-tippy
  418. >
  419. <i
  420. class="material-icons icon-with-button"
  421. :class="{
  422. liked: currentSong.liked
  423. }"
  424. >thumb_up_alt</i
  425. >{{ currentSong.likes }}
  426. </button>
  427. <!-- Dislike Song Button -->
  428. <button
  429. class="button is-danger dislike-song"
  430. id="dislike-song"
  431. @click="toggleDislike()"
  432. content="Dislike Song"
  433. v-tippy
  434. >
  435. <i
  436. class="material-icons icon-with-button"
  437. :class="{
  438. disliked:
  439. currentSong.disliked
  440. }"
  441. >thumb_down_alt</i
  442. >{{ currentSong.dislikes }}
  443. </button>
  444. </div>
  445. <div id="ratings" class="disabled" v-else>
  446. <!-- Like Song Button -->
  447. <button
  448. class="button is-success like-song disabled"
  449. id="like-song"
  450. content="Ratings have not been loaded yet"
  451. v-tippy
  452. >
  453. <i
  454. class="material-icons icon-with-button"
  455. >thumb_up_alt</i
  456. >
  457. </button>
  458. <!-- Dislike Song Button -->
  459. <button
  460. class="button is-danger dislike-song disabled"
  461. id="dislike-song"
  462. content="Ratings have not been loaded yet"
  463. v-tippy
  464. >
  465. <i
  466. class="material-icons icon-with-button"
  467. >thumb_down_alt</i
  468. >
  469. </button>
  470. </div>
  471. <!-- Add Song To Playlist Button & Dropdown -->
  472. <add-to-playlist-dropdown
  473. :song="currentSong"
  474. placement="top-end"
  475. >
  476. <template #button>
  477. <div
  478. id="add-song-to-playlist"
  479. content="Add Song to Playlist"
  480. v-tippy
  481. >
  482. <div class="control has-addons">
  483. <button
  484. class="button is-primary"
  485. >
  486. <i
  487. class="material-icons"
  488. >
  489. playlist_add
  490. </i>
  491. </button>
  492. <button
  493. class="button"
  494. id="dropdown-toggle"
  495. >
  496. <i
  497. class="material-icons"
  498. >
  499. {{
  500. showPlaylistDropdown
  501. ? "expand_more"
  502. : "expand_less"
  503. }}
  504. </i>
  505. </button>
  506. </div>
  507. </div>
  508. </template>
  509. </add-to-playlist-dropdown>
  510. </div>
  511. <div id="right-buttons" v-else>
  512. <!-- Disabled Ratings (Like/Dislike) Buttons -->
  513. <div id="ratings" v-if="ratingsLoaded">
  514. <!-- Disabled Like Song Button -->
  515. <button
  516. class="button is-success disabled"
  517. id="like-song"
  518. content="Log in to like songs"
  519. v-tippy="{ theme: 'info' }"
  520. >
  521. <i
  522. class="material-icons icon-with-button"
  523. >thumb_up_alt</i
  524. >{{ currentSong.likes }}
  525. </button>
  526. <!-- Disabled Dislike Song Button -->
  527. <button
  528. class="button is-danger disabled"
  529. id="dislike-song"
  530. content="Log in to dislike songs"
  531. v-tippy="{ theme: 'info' }"
  532. >
  533. <i
  534. class="material-icons icon-with-button"
  535. >thumb_down_alt</i
  536. >{{ currentSong.dislikes }}
  537. </button>
  538. </div>
  539. <div id="ratings" v-else>
  540. <!-- Disabled Like Song Button -->
  541. <button
  542. class="button is-success disabled"
  543. id="like-song"
  544. content="Ratings have not been loaded yet"
  545. v-tippy="{ theme: 'info' }"
  546. >
  547. <i
  548. class="material-icons icon-with-button"
  549. >thumb_up_alt</i
  550. >
  551. </button>
  552. <!-- Disabled Dislike Song Button -->
  553. <button
  554. class="button is-danger disabled"
  555. id="dislike-song"
  556. content="Ratings have not been loaded yet"
  557. v-tippy="{ theme: 'info' }"
  558. >
  559. <i
  560. class="material-icons icon-with-button"
  561. >thumb_down_alt</i
  562. >
  563. </button>
  564. </div>
  565. <!-- Disabled Add Song To Playlist Button & Dropdown -->
  566. <div id="add-song-to-playlist">
  567. <div class="control has-addons">
  568. <button
  569. class="button is-primary disabled"
  570. content="Log in to add songs to playlist"
  571. v-tippy="{ theme: 'info' }"
  572. >
  573. <i class="material-icons"
  574. >queue</i
  575. >
  576. </button>
  577. </div>
  578. </div>
  579. </div>
  580. </div>
  581. </div>
  582. <p
  583. class="player-container nothing-here-text"
  584. v-if="noSong"
  585. >
  586. No song is currently playing
  587. </p>
  588. <div v-if="!noSong" id="current-next-row">
  589. <div
  590. id="currently-playing-container"
  591. class="quadrant"
  592. :class="{ 'no-currently-playing': noSong }"
  593. >
  594. <song-item
  595. :song="currentSong"
  596. :duration="false"
  597. :requested-by="true"
  598. header="Currently Playing.."
  599. />
  600. </div>
  601. <div
  602. v-if="nextSong"
  603. id="next-up-container"
  604. class="quadrant"
  605. >
  606. <song-item
  607. :song="nextSong"
  608. :duration="false"
  609. :requested-by="true"
  610. header="Next Up.."
  611. />
  612. </div>
  613. </div>
  614. </div>
  615. </div>
  616. <create-playlist v-if="modals.createPlaylist" />
  617. <manage-station
  618. v-if="modals.manageStation"
  619. :station-id="station._id"
  620. sector="station"
  621. />
  622. <edit-song
  623. v-if="modals.editSong"
  624. song-type="songs"
  625. sector="station"
  626. />
  627. <report v-if="modals.report" />
  628. </div>
  629. <main-footer />
  630. </div>
  631. <floating-box id="player-debug-box" ref="playerDebugBox">
  632. <template #body>
  633. <span><b>No song</b>: {{ noSong }}</span>
  634. <span><b>Song id</b>: {{ currentSong._id }}</span>
  635. <span><b>YouTube id</b>: {{ currentSong.youtubeId }}</span>
  636. <span><b>Duration</b>: {{ currentSong.duration }}</span>
  637. <span
  638. ><b>Skip duration</b>: {{ currentSong.skipDuration }}</span
  639. >
  640. <span><b>Loading</b>: {{ loading }}</span>
  641. <span><b>Can autoplay</b>: {{ canAutoplay }}</span>
  642. <span><b>Player ready</b>: {{ playerReady }}</span>
  643. <span
  644. ><b>Attempts to play video</b>:
  645. {{ attemptsToPlayVideo }}</span
  646. >
  647. <span
  648. ><b>Last time requested if can autoplay</b>:
  649. {{ lastTimeRequestedIfCanAutoplay }}</span
  650. >
  651. <span><b>Seeking</b>: {{ seeking }}</span>
  652. <span><b>Playback rate</b>: {{ playbackRate }}</span>
  653. <span><b>System difference</b>: {{ systemDifference }}</span>
  654. <span><b>Time before paused</b>: {{ timeBeforePause }}</span>
  655. <span><b>Time paused</b>: {{ timePaused }}</span>
  656. <span><b>Time elapsed</b>: {{ timeElapsed }}</span>
  657. <span><b>Volume slider value</b>: {{ volumeSliderValue }}</span>
  658. <span><b>Local paused</b>: {{ localPaused }}</span>
  659. <span><b>Station paused</b>: {{ stationPaused }}</span>
  660. <span
  661. ><b>Requests enabled</b>:
  662. {{ station.requests.enabled }}</span
  663. >
  664. <span
  665. ><b>Requests access</b>: {{ station.requests.access }}</span
  666. >
  667. <span><b>Requests limit</b>: {{ station.requests.limit }}</span>
  668. <span
  669. ><b>Auto requesting playlists</b>:
  670. {{
  671. autoRequest.map(playlist => playlist._id).join(", ")
  672. }}</span
  673. >
  674. <span
  675. ><b>Autofill enabled</b>:
  676. {{ station.autofill.enabled }}</span
  677. >
  678. <span><b>Autofill limit</b>: {{ station.autofill.limit }}</span>
  679. <span><b>Autofill mode</b>: {{ station.autofill.mode }}</span>
  680. <span><b>Skip votes loaded</b>: {{ skipVotesLoaded }}</span>
  681. <span
  682. ><b>Skip votes current</b>:
  683. {{
  684. currentSong.skipVotesCurrent === true ||
  685. currentSong.skipVotesCurrent === false
  686. ? currentSong.skipVotesCurrent
  687. : "N/A"
  688. }}</span
  689. >
  690. <span
  691. ><b>Skip votes</b>:
  692. {{ skipVotesLoaded ? currentSong.skipVotes : "N/A" }}</span
  693. >
  694. <span><b>Ratings loaded</b>: {{ ratingsLoaded }}</span>
  695. <span
  696. ><b>Ratings</b>:
  697. {{
  698. ratingsLoaded
  699. ? `${currentSong.likes} / ${currentSong.dislikes}`
  700. : "N/A"
  701. }}</span
  702. >
  703. <span><b>Own ratings loaded</b>: {{ ownRatingsLoaded }}</span>
  704. <span
  705. ><b>Own ratings</b>:
  706. {{
  707. ownRatingsLoaded
  708. ? `${currentSong.liked} / ${currentSong.disliked}`
  709. : "N/A"
  710. }}</span
  711. >
  712. </template>
  713. </floating-box>
  714. <floating-box
  715. id="keyboardShortcutsHelper"
  716. ref="keyboardShortcutsHelper"
  717. >
  718. <template #body>
  719. <div>
  720. <div v-if="isOwnerOrAdmin()">
  721. <span class="biggest"><b>Admin/owner</b></span>
  722. <span><b>Ctrl + Space</b> - Pause/resume station</span>
  723. <span><b>Ctrl + Numpad right</b> - Skip station</span>
  724. </div>
  725. <hr v-if="isOwnerOrAdmin()" />
  726. <div>
  727. <span class="biggest"><b>Volume</b></span>
  728. <span
  729. ><b>Ctrl + Numpad up/down</b> - Volume up/down
  730. 10%</span
  731. >
  732. <span
  733. ><b>Ctrl + Shift + Numpad up/down</b> - Volume
  734. up/down 10%</span
  735. >
  736. </div>
  737. <hr />
  738. <div>
  739. <span class="biggest"><b>Misc</b></span>
  740. <span><b>Ctrl + D</b> - Toggles debug box</span>
  741. <span><b>Ctrl + Shift + D</b> - Resets debug box</span>
  742. <span
  743. ><b>Ctrl + /</b> - Toggles keyboard shortcuts
  744. box</span
  745. >
  746. <span
  747. ><b>Ctrl + Shift + /</b> - Resets keyboard shortcuts
  748. box</span
  749. >
  750. </div>
  751. </div>
  752. </template>
  753. </floating-box>
  754. <Z404 v-if="!exists"></Z404>
  755. </div>
  756. </template>
  757. <script>
  758. import { mapState, mapActions, mapGetters } from "vuex";
  759. import { defineAsyncComponent } from "vue";
  760. import Toast from "toasters";
  761. import { ContentLoader } from "vue-content-loader";
  762. import canAutoPlay from "can-autoplay";
  763. import aw from "@/aw";
  764. import ms from "@/ms";
  765. import ws from "@/ws";
  766. import keyboardShortcuts from "@/keyboardShortcuts";
  767. import FloatingBox from "@/components/FloatingBox.vue";
  768. import AddToPlaylistDropdown from "@/components/AddToPlaylistDropdown.vue";
  769. import SongItem from "@/components/SongItem.vue";
  770. import Z404 from "../404.vue";
  771. import utils from "../../../js/utils";
  772. import StationSidebar from "./Sidebar/index.vue";
  773. export default {
  774. components: {
  775. ContentLoader,
  776. CreatePlaylist: defineAsyncComponent(() =>
  777. import("@/components/modals/CreatePlaylist.vue")
  778. ),
  779. ManageStation: defineAsyncComponent(() =>
  780. import("@/components/modals/ManageStation/index.vue")
  781. ),
  782. Report: defineAsyncComponent(() =>
  783. import("@/components/modals/Report.vue")
  784. ),
  785. Z404,
  786. FloatingBox,
  787. StationSidebar,
  788. AddToPlaylistDropdown,
  789. EditSong: defineAsyncComponent(() =>
  790. import("@/components/modals/EditSong")
  791. ),
  792. SongItem
  793. },
  794. data() {
  795. return {
  796. utils,
  797. isApple:
  798. navigator.platform.match(/iPhone|iPod|iPad/) ||
  799. navigator.vendor === "Apple Computer, Inc.",
  800. title: "Station",
  801. loading: true,
  802. exists: true,
  803. playerReady: false,
  804. player: undefined,
  805. timePaused: 0,
  806. muted: false,
  807. timeElapsed: "0:00",
  808. timeBeforePause: 0,
  809. systemDifference: 0,
  810. attemptsToPlayVideo: 0,
  811. canAutoplay: true,
  812. lastTimeRequestedIfCanAutoplay: 0,
  813. seeking: false,
  814. playbackRate: 1,
  815. volumeSliderValue: 0,
  816. showPlaylistDropdown: false,
  817. theme: "var(--primary-color)",
  818. seekerbarPercentage: 0,
  819. frontendDevMode: "production",
  820. activityWatchVideoDataInterval: null,
  821. activityWatchVideoLastStatus: "",
  822. activityWatchVideoLastYouTubeId: "",
  823. activityWatchVideoLastStartDuration: "",
  824. nextCurrentSong: null,
  825. editSongModalWatcher: null,
  826. beforeEditSongModalLocalPaused: null,
  827. socketConnected: null,
  828. persistentToastCheckerInterval: null,
  829. persistentToasts: [],
  830. mediasession: false,
  831. christmas: false,
  832. sitename: "Musare"
  833. };
  834. },
  835. computed: {
  836. skipVotesLoaded() {
  837. return (
  838. !this.noSong &&
  839. Number.isInteger(this.currentSong.skipVotes) &&
  840. this.currentSong.skipVotes >= 0
  841. );
  842. },
  843. ratingsLoaded() {
  844. return (
  845. !this.noSong &&
  846. Number.isInteger(this.currentSong.likes) &&
  847. Number.isInteger(this.currentSong.dislikes) &&
  848. this.currentSong.likes >= 0 &&
  849. this.currentSong.dislikes >= 0
  850. );
  851. },
  852. ownRatingsLoaded() {
  853. return (
  854. !this.noSong &&
  855. typeof this.currentSong.liked === "boolean" &&
  856. typeof this.currentSong.disliked === "boolean"
  857. );
  858. },
  859. aModalIsOpen() {
  860. return Object.keys(this.currentlyActive).length > 0;
  861. },
  862. currentUserQueueSongs() {
  863. return this.songsList.filter(
  864. queueSong => queueSong.requestedBy === this.userId
  865. ).length;
  866. },
  867. ...mapState("modalVisibility", {
  868. modals: state => state.modals,
  869. currentlyActive: state => state.currentlyActive
  870. }),
  871. ...mapState("modals/editSong", {
  872. video: state => state.video
  873. }),
  874. ...mapState("station", {
  875. station: state => state.station,
  876. currentSong: state => state.currentSong,
  877. nextSong: state => state.nextSong,
  878. songsList: state => state.songsList,
  879. stationPaused: state => state.stationPaused,
  880. localPaused: state => state.localPaused,
  881. noSong: state => state.noSong,
  882. autoRequest: state => state.autoRequest,
  883. autofill: state => state.autofill,
  884. blacklist: state => state.blacklist
  885. }),
  886. ...mapState({
  887. loggedIn: state => state.user.auth.loggedIn,
  888. userId: state => state.user.auth.userId,
  889. role: state => state.user.auth.role,
  890. nightmode: state => state.user.preferences.nightmode,
  891. autoSkipDisliked: state => state.user.preferences.autoSkipDisliked
  892. }),
  893. ...mapGetters({
  894. socket: "websockets/getSocket"
  895. })
  896. },
  897. async mounted() {
  898. this.editSongModalWatcher = this.$store.watch(
  899. state => state.modals.editSong.video.paused,
  900. paused => {
  901. if (paused && !this.beforeEditSongModalLocalPaused) {
  902. this.resumeLocalStation();
  903. } else if (!paused) {
  904. this.beforeEditSongModalLocalPaused = this.localPaused;
  905. this.pauseLocalStation();
  906. }
  907. }
  908. );
  909. window.scrollTo(0, 0);
  910. Date.currently = () => new Date().getTime() + this.systemDifference;
  911. this.stationIdentifier = this.$route.params.id;
  912. window.stationInterval = 0;
  913. this.activityWatchVideoDataInterval = setInterval(() => {
  914. this.sendActivityWatchVideoData();
  915. }, 1000);
  916. this.persistentToastCheckerInterval = setInterval(() => {
  917. this.persistentToasts.filter(
  918. persistentToast => !persistentToast.checkIfCanRemove()
  919. );
  920. }, 1000);
  921. if (this.socket.readyState === 1) this.join();
  922. ws.onConnect(() => {
  923. this.socketConnected = true;
  924. clearTimeout(window.stationNextSongTimeout);
  925. this.join();
  926. });
  927. ws.onDisconnect(true, () => {
  928. this.socketConnected = false;
  929. const { currentSong } = this.currentSong;
  930. if (this.nextSong)
  931. this.setNextCurrentSong(
  932. {
  933. currentSong: this.nextSong,
  934. startedAt: Date.now() + this.getTimeRemaining(),
  935. paused: false,
  936. timePaused: 0
  937. },
  938. true
  939. );
  940. else
  941. this.setNextCurrentSong(
  942. {
  943. currentSong: null,
  944. startedAt: 0,
  945. paused: false,
  946. timePaused: 0,
  947. pausedAt: 0
  948. },
  949. true
  950. );
  951. window.stationNextSongTimeout = setTimeout(() => {
  952. if (!this.noSong && this.currentSong._id === currentSong._id)
  953. this.skipSong("window.stationNextSongTimeout 2");
  954. }, this.getTimeRemaining());
  955. });
  956. this.frontendDevMode = await lofig.get("mode");
  957. this.mediasession = await lofig.get("siteSettings.mediasession");
  958. this.christmas = await lofig.get("siteSettings.christmas");
  959. this.sitename = await lofig.get("siteSettings.sitename");
  960. this.socket.dispatch(
  961. "stations.existsByName",
  962. this.stationIdentifier,
  963. res => {
  964. if (res.status === "error" || !res.data.exists) {
  965. // station identifier may be using stationid instead
  966. this.socket.dispatch(
  967. "stations.existsById",
  968. this.stationIdentifier,
  969. res => {
  970. if (res.status === "error" || !res.data.exists) {
  971. this.loading = false;
  972. this.exists = false;
  973. }
  974. }
  975. );
  976. }
  977. }
  978. );
  979. ms.setListeners(0, {
  980. play: () => {
  981. if (this.isOwnerOrAdmin()) this.resumeStation();
  982. else this.resumeLocalStation();
  983. },
  984. pause: () => {
  985. if (this.isOwnerOrAdmin()) this.pauseStation();
  986. else this.pauseLocalStation();
  987. },
  988. nexttrack: () => {
  989. if (this.isOwnerOrAdmin()) this.skipStation();
  990. else this.voteSkipStation();
  991. }
  992. });
  993. this.socket.on("event:station.nextSong", res => {
  994. const { currentSong, startedAt, paused, timePaused } = res.data;
  995. this.setCurrentSong({
  996. currentSong,
  997. startedAt,
  998. paused,
  999. timePaused,
  1000. pausedAt: 0
  1001. });
  1002. });
  1003. this.socket.on("event:station.pause", res => {
  1004. this.pausedAt = res.data.pausedAt;
  1005. this.updateStationPaused(true);
  1006. this.pauseLocalPlayer();
  1007. clearTimeout(window.stationNextSongTimeout);
  1008. });
  1009. this.socket.on("event:station.resume", res => {
  1010. this.timePaused = res.data.timePaused;
  1011. this.updateStationPaused(false);
  1012. if (!this.localPaused) this.resumeLocalPlayer();
  1013. });
  1014. this.socket.on("event:station.deleted", () => {
  1015. window.location.href = "/?msg=The station you were in was deleted.";
  1016. return true;
  1017. });
  1018. this.socket.on("event:song.liked", res => {
  1019. if (!this.noSong) {
  1020. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1021. this.updateCurrentSongRatings(res.data);
  1022. }
  1023. }
  1024. });
  1025. this.socket.on("event:song.disliked", res => {
  1026. if (!this.noSong) {
  1027. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1028. this.updateCurrentSongRatings(res.data);
  1029. }
  1030. }
  1031. });
  1032. this.socket.on("event:song.unliked", res => {
  1033. if (!this.noSong) {
  1034. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1035. this.updateCurrentSongRatings(res.data);
  1036. }
  1037. }
  1038. });
  1039. this.socket.on("event:song.undisliked", res => {
  1040. if (!this.noSong) {
  1041. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1042. this.updateCurrentSongRatings(res.data);
  1043. }
  1044. }
  1045. });
  1046. this.socket.on("event:song.ratings.updated", res => {
  1047. if (!this.noSong) {
  1048. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1049. this.updateOwnCurrentSongRatings(res.data);
  1050. }
  1051. }
  1052. });
  1053. this.socket.on("event:station.queue.updated", res => {
  1054. this.updateSongsList(res.data.queue);
  1055. let nextSong = null;
  1056. if (this.songsList[0])
  1057. nextSong = this.songsList[0].youtubeId
  1058. ? this.songsList[0]
  1059. : null;
  1060. this.updateNextSong(nextSong);
  1061. });
  1062. this.socket.on("event:station.queue.song.repositioned", res => {
  1063. this.repositionSongInList(res.data.song);
  1064. let nextSong = null;
  1065. if (this.songsList[0])
  1066. nextSong = this.songsList[0].youtubeId
  1067. ? this.songsList[0]
  1068. : null;
  1069. this.updateNextSong(nextSong);
  1070. });
  1071. this.socket.on("event:station.voteSkipSong", () => {
  1072. if (this.currentSong)
  1073. this.updateCurrentSongSkipVotes({
  1074. skipVotes: this.currentSong.skipVotes + 1,
  1075. skipVotesCurrent: null
  1076. });
  1077. });
  1078. this.socket.on("event:station.updated", async res => {
  1079. const { name, theme, privacy } = res.data.station;
  1080. if (!this.isOwnerOrAdmin() && privacy === "private") {
  1081. window.location.href =
  1082. "/?msg=The station you were in was made private.";
  1083. } else {
  1084. if (this.station.name !== name) {
  1085. await this.$router.push(
  1086. `${name}?${Object.keys(this.$route.query)
  1087. .map(
  1088. key =>
  1089. `${encodeURIComponent(
  1090. key
  1091. )}=${encodeURIComponent(
  1092. this.$route.query[key]
  1093. )}`
  1094. )
  1095. .join("&")}`
  1096. );
  1097. // eslint-disable-next-line no-restricted-globals
  1098. history.replaceState({ ...history.state, ...{} }, null);
  1099. }
  1100. if (this.station.theme !== theme)
  1101. document.getElementsByTagName(
  1102. "html"
  1103. )[0].style.cssText = `--primary-color: var(--${theme})`;
  1104. this.updateStation(res.data.station);
  1105. }
  1106. });
  1107. this.socket.on("event:station.users.updated", res =>
  1108. this.updateUsers(res.data.users)
  1109. );
  1110. this.socket.on("event:station.userCount.updated", res =>
  1111. this.updateUserCount(res.data.userCount)
  1112. );
  1113. this.socket.on("event:user.station.favorited", res => {
  1114. if (res.data.stationId === this.station._id)
  1115. this.updateIfStationIsFavorited({ isFavorited: true });
  1116. });
  1117. this.socket.on("event:user.station.unfavorited", res => {
  1118. if (res.data.stationId === this.station._id)
  1119. this.updateIfStationIsFavorited({ isFavorited: false });
  1120. });
  1121. if (JSON.parse(localStorage.getItem("muted"))) {
  1122. this.muted = true;
  1123. this.player.setVolume(0);
  1124. this.volumeSliderValue = 0;
  1125. } else {
  1126. let volume = parseFloat(localStorage.getItem("volume"));
  1127. volume =
  1128. typeof volume === "number" && !Number.isNaN(volume)
  1129. ? volume
  1130. : 20;
  1131. localStorage.setItem("volume", volume);
  1132. this.volumeSliderValue = volume;
  1133. }
  1134. },
  1135. beforeUnmount() {
  1136. document.getElementsByTagName("html")[0].style.cssText = "";
  1137. if (this.mediasession) {
  1138. ms.removeListeners(0);
  1139. ms.removeMediaSessionData(0);
  1140. }
  1141. /** Reset Songslist */
  1142. this.updateSongsList([]);
  1143. const shortcutNames = [
  1144. "station.pauseResume",
  1145. "station.skipStation",
  1146. "station.lowerVolumeLarge",
  1147. "station.lowerVolumeSmall",
  1148. "station.increaseVolumeLarge",
  1149. "station.increaseVolumeSmall",
  1150. "station.toggleDebug"
  1151. ];
  1152. shortcutNames.forEach(shortcutName => {
  1153. keyboardShortcuts.unregisterShortcut(shortcutName);
  1154. });
  1155. this.editSongModalWatcher(); // removes the watcher
  1156. clearInterval(this.activityWatchVideoDataInterval);
  1157. clearTimeout(window.stationNextSongTimeout);
  1158. clearTimeout(this.persistentToastCheckerInterval);
  1159. this.persistentToasts.forEach(persistentToast => {
  1160. persistentToast.toast.destroy();
  1161. });
  1162. this.socket.dispatch("stations.leave", this.station._id, () => {});
  1163. this.leaveStation();
  1164. },
  1165. methods: {
  1166. isOwnerOnly() {
  1167. return this.loggedIn && this.userId === this.station.owner;
  1168. },
  1169. isAdminOnly() {
  1170. return this.loggedIn && this.role === "admin";
  1171. },
  1172. isOwnerOrAdmin() {
  1173. return this.isOwnerOnly() || this.isAdminOnly();
  1174. },
  1175. updateMediaSessionData(currentSong) {
  1176. if (currentSong) {
  1177. ms.setMediaSessionData(
  1178. 0,
  1179. !this.localPaused && !this.stationPaused, // This should be improved later
  1180. this.currentSong.title,
  1181. this.currentSong.artists.join(", "),
  1182. null,
  1183. this.currentSong.thumbnail
  1184. );
  1185. } else ms.removeMediaSessionData(0);
  1186. },
  1187. removeFromQueue(youtubeId) {
  1188. window.socket.dispatch(
  1189. "stations.removeFromQueue",
  1190. this.station._id,
  1191. youtubeId,
  1192. res => {
  1193. if (res.status === "success") {
  1194. new Toast("Successfully removed song from the queue.");
  1195. } else new Toast(res.message);
  1196. }
  1197. );
  1198. },
  1199. setNextCurrentSong(nextCurrentSong, skipSkipCheck = false) {
  1200. this.nextCurrentSong = nextCurrentSong;
  1201. // If skipSkipCheck is true, it won't try to skip the song
  1202. if (this.getTimeRemaining() <= 0 && !skipSkipCheck) {
  1203. this.skipSong();
  1204. }
  1205. },
  1206. skipSong() {
  1207. if (this.nextCurrentSong && this.nextCurrentSong.currentSong) {
  1208. const songsList = this.songsList.concat([]);
  1209. if (
  1210. songsList.length > 0 &&
  1211. songsList[0].youtubeId ===
  1212. this.nextCurrentSong.currentSong.youtubeId
  1213. ) {
  1214. songsList.splice(0, 1);
  1215. this.updateSongsList(songsList);
  1216. }
  1217. this.setCurrentSong(this.nextCurrentSong);
  1218. } else {
  1219. this.setCurrentSong({
  1220. currentSong: null,
  1221. startedAt: 0,
  1222. paused: this.stationPaused,
  1223. timePaused: 0,
  1224. pausedAt: 0
  1225. });
  1226. }
  1227. },
  1228. setCurrentSong(data) {
  1229. const { currentSong, startedAt, paused, timePaused, pausedAt } =
  1230. data;
  1231. if (currentSong) {
  1232. if (!currentSong.skipDuration || currentSong.skipDuration < 0)
  1233. currentSong.skipDuration = 0;
  1234. if (!currentSong.duration || currentSong.duration < 0)
  1235. currentSong.duration = 0;
  1236. }
  1237. this.updateCurrentSong(currentSong || {});
  1238. let nextSong = null;
  1239. if (this.songsList[0])
  1240. nextSong = this.songsList[0].youtubeId
  1241. ? this.songsList[0]
  1242. : null;
  1243. this.updateNextSong(nextSong);
  1244. this.setNextCurrentSong(
  1245. {
  1246. currentSong: null,
  1247. startedAt: 0,
  1248. paused,
  1249. timePaused: 0,
  1250. pausedAt: 0
  1251. },
  1252. true
  1253. );
  1254. clearTimeout(window.stationNextSongTimeout);
  1255. if (this.mediasession) this.updateMediaSessionData(currentSong);
  1256. this.startedAt = startedAt;
  1257. this.updateStationPaused(paused);
  1258. this.timePaused = timePaused;
  1259. this.pausedAt = pausedAt;
  1260. if (currentSong) {
  1261. this.updateNoSong(false);
  1262. if (!this.playerReady) this.youtubeReady();
  1263. else this.playVideo();
  1264. // If the station is playing and the backend is not connected, set the next song to skip to after this song and set a timer to skip
  1265. if (!this.stationPaused && !this.socketConnected) {
  1266. if (this.nextSong)
  1267. this.setNextCurrentSong(
  1268. {
  1269. currentSong: this.nextSong,
  1270. startedAt: Date.now() + this.getTimeRemaining(),
  1271. paused: false,
  1272. timePaused: 0
  1273. },
  1274. true
  1275. );
  1276. else
  1277. this.setNextCurrentSong(
  1278. {
  1279. currentSong: null,
  1280. startedAt: 0,
  1281. paused: false,
  1282. timePaused: 0,
  1283. pausedAt: 0
  1284. },
  1285. true
  1286. );
  1287. window.stationNextSongTimeout = setTimeout(() => {
  1288. if (
  1289. !this.noSong &&
  1290. this.currentSong._id === currentSong._id
  1291. )
  1292. this.skipSong("window.stationNextSongTimeout 1");
  1293. }, this.getTimeRemaining());
  1294. }
  1295. const currentSongId = this.currentSong._id;
  1296. this.socket.dispatch(
  1297. "stations.getSkipVotes",
  1298. this.station._id,
  1299. currentSongId,
  1300. res => {
  1301. if (res.status === "success") {
  1302. const { skipVotes, skipVotesCurrent } = res.data;
  1303. if (
  1304. !this.noSong &&
  1305. this.currentSong._id === currentSongId
  1306. ) {
  1307. this.updateCurrentSongSkipVotes({
  1308. skipVotes,
  1309. skipVotesCurrent
  1310. });
  1311. }
  1312. }
  1313. }
  1314. );
  1315. this.socket.dispatch(
  1316. "songs.getSongRatings",
  1317. currentSong._id,
  1318. res => {
  1319. if (currentSong._id === this.currentSong._id) {
  1320. const { likes, dislikes } = res.data;
  1321. this.updateCurrentSongRatings({ likes, dislikes });
  1322. }
  1323. }
  1324. );
  1325. if (this.loggedIn) {
  1326. this.socket.dispatch(
  1327. "songs.getOwnSongRatings",
  1328. currentSong.youtubeId,
  1329. res => {
  1330. console.log("getOwnSongRatings", res);
  1331. if (
  1332. res.status === "success" &&
  1333. this.currentSong.youtubeId ===
  1334. res.data.youtubeId
  1335. ) {
  1336. this.updateOwnCurrentSongRatings(res.data);
  1337. if (
  1338. this.autoSkipDisliked &&
  1339. res.data.disliked === true
  1340. ) {
  1341. this.voteSkipStation();
  1342. new Toast(
  1343. "Automatically voted to skip disliked song."
  1344. );
  1345. }
  1346. }
  1347. }
  1348. );
  1349. }
  1350. } else {
  1351. if (this.playerReady) this.player.stopVideo();
  1352. this.updateNoSong(true);
  1353. }
  1354. this.calculateTimeElapsed();
  1355. this.resizeSeekerbar();
  1356. },
  1357. youtubeReady() {
  1358. if (!this.player) {
  1359. ms.setYTReady(false);
  1360. this.player = new window.YT.Player("stationPlayer", {
  1361. height: 270,
  1362. width: 480,
  1363. videoId: this.currentSong.youtubeId,
  1364. host: "https://www.youtube-nocookie.com",
  1365. startSeconds:
  1366. this.getTimeElapsed() / 1000 +
  1367. this.currentSong.skipDuration,
  1368. playerVars: {
  1369. controls: 0,
  1370. iv_load_policy: 3,
  1371. rel: 0,
  1372. showinfo: 0,
  1373. disablekb: 1,
  1374. playsinline: 1
  1375. },
  1376. events: {
  1377. onReady: () => {
  1378. this.playerReady = true;
  1379. ms.setYTReady(true);
  1380. let volume = parseFloat(
  1381. localStorage.getItem("volume")
  1382. );
  1383. volume = typeof volume === "number" ? volume : 20;
  1384. this.player.setVolume(volume);
  1385. if (volume > 0) this.player.unMute();
  1386. if (this.muted) this.player.mute();
  1387. this.playVideo();
  1388. // on ios, playback will be forcibly paused locally
  1389. if (this.isApple) {
  1390. this.updateLocalPaused(true);
  1391. new Toast(
  1392. `Please click play manually to use ${this.sitename} on iOS.`
  1393. );
  1394. }
  1395. },
  1396. onError: err => {
  1397. console.log("error with youtube video", err);
  1398. if (err.data === 150 && this.loggedIn) {
  1399. new Toast(
  1400. "Automatically voted to skip as this song isn't available for you."
  1401. );
  1402. // automatically vote to skip
  1403. this.voteSkipStation();
  1404. // persistent message while song is playing
  1405. const persistentToast = new Toast({
  1406. content:
  1407. "This song is unavailable for you, but is playing for everyone else.",
  1408. persistent: true
  1409. });
  1410. // save current song id
  1411. const erroredYoutubeId =
  1412. this.currentSong.youtubeId;
  1413. this.persistentToasts.push({
  1414. toast: persistentToast,
  1415. checkIfCanRemove: () => {
  1416. if (
  1417. this.currentSong.youtubeId !==
  1418. erroredYoutubeId
  1419. ) {
  1420. persistentToast.destroy();
  1421. return true;
  1422. }
  1423. return false;
  1424. }
  1425. });
  1426. } else {
  1427. new Toast(
  1428. "There has been an error with the YouTube Embed"
  1429. );
  1430. }
  1431. },
  1432. onStateChange: event => {
  1433. if (
  1434. event.data === window.YT.PlayerState.PLAYING &&
  1435. this.videoLoading === true
  1436. ) {
  1437. this.videoLoading = false;
  1438. this.player.seekTo(
  1439. this.getTimeElapsed() / 1000 +
  1440. this.currentSong.skipDuration,
  1441. true
  1442. );
  1443. this.canAutoplay = true;
  1444. if (this.localPaused || this.stationPaused)
  1445. this.player.pauseVideo();
  1446. } else if (
  1447. event.data === window.YT.PlayerState.PLAYING &&
  1448. (this.localPaused || this.stationPaused)
  1449. ) {
  1450. this.player.seekTo(
  1451. this.timeBeforePause / 1000,
  1452. true
  1453. );
  1454. this.player.pauseVideo();
  1455. } else if (
  1456. event.data === window.YT.PlayerState.PLAYING &&
  1457. this.seeking === true
  1458. )
  1459. this.seeking = false;
  1460. if (
  1461. event.data === window.YT.PlayerState.PAUSED &&
  1462. !this.localPaused &&
  1463. !this.stationPaused &&
  1464. !this.noSong &&
  1465. this.player.getDuration() / 1000 <
  1466. this.currentSong.duration
  1467. ) {
  1468. this.player.seekTo(
  1469. this.getTimeElapsed() / 1000 +
  1470. this.currentSong.skipDuration,
  1471. true
  1472. );
  1473. this.player.playVideo();
  1474. }
  1475. }
  1476. }
  1477. });
  1478. }
  1479. },
  1480. getTimeElapsed() {
  1481. if (this.currentSong) {
  1482. let { timePaused } = this;
  1483. if (this.stationPaused)
  1484. timePaused += Date.currently() - this.pausedAt;
  1485. return Date.currently() - this.startedAt - timePaused;
  1486. }
  1487. return 0;
  1488. },
  1489. getTimeRemaining() {
  1490. if (this.currentSong) {
  1491. return this.currentSong.duration * 1000 - this.getTimeElapsed();
  1492. }
  1493. return 0;
  1494. },
  1495. playVideo() {
  1496. if (this.playerReady) {
  1497. this.videoLoading = true;
  1498. this.player.loadVideoById(
  1499. this.currentSong.youtubeId,
  1500. this.getTimeElapsed() / 1000 + this.currentSong.skipDuration
  1501. );
  1502. if (window.stationInterval !== 0)
  1503. clearInterval(window.stationInterval);
  1504. window.stationInterval = setInterval(() => {
  1505. if (!this.stationPaused) {
  1506. this.resizeSeekerbar();
  1507. this.calculateTimeElapsed();
  1508. }
  1509. }, 150);
  1510. }
  1511. },
  1512. resizeSeekerbar() {
  1513. this.seekerbarPercentage = parseFloat(
  1514. (this.getTimeElapsed() / 1000 / this.currentSong.duration) * 100
  1515. );
  1516. },
  1517. calculateTimeElapsed() {
  1518. if (
  1519. this.playerReady &&
  1520. !this.noSong &&
  1521. this.currentSong &&
  1522. this.player.getPlayerState() === -1
  1523. ) {
  1524. if (!this.canAutoplay) {
  1525. if (
  1526. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  1527. 2000
  1528. ) {
  1529. this.lastTimeRequestedIfCanAutoplay = Date.now();
  1530. canAutoPlay.video().then(({ result }) => {
  1531. if (result) {
  1532. this.attemptsToPlayVideo = 0;
  1533. this.canAutoplay = true;
  1534. } else {
  1535. this.canAutoplay = false;
  1536. }
  1537. });
  1538. }
  1539. } else {
  1540. this.player.playVideo();
  1541. this.attemptsToPlayVideo += 1;
  1542. }
  1543. }
  1544. if (
  1545. !this.stationPaused &&
  1546. !this.localPaused &&
  1547. this.playerReady &&
  1548. !this.isApple
  1549. ) {
  1550. const timeElapsed = this.getTimeElapsed();
  1551. const currentPlayerTime =
  1552. Math.max(
  1553. this.player.getCurrentTime() -
  1554. this.currentSong.skipDuration,
  1555. 0
  1556. ) * 1000;
  1557. const difference = timeElapsed - currentPlayerTime;
  1558. let playbackRate = 1;
  1559. if (difference < -2000) {
  1560. if (!this.seeking) {
  1561. this.seeking = true;
  1562. this.player.seekTo(
  1563. this.getTimeElapsed() / 1000 +
  1564. this.currentSong.skipDuration
  1565. );
  1566. }
  1567. } else if (difference < -200) {
  1568. playbackRate = 0.8;
  1569. } else if (difference < -50) {
  1570. playbackRate = 0.9;
  1571. } else if (difference < -25) {
  1572. playbackRate = 0.95;
  1573. } else if (difference > 2000) {
  1574. if (!this.seeking) {
  1575. this.seeking = true;
  1576. this.player.seekTo(
  1577. this.getTimeElapsed() / 1000 +
  1578. this.currentSong.skipDuration
  1579. );
  1580. }
  1581. } else if (difference > 200) {
  1582. playbackRate = 1.2;
  1583. } else if (difference > 50) {
  1584. playbackRate = 1.1;
  1585. } else if (difference > 25) {
  1586. playbackRate = 1.05;
  1587. } else if (this.player.getPlaybackRate !== 1.0) {
  1588. this.player.setPlaybackRate(1.0);
  1589. }
  1590. if (this.playbackRate !== playbackRate) {
  1591. this.player.setPlaybackRate(playbackRate);
  1592. this.playbackRate = playbackRate;
  1593. }
  1594. }
  1595. let { timePaused } = this;
  1596. if (this.stationPaused)
  1597. timePaused += Date.currently() - this.pausedAt;
  1598. const duration =
  1599. (Date.currently() - this.startedAt - timePaused) / 1000;
  1600. const songDuration = this.currentSong.duration;
  1601. if (songDuration <= duration) this.player.pauseVideo();
  1602. if (duration <= songDuration)
  1603. this.timeElapsed = utils.formatTime(duration);
  1604. },
  1605. changeVolume() {
  1606. const volume = this.volumeSliderValue;
  1607. localStorage.setItem("volume", volume);
  1608. if (this.playerReady) {
  1609. this.player.setVolume(volume);
  1610. if (volume > 0) {
  1611. this.player.unMute();
  1612. localStorage.setItem("muted", false);
  1613. this.muted = false;
  1614. }
  1615. }
  1616. },
  1617. resumeLocalStation() {
  1618. this.updateLocalPaused(false);
  1619. if (!this.stationPaused) this.resumeLocalPlayer();
  1620. },
  1621. pauseLocalStation() {
  1622. this.updateLocalPaused(true);
  1623. this.pauseLocalPlayer();
  1624. },
  1625. resumeLocalPlayer() {
  1626. if (this.mediasession)
  1627. this.updateMediaSessionData(this.currentSong);
  1628. if (!this.noSong) {
  1629. if (this.playerReady) {
  1630. this.player.seekTo(
  1631. this.getTimeElapsed() / 1000 +
  1632. this.currentSong.skipDuration
  1633. );
  1634. this.player.playVideo();
  1635. }
  1636. }
  1637. },
  1638. pauseLocalPlayer() {
  1639. if (this.mediasession)
  1640. this.updateMediaSessionData(this.currentSong);
  1641. if (!this.noSong) {
  1642. this.timeBeforePause = this.getTimeElapsed();
  1643. if (this.playerReady) this.player.pauseVideo();
  1644. }
  1645. },
  1646. skipStation() {
  1647. this.socket.dispatch(
  1648. "stations.forceSkip",
  1649. this.station._id,
  1650. data => {
  1651. if (data.status !== "success")
  1652. new Toast(`Error: ${data.message}`);
  1653. else
  1654. new Toast(
  1655. "Successfully skipped the station's current song."
  1656. );
  1657. }
  1658. );
  1659. },
  1660. voteSkipStation() {
  1661. this.socket.dispatch(
  1662. "stations.voteSkip",
  1663. this.station._id,
  1664. data => {
  1665. if (data.status !== "success")
  1666. new Toast(`Error: ${data.message}`);
  1667. else
  1668. new Toast(
  1669. "Successfully voted to skip the current song."
  1670. );
  1671. }
  1672. );
  1673. },
  1674. resumeStation() {
  1675. this.socket.dispatch("stations.resume", this.station._id, data => {
  1676. if (data.status !== "success")
  1677. new Toast(`Error: ${data.message}`);
  1678. else new Toast("Successfully resumed the station.");
  1679. });
  1680. },
  1681. pauseStation() {
  1682. this.socket.dispatch("stations.pause", this.station._id, data => {
  1683. if (data.status !== "success")
  1684. new Toast(`Error: ${data.message}`);
  1685. else new Toast("Successfully paused the station.");
  1686. });
  1687. },
  1688. toggleMute() {
  1689. if (this.playerReady) {
  1690. const previousVolume = parseFloat(
  1691. localStorage.getItem("volume")
  1692. );
  1693. const volume =
  1694. this.player.getVolume() <= 0 ? previousVolume : 0;
  1695. this.muted = !this.muted;
  1696. localStorage.setItem("muted", this.muted);
  1697. this.volumeSliderValue = volume;
  1698. this.player.setVolume(volume);
  1699. if (!this.muted) localStorage.setItem("volume", volume);
  1700. }
  1701. },
  1702. increaseVolume() {
  1703. if (this.playerReady) {
  1704. const previousVolume = parseFloat(
  1705. localStorage.getItem("volume")
  1706. );
  1707. let volume = previousVolume + 5;
  1708. if (previousVolume === 0) {
  1709. this.muted = false;
  1710. localStorage.setItem("muted", false);
  1711. }
  1712. if (volume > 100) volume = 100;
  1713. this.volumeSliderValue = volume;
  1714. this.player.setVolume(volume);
  1715. localStorage.setItem("volume", volume);
  1716. }
  1717. },
  1718. toggleLike() {
  1719. if (this.currentSong.liked)
  1720. this.socket.dispatch(
  1721. "songs.unlike",
  1722. this.currentSong.youtubeId,
  1723. res => {
  1724. if (res.status !== "success")
  1725. new Toast(`Error: ${res.message}`);
  1726. }
  1727. );
  1728. else
  1729. this.socket.dispatch(
  1730. "songs.like",
  1731. this.currentSong.youtubeId,
  1732. res => {
  1733. if (res.status !== "success")
  1734. new Toast(`Error: ${res.message}`);
  1735. }
  1736. );
  1737. },
  1738. toggleDislike() {
  1739. if (this.currentSong.disliked)
  1740. return this.socket.dispatch(
  1741. "songs.undislike",
  1742. this.currentSong.youtubeId,
  1743. res => {
  1744. if (res.status !== "success")
  1745. new Toast(`Error: ${res.message}`);
  1746. }
  1747. );
  1748. return this.socket.dispatch(
  1749. "songs.dislike",
  1750. this.currentSong.youtubeId,
  1751. res => {
  1752. if (res.status !== "success")
  1753. new Toast(`Error: ${res.message}`);
  1754. }
  1755. );
  1756. },
  1757. togglePlayerDebugBox() {
  1758. this.$refs.playerDebugBox.toggleBox();
  1759. },
  1760. resetPlayerDebugBox() {
  1761. this.$refs.playerDebugBox.resetBox();
  1762. },
  1763. toggleKeyboardShortcutsHelper() {
  1764. this.$refs.keyboardShortcutsHelper.toggleBox();
  1765. },
  1766. resetKeyboardShortcutsHelper() {
  1767. this.$refs.keyboardShortcutsHelper.resetBox();
  1768. },
  1769. join() {
  1770. this.socket.dispatch(
  1771. "stations.join",
  1772. this.stationIdentifier,
  1773. res => {
  1774. if (res.status === "success") {
  1775. setTimeout(() => {
  1776. this.loading = false;
  1777. }, 1000); // prevents popping in of youtube embed etc.
  1778. const {
  1779. _id,
  1780. displayName,
  1781. name,
  1782. description,
  1783. privacy,
  1784. owner,
  1785. autofill,
  1786. blacklist,
  1787. type,
  1788. isFavorited,
  1789. theme,
  1790. requests
  1791. } = res.data;
  1792. // change url to use station name instead of station id
  1793. if (name !== this.stationIdentifier) {
  1794. // eslint-disable-next-line no-restricted-globals
  1795. this.$router.replace(name);
  1796. }
  1797. this.joinStation({
  1798. _id,
  1799. name,
  1800. displayName,
  1801. description,
  1802. privacy,
  1803. owner,
  1804. autofill,
  1805. blacklist,
  1806. type,
  1807. isFavorited,
  1808. theme,
  1809. requests
  1810. });
  1811. document.getElementsByTagName(
  1812. "html"
  1813. )[0].style.cssText = `--primary-color: var(--${res.data.theme})`;
  1814. this.setCurrentSong({
  1815. currentSong: res.data.currentSong,
  1816. startedAt: res.data.startedAt,
  1817. paused: res.data.paused,
  1818. timePaused: res.data.timePaused,
  1819. pausedAt: res.data.pausedAt
  1820. });
  1821. this.updateUserCount(res.data.userCount);
  1822. this.updateUsers(res.data.users);
  1823. this.socket.dispatch(
  1824. "stations.getStationAutofillPlaylistsById",
  1825. this.station._id,
  1826. res => {
  1827. if (res.status === "success") {
  1828. this.setAutofillPlaylists(
  1829. res.data.playlists
  1830. );
  1831. }
  1832. }
  1833. );
  1834. this.socket.dispatch(
  1835. "stations.getStationBlacklistById",
  1836. this.station._id,
  1837. res => {
  1838. if (res.status === "success") {
  1839. this.setBlacklist(res.data.playlists);
  1840. }
  1841. }
  1842. );
  1843. this.socket.dispatch("stations.getQueue", _id, res => {
  1844. if (res.status === "success") {
  1845. const { queue } = res.data;
  1846. this.updateSongsList(queue);
  1847. const [nextSong] = queue;
  1848. this.updateNextSong(nextSong);
  1849. }
  1850. });
  1851. if (this.isOwnerOrAdmin()) {
  1852. keyboardShortcuts.registerShortcut(
  1853. "station.pauseResume",
  1854. {
  1855. keyCode: 32, // Spacebar
  1856. shift: false,
  1857. ctrl: true,
  1858. preventDefault: true,
  1859. handler: () => {
  1860. if (this.aModalIsOpen) return;
  1861. if (this.stationPaused)
  1862. this.resumeStation();
  1863. else this.pauseStation();
  1864. }
  1865. }
  1866. );
  1867. keyboardShortcuts.registerShortcut(
  1868. "station.skipStation",
  1869. {
  1870. keyCode: 39, // Right arrow key
  1871. shift: false,
  1872. ctrl: true,
  1873. preventDefault: true,
  1874. handler: () => {
  1875. if (this.aModalIsOpen) return;
  1876. this.skipStation();
  1877. }
  1878. }
  1879. );
  1880. }
  1881. keyboardShortcuts.registerShortcut(
  1882. "station.lowerVolumeLarge",
  1883. {
  1884. keyCode: 40, // Down arrow key
  1885. shift: false,
  1886. ctrl: true,
  1887. preventDefault: true,
  1888. handler: () => {
  1889. if (this.aModalIsOpen) return;
  1890. this.volumeSliderValue -= 10;
  1891. this.changeVolume();
  1892. }
  1893. }
  1894. );
  1895. keyboardShortcuts.registerShortcut(
  1896. "station.lowerVolumeSmall",
  1897. {
  1898. keyCode: 40, // Down arrow key
  1899. shift: true,
  1900. ctrl: true,
  1901. preventDefault: true,
  1902. handler: () => {
  1903. if (this.aModalIsOpen) return;
  1904. this.volumeSliderValue -= 1;
  1905. this.changeVolume();
  1906. }
  1907. }
  1908. );
  1909. keyboardShortcuts.registerShortcut(
  1910. "station.increaseVolumeLarge",
  1911. {
  1912. keyCode: 38, // Up arrow key
  1913. shift: false,
  1914. ctrl: true,
  1915. preventDefault: true,
  1916. handler: () => {
  1917. if (this.aModalIsOpen) return;
  1918. this.volumeSliderValue += 10;
  1919. this.changeVolume();
  1920. }
  1921. }
  1922. );
  1923. keyboardShortcuts.registerShortcut(
  1924. "station.increaseVolumeSmall",
  1925. {
  1926. keyCode: 38, // Up arrow key
  1927. shift: true,
  1928. ctrl: true,
  1929. preventDefault: true,
  1930. handler: () => {
  1931. if (this.aModalIsOpen) return;
  1932. this.volumeSliderValue += 1;
  1933. this.changeVolume();
  1934. }
  1935. }
  1936. );
  1937. keyboardShortcuts.registerShortcut(
  1938. "station.toggleDebug",
  1939. {
  1940. keyCode: 68, // D key
  1941. shift: false,
  1942. ctrl: true,
  1943. preventDefault: true,
  1944. handler: () => {
  1945. if (this.aModalIsOpen) return;
  1946. this.togglePlayerDebugBox();
  1947. }
  1948. }
  1949. );
  1950. keyboardShortcuts.registerShortcut(
  1951. "station.toggleKeyboardShortcutsHelper",
  1952. {
  1953. keyCode: 191, // '/' key
  1954. ctrl: true,
  1955. preventDefault: true,
  1956. handler: () => {
  1957. if (this.aModalIsOpen) return;
  1958. this.toggleKeyboardShortcutsHelper();
  1959. }
  1960. }
  1961. );
  1962. keyboardShortcuts.registerShortcut(
  1963. "station.resetKeyboardShortcutsHelper",
  1964. {
  1965. keyCode: 191, // '/' key
  1966. ctrl: true,
  1967. shift: true,
  1968. preventDefault: true,
  1969. handler: () => {
  1970. if (this.aModalIsOpen) return;
  1971. this.resetKeyboardShortcutsHelper();
  1972. }
  1973. }
  1974. );
  1975. // UNIX client time before ping
  1976. const beforePing = Date.now();
  1977. this.socket.dispatch("apis.ping", res => {
  1978. if (res.status === "success") {
  1979. // UNIX client time after ping
  1980. const afterPing = Date.now();
  1981. // Average time in MS it took between the server responding and the client receiving
  1982. const connectionLatency =
  1983. (afterPing - beforePing) / 2;
  1984. console.log(
  1985. connectionLatency,
  1986. beforePing - afterPing
  1987. );
  1988. // UNIX server time
  1989. const serverDate = res.data.date;
  1990. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  1991. const difference =
  1992. serverDate + connectionLatency - afterPing;
  1993. console.log("Difference: ", difference);
  1994. if (difference > 3000 || difference < -3000) {
  1995. console.log(
  1996. "System time difference is bigger than 3 seconds."
  1997. );
  1998. }
  1999. this.systemDifference = difference;
  2000. }
  2001. });
  2002. } else {
  2003. this.loading = false;
  2004. this.exists = false;
  2005. }
  2006. }
  2007. );
  2008. },
  2009. favoriteStation() {
  2010. this.socket.dispatch(
  2011. "stations.favoriteStation",
  2012. this.station._id,
  2013. res => {
  2014. if (res.status === "success") {
  2015. new Toast("Successfully favorited station.");
  2016. } else new Toast(res.message);
  2017. }
  2018. );
  2019. },
  2020. unfavoriteStation() {
  2021. this.socket.dispatch(
  2022. "stations.unfavoriteStation",
  2023. this.station._id,
  2024. res => {
  2025. if (res.status === "success") {
  2026. new Toast("Successfully unfavorited station.");
  2027. } else new Toast(res.message);
  2028. }
  2029. );
  2030. },
  2031. sendActivityWatchVideoData() {
  2032. if (!this.stationPaused && !this.localPaused && !this.noSong) {
  2033. if (this.activityWatchVideoLastStatus !== "playing") {
  2034. this.activityWatchVideoLastStatus = "playing";
  2035. this.activityWatchVideoLastStartDuration =
  2036. this.currentSong.skipDuration + this.getTimeElapsed();
  2037. }
  2038. if (
  2039. this.activityWatchVideoLastYouTubeId !==
  2040. this.currentSong.youtubeId
  2041. ) {
  2042. this.activityWatchVideoLastYouTubeId =
  2043. this.currentSong.youtubeId;
  2044. this.activityWatchVideoLastStartDuration =
  2045. this.currentSong.skipDuration + this.getTimeElapsed();
  2046. }
  2047. const videoData = {
  2048. title: this.currentSong ? this.currentSong.title : null,
  2049. artists:
  2050. this.currentSong && this.currentSong.artists
  2051. ? this.currentSong.artists.join(", ")
  2052. : null,
  2053. youtubeId: this.currentSong.youtubeId,
  2054. muted: this.muted,
  2055. volume: this.volumeSliderValue,
  2056. startedDuration:
  2057. this.activityWatchVideoLastStartDuration <= 0
  2058. ? 0
  2059. : Math.floor(
  2060. this.activityWatchVideoLastStartDuration /
  2061. 1000
  2062. ),
  2063. source: `station#${this.station.name}`,
  2064. hostname: window.location.hostname
  2065. };
  2066. aw.sendVideoData(videoData);
  2067. } else {
  2068. this.activityWatchVideoLastStatus = "not_playing";
  2069. }
  2070. },
  2071. ...mapActions("modalVisibility", ["openModal"]),
  2072. ...mapActions("station", [
  2073. "joinStation",
  2074. "leaveStation",
  2075. "updateStation",
  2076. "updateUserCount",
  2077. "updateUsers",
  2078. "updateCurrentSong",
  2079. "updateNextSong",
  2080. "updateSongsList",
  2081. "repositionSongInList",
  2082. "updateStationPaused",
  2083. "updateLocalPaused",
  2084. "updateNoSong",
  2085. "updateIfStationIsFavorited",
  2086. "setAutofillPlaylists",
  2087. "setBlacklist",
  2088. "updateCurrentSongRatings",
  2089. "updateOwnCurrentSongRatings",
  2090. "updateCurrentSongSkipVotes"
  2091. ]),
  2092. ...mapActions("modals/editSong", ["stopVideo"])
  2093. }
  2094. };
  2095. </script>
  2096. <style lang="less">
  2097. #stationPlayer {
  2098. position: absolute;
  2099. top: 0;
  2100. left: 0;
  2101. width: 100%;
  2102. height: 100%;
  2103. }
  2104. #currently-playing-container,
  2105. #next-up-container {
  2106. .song-item {
  2107. .thumbnail {
  2108. min-width: 130px;
  2109. width: 130px;
  2110. height: 130px;
  2111. }
  2112. }
  2113. }
  2114. #control-bar-container
  2115. #right-buttons
  2116. .tippy-box[data-theme~="dropdown"]
  2117. .nav-dropdown-items {
  2118. padding-bottom: 0 !important;
  2119. }
  2120. </style>
  2121. <style lang="less" scoped>
  2122. #page-loader-container {
  2123. height: inherit;
  2124. #page-loader-content {
  2125. height: inherit;
  2126. position: absolute;
  2127. max-width: 100%;
  2128. width: 1800px;
  2129. transform: translateX(-50%);
  2130. left: 50%;
  2131. }
  2132. #page-loader-layout {
  2133. height: inherit;
  2134. width: 100%;
  2135. }
  2136. }
  2137. #mobile-progress-animation {
  2138. width: 50px;
  2139. animation: rotate 0.8s infinite linear;
  2140. border: 8px solid var(--primary-color);
  2141. border-right-color: transparent;
  2142. border-radius: 50%;
  2143. height: 50px;
  2144. position: absolute;
  2145. top: 50%;
  2146. left: 50%;
  2147. display: none;
  2148. }
  2149. @keyframes rotate {
  2150. 0% {
  2151. transform: rotate(0deg);
  2152. }
  2153. 100% {
  2154. transform: rotate(360deg);
  2155. }
  2156. }
  2157. .nav,
  2158. .button.is-primary {
  2159. background-color: var(--primary-color) !important;
  2160. }
  2161. .button.is-primary:hover,
  2162. .button.is-primary:focus {
  2163. filter: brightness(90%);
  2164. }
  2165. .night-mode {
  2166. #currently-playing-container,
  2167. #next-up-container,
  2168. #about-station-container,
  2169. #control-bar-container,
  2170. .player-container {
  2171. background-color: var(--dark-grey-3) !important;
  2172. }
  2173. #video-container,
  2174. #control-bar-container,
  2175. .quadrant:not(#sidebar-container),
  2176. .player-container {
  2177. border: 0 !important;
  2178. }
  2179. #seeker-bar-container {
  2180. background-color: var(--dark-grey-3) !important;
  2181. }
  2182. #dropdown-toggle {
  2183. background-color: var(--dark-grey-2) !important;
  2184. border: 0;
  2185. i {
  2186. color: var(--white);
  2187. }
  2188. }
  2189. }
  2190. #station-outer-container {
  2191. margin: 0 auto;
  2192. padding: 20px 40px;
  2193. min-height: calc(100vh - 64px);
  2194. width: 100%;
  2195. max-width: 1800px;
  2196. display: flex;
  2197. #station-inner-container {
  2198. width: 100%;
  2199. min-height: calc(100vh - 428px);
  2200. display: flex;
  2201. flex-direction: row;
  2202. flex-wrap: wrap;
  2203. .row {
  2204. display: flex;
  2205. flex-direction: row;
  2206. max-width: 100%;
  2207. }
  2208. .column {
  2209. display: flex;
  2210. flex-direction: column;
  2211. }
  2212. .quadrant {
  2213. border-radius: @border-radius;
  2214. margin: 10px;
  2215. }
  2216. .quadrant:not(#sidebar-container) {
  2217. background-color: var(--white);
  2218. border: 1px solid var(--light-grey-3);
  2219. }
  2220. #station-left-column,
  2221. #station-right-column {
  2222. padding: 0;
  2223. }
  2224. #about-station-container {
  2225. padding: 20px;
  2226. display: flex;
  2227. flex-direction: column;
  2228. flex-grow: unset;
  2229. #station-info {
  2230. #station-name {
  2231. flex-direction: row !important;
  2232. h1 {
  2233. margin: 0;
  2234. font-size: 36px;
  2235. line-height: 0.8;
  2236. text-overflow: ellipsis;
  2237. overflow: hidden;
  2238. }
  2239. i {
  2240. margin-left: 10px;
  2241. font-size: 30px;
  2242. color: var(--yellow);
  2243. &.stationMode {
  2244. padding-left: 10px;
  2245. margin-left: auto;
  2246. color: var(--primary-color);
  2247. }
  2248. }
  2249. .verified-station {
  2250. color: var(--primary-color);
  2251. }
  2252. }
  2253. p {
  2254. display: -webkit-box;
  2255. max-width: 700px;
  2256. margin-bottom: 10px;
  2257. overflow: hidden;
  2258. text-overflow: ellipsis;
  2259. -webkit-box-orient: vertical;
  2260. -webkit-line-clamp: 3;
  2261. }
  2262. }
  2263. #admin-buttons {
  2264. display: flex;
  2265. .button {
  2266. margin: 3px;
  2267. }
  2268. }
  2269. }
  2270. #current-next-row {
  2271. display: flex;
  2272. flex-direction: row;
  2273. #currently-playing-container,
  2274. #next-up-container {
  2275. overflow: hidden;
  2276. flex-basis: 50%;
  2277. .song-item {
  2278. border: unset;
  2279. }
  2280. .nothing-here-text {
  2281. height: 100%;
  2282. }
  2283. }
  2284. > div:only-child {
  2285. flex: 1 !important;
  2286. flex-basis: 100% !important;
  2287. }
  2288. }
  2289. .player-container {
  2290. height: inherit;
  2291. background-color: var(--white);
  2292. display: flex;
  2293. flex-direction: column;
  2294. border: 1px solid var(--light-grey-3);
  2295. border-radius: @border-radius;
  2296. overflow: hidden;
  2297. &.nothing-here-text {
  2298. margin: 10px;
  2299. flex: 1;
  2300. min-height: 487px;
  2301. }
  2302. #video-container {
  2303. position: relative;
  2304. padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
  2305. height: 0;
  2306. overflow: hidden;
  2307. .player-cannot-autoplay {
  2308. position: relative;
  2309. width: 100%;
  2310. height: 100%;
  2311. bottom: calc(100% + 5px);
  2312. background: var(--primary-color);
  2313. display: flex;
  2314. align-items: center;
  2315. justify-content: center;
  2316. p {
  2317. color: var(--white);
  2318. font-size: 26px;
  2319. text-align: center;
  2320. }
  2321. }
  2322. }
  2323. #seeker-bar-container {
  2324. background-color: var(--white);
  2325. position: relative;
  2326. height: 7px;
  2327. display: block;
  2328. width: 100%;
  2329. #seeker-bar {
  2330. background-color: var(--primary-color);
  2331. top: 0;
  2332. left: 0;
  2333. bottom: 0;
  2334. position: absolute;
  2335. width: 100%;
  2336. }
  2337. .seeker-bar-cover {
  2338. position: absolute;
  2339. top: 0;
  2340. right: 0;
  2341. bottom: 0;
  2342. background-color: inherit;
  2343. }
  2344. }
  2345. #control-bar-container {
  2346. display: flex;
  2347. justify-content: space-around;
  2348. padding: 10px 0;
  2349. width: 100%;
  2350. background: var(--white);
  2351. flex-direction: column;
  2352. flex-flow: wrap;
  2353. .button:not(#dropdown-toggle) {
  2354. width: 75px;
  2355. }
  2356. #left-buttons,
  2357. #right-buttons {
  2358. margin: 3px;
  2359. }
  2360. #left-buttons {
  2361. display: flex;
  2362. .button:not(:first-of-type) {
  2363. margin-left: 5px;
  2364. }
  2365. .disabled {
  2366. filter: grayscale(0.4);
  2367. }
  2368. }
  2369. #duration {
  2370. margin: 3px;
  2371. display: flex;
  2372. align-items: center;
  2373. p {
  2374. font-size: 22px;
  2375. /** prevents duration width slightly varying and shifting other controls slightly */
  2376. width: 150px;
  2377. text-align: center;
  2378. }
  2379. }
  2380. #volume-control {
  2381. margin: 3px;
  2382. margin-top: 0;
  2383. display: flex;
  2384. align-items: center;
  2385. cursor: pointer;
  2386. .volume-slider {
  2387. width: 100%;
  2388. padding: 0 15px;
  2389. background: transparent;
  2390. min-width: 100px;
  2391. }
  2392. input[type="range"] {
  2393. -webkit-appearance: none;
  2394. margin: 7.3px 0;
  2395. }
  2396. input[type="range"]:focus {
  2397. outline: none;
  2398. }
  2399. input[type="range"]::-webkit-slider-runnable-track {
  2400. width: 100%;
  2401. height: 5.2px;
  2402. cursor: pointer;
  2403. box-shadow: 0;
  2404. background: var(--light-grey-3);
  2405. border-radius: @border-radius;
  2406. border: 0;
  2407. }
  2408. input[type="range"]::-webkit-slider-thumb {
  2409. box-shadow: 0;
  2410. border: 0;
  2411. height: 19px;
  2412. width: 19px;
  2413. border-radius: 100%;
  2414. background: var(--primary-color);
  2415. cursor: pointer;
  2416. -webkit-appearance: none;
  2417. margin-top: -6.5px;
  2418. }
  2419. input[type="range"]::-moz-range-track {
  2420. width: 100%;
  2421. height: 5.2px;
  2422. cursor: pointer;
  2423. box-shadow: 0;
  2424. background: var(--light-grey-3);
  2425. border-radius: @border-radius;
  2426. border: 0;
  2427. }
  2428. input[type="range"]::-moz-range-thumb {
  2429. box-shadow: 0;
  2430. border: 0;
  2431. height: 19px;
  2432. width: 19px;
  2433. border-radius: 100%;
  2434. background: var(--primary-color);
  2435. cursor: pointer;
  2436. -webkit-appearance: none;
  2437. margin-top: -6.5px;
  2438. }
  2439. input[type="range"]::-ms-track {
  2440. width: 100%;
  2441. height: 5.2px;
  2442. cursor: pointer;
  2443. box-shadow: 0;
  2444. background: var(--light-grey-3);
  2445. border-radius: @border-radius;
  2446. }
  2447. input[type="range"]::-ms-fill-lower {
  2448. background: var(--light-grey-3);
  2449. border: 0;
  2450. border-radius: 0;
  2451. box-shadow: 0;
  2452. }
  2453. input[type="range"]::-ms-fill-upper {
  2454. background: var(--light-grey-3);
  2455. border: 0;
  2456. border-radius: 0;
  2457. box-shadow: 0;
  2458. }
  2459. input[type="range"]::-ms-thumb {
  2460. box-shadow: 0;
  2461. border: 0;
  2462. height: 15px;
  2463. width: 15px;
  2464. border-radius: 100%;
  2465. background: var(--primary-color);
  2466. cursor: pointer;
  2467. -webkit-appearance: none;
  2468. margin-top: 1.5px;
  2469. }
  2470. }
  2471. #right-buttons {
  2472. display: flex;
  2473. #dropdown-toggle {
  2474. width: 35px;
  2475. }
  2476. #dislike-song,
  2477. #add-song-to-playlist .button:not(#dropdown-toggle) {
  2478. margin-left: 5px;
  2479. }
  2480. #ratings {
  2481. display: flex;
  2482. &.liked #dislike-song,
  2483. &.disliked #like-song {
  2484. background-color: var(--grey) !important;
  2485. }
  2486. #like-song.disabled,
  2487. #dislike-song.disabled {
  2488. filter: grayscale(0.4);
  2489. }
  2490. }
  2491. #add-song-to-playlist {
  2492. display: flex;
  2493. flex-direction: column-reverse;
  2494. #nav-dropdown {
  2495. position: absolute;
  2496. margin-left: 4px;
  2497. margin-bottom: 36px;
  2498. .nav-dropdown-items {
  2499. position: relative;
  2500. right: calc(100% - 110px);
  2501. }
  2502. }
  2503. .control {
  2504. width: fit-content;
  2505. margin-bottom: 0 !important;
  2506. button.disabled {
  2507. filter: grayscale(0.4);
  2508. border-radius: @border-radius;
  2509. &::after {
  2510. margin-right: 100%;
  2511. }
  2512. }
  2513. }
  2514. }
  2515. }
  2516. }
  2517. }
  2518. #sidebar-container {
  2519. border-top: 0;
  2520. position: relative;
  2521. height: inherit;
  2522. flex-grow: 1;
  2523. min-height: 350px;
  2524. }
  2525. }
  2526. }
  2527. .footer {
  2528. margin-top: 30px;
  2529. }
  2530. .nyan {
  2531. background: linear-gradient(
  2532. 90deg,
  2533. magenta 0%,
  2534. red 15%,
  2535. orange 30%,
  2536. yellow 45%,
  2537. lime 60%,
  2538. cyan 75%,
  2539. blue 90%,
  2540. magenta 100%
  2541. );
  2542. background-size: 200%;
  2543. animation: nyanMoving 4s linear infinite;
  2544. }
  2545. @keyframes nyanMoving {
  2546. 0% {
  2547. background-position: 0% 0%;
  2548. }
  2549. 100% {
  2550. background-position: -200% 0%;
  2551. }
  2552. }
  2553. .christmas-seeker {
  2554. background: repeating-linear-gradient(
  2555. -45deg,
  2556. var(--white) 0 1rem,
  2557. var(--dark-red) 1rem 2rem
  2558. );
  2559. background-size: 200% 200%;
  2560. animation: christmas 20s linear infinite;
  2561. }
  2562. @keyframes christmas {
  2563. 100% {
  2564. background-position: 80% 100%;
  2565. }
  2566. }
  2567. .bg-bubbles {
  2568. top: 0;
  2569. left: 0;
  2570. width: 100%;
  2571. height: 100%;
  2572. position: absolute;
  2573. z-index: -1;
  2574. margin: 0px;
  2575. pointer-events: none;
  2576. }
  2577. .bg-bubbles li {
  2578. position: absolute;
  2579. list-style: none;
  2580. display: block;
  2581. width: 40px;
  2582. height: 40px;
  2583. border-radius: 100px;
  2584. background-color: var(--primary-color);
  2585. opacity: 0.15;
  2586. bottom: 0px;
  2587. -webkit-animation: square 25s infinite;
  2588. animation: square 25s infinite;
  2589. -webkit-transition-timing-function: linear;
  2590. transition-timing-function: linear;
  2591. }
  2592. .bg-bubbles li:nth-child(1) {
  2593. left: 10%;
  2594. }
  2595. .bg-bubbles li:nth-child(2) {
  2596. left: 20%;
  2597. width: 80px;
  2598. height: 80px;
  2599. -webkit-animation-delay: 2s;
  2600. animation-delay: 2s;
  2601. -webkit-animation-duration: 17s;
  2602. animation-duration: 17s;
  2603. }
  2604. .bg-bubbles li:nth-child(3) {
  2605. left: 25%;
  2606. -webkit-animation-delay: 4s;
  2607. animation-delay: 4s;
  2608. }
  2609. .bg-bubbles li:nth-child(4) {
  2610. left: 40%;
  2611. width: 60px;
  2612. height: 60px;
  2613. -webkit-animation-duration: 22s;
  2614. animation-duration: 22s;
  2615. background-color: var(--primary-color);
  2616. opacity: 0.25;
  2617. }
  2618. .bg-bubbles li:nth-child(5) {
  2619. left: 70%;
  2620. }
  2621. .bg-bubbles li:nth-child(6) {
  2622. left: 80%;
  2623. width: 120px;
  2624. height: 120px;
  2625. -webkit-animation-delay: 3s;
  2626. animation-delay: 3s;
  2627. background-color: var(--primary-color);
  2628. opacity: 0.2;
  2629. }
  2630. .bg-bubbles li:nth-child(7) {
  2631. left: 32%;
  2632. width: 160px;
  2633. height: 160px;
  2634. -webkit-animation-delay: 7s;
  2635. animation-delay: 7s;
  2636. }
  2637. .bg-bubbles li:nth-child(8) {
  2638. left: 55%;
  2639. width: 20px;
  2640. height: 20px;
  2641. -webkit-animation-delay: 15s;
  2642. animation-delay: 15s;
  2643. -webkit-animation-duration: 40s;
  2644. animation-duration: 40s;
  2645. }
  2646. .bg-bubbles li:nth-child(9) {
  2647. left: 25%;
  2648. width: 10px;
  2649. height: 10px;
  2650. -webkit-animation-delay: 2s;
  2651. animation-delay: 2s;
  2652. -webkit-animation-duration: 40s;
  2653. animation-duration: 40s;
  2654. background-color: var(--primary-color);
  2655. opacity: 0.3;
  2656. }
  2657. .bg-bubbles li:nth-child(10) {
  2658. left: 80%;
  2659. width: 160px;
  2660. height: 160px;
  2661. -webkit-animation-delay: 11s;
  2662. animation-delay: 11s;
  2663. }
  2664. /* Tablet view fix */
  2665. @media (max-width: 768px) {
  2666. .bg-bubbles li:nth-child(10) {
  2667. display: none;
  2668. }
  2669. }
  2670. @-webkit-keyframes square {
  2671. 0% {
  2672. -webkit-transform: translateY(0);
  2673. transform: translateY(0);
  2674. }
  2675. 100% {
  2676. -webkit-transform: translateY(-700px) rotate(600deg);
  2677. transform: translateY(-700px) rotate(600deg);
  2678. }
  2679. }
  2680. @keyframes square {
  2681. 0% {
  2682. -webkit-transform: translateY(0);
  2683. transform: translateY(0);
  2684. }
  2685. 100% {
  2686. -webkit-transform: translateY(-700px) rotate(600deg);
  2687. transform: translateY(-700px) rotate(600deg);
  2688. }
  2689. }
  2690. :deep(.nothing-here-text) {
  2691. display: flex;
  2692. align-items: center;
  2693. justify-content: center;
  2694. }
  2695. @media (min-width: 1500px) {
  2696. #station-left-column {
  2697. max-width: 650px;
  2698. }
  2699. #station-right-column {
  2700. max-width: calc(100% - 650px);
  2701. }
  2702. }
  2703. @media (max-width: 1700px) {
  2704. #current-next-row {
  2705. flex-direction: column !important;
  2706. > div {
  2707. flex: 1 !important;
  2708. }
  2709. }
  2710. }
  2711. @media (max-width: 1500px) {
  2712. #mobile-progress-animation {
  2713. display: block;
  2714. }
  2715. #page-loader-container {
  2716. display: none;
  2717. }
  2718. #station-outer-container {
  2719. max-width: 1500px;
  2720. #station-inner-container {
  2721. flex-direction: row;
  2722. #station-left-column {
  2723. #about-station-container #admin-buttons {
  2724. flex-wrap: wrap;
  2725. }
  2726. #sidebar-container {
  2727. min-height: 350px;
  2728. }
  2729. }
  2730. #station-right-column {
  2731. #current-next-row {
  2732. flex-direction: column;
  2733. }
  2734. #control-bar-container {
  2735. #duration,
  2736. #volume-control,
  2737. #right-buttons,
  2738. #left-buttons {
  2739. margin-bottom: 5px;
  2740. justify-content: center;
  2741. }
  2742. #duration {
  2743. order: 1;
  2744. }
  2745. #volume-control {
  2746. order: 2;
  2747. max-width: 400px;
  2748. }
  2749. #right-buttons {
  2750. order: 3;
  2751. flex-wrap: wrap;
  2752. #ratings {
  2753. flex-wrap: wrap;
  2754. }
  2755. }
  2756. #left-buttons {
  2757. order: 4;
  2758. flex-wrap: wrap;
  2759. }
  2760. }
  2761. }
  2762. }
  2763. }
  2764. }
  2765. @media (max-width: 1200px) {
  2766. #station-outer-container {
  2767. max-width: 900px;
  2768. padding: 0;
  2769. #station-inner-container {
  2770. flex-direction: column-reverse;
  2771. flex-wrap: nowrap;
  2772. }
  2773. }
  2774. }
  2775. @media (max-width: 990px) {
  2776. #station-outer-container {
  2777. min-height: calc(
  2778. 100vh - 256px
  2779. ); // Height of nav (64px) + height of footer (190px)
  2780. }
  2781. }
  2782. </style>