index.vue 71 KB

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