11<!DOCTYPE html>
22< html lang ="en ">
3+
34< head >
45 < meta charset ="UTF-8 " />
56 < meta name ="viewport " content ="width=device-width, initial-scale=1 " />
67 <!-- Fallback Metadata -->
7- < meta name ="description " content ="A modern music player interface with playlists, song management, and an amazing visualizer. " />
8+ < meta name ="description "
9+ content ="A modern music player interface with playlists, song management, and an amazing visualizer. " />
810 < meta property ="og:image " content ="https://nellowtcs.me/assets/icon-1024.png " />
9- < meta property ="og:description " content ="A modern music player interface with playlists, song management, and an amazing visualizer. " />
11+ < meta property ="og:description "
12+ content ="A modern music player interface with playlists, song management, and an amazing visualizer. " />
1013 < meta property ="og:title " content ="HTMLPlayer (beta) " />
1114
15+ < script >
16+ ( function ( ) {
17+ // Vite will replace these exact strings during build
18+ const isSingleFile = __IS_SINGLE_FILE__ ;
19+ const iconData = __INLINED_ICON__ ;
20+
21+ if ( isSingleFile && iconData ) {
22+ const link = document . querySelector ( "link[rel*='icon']" ) || document . createElement ( 'link' ) ;
23+ link . type = 'image/png' ;
24+ link . rel = 'icon' ;
25+ link . href = iconData ;
26+ document . head . appendChild ( link ) ;
27+
28+ const ogImage = document . querySelector ( 'meta[property="og:image"]' ) || document . createElement ( 'meta' ) ;
29+ ogImage . setAttribute ( 'property' , 'og:image' ) ;
30+ ogImage . content = iconData ;
31+ document . head . appendChild ( ogImage ) ;
32+ }
33+ } ) ( ) ;
34+ </ script >
35+
1236 < link href ="./src/global.css " rel ="stylesheet " />
1337 <!-- Default theme loaded first for instant styling and first load -->
1438 < link href ="./src/themes/Themes/Blue/Blue.theme.css " rel ="stylesheet " id ="theme-link " />
15-
39+
1640 <!-- Load user's saved theme and dark mode preference ASAP -->
1741 < script >
18- ( function ( ) {
42+ ( function ( ) {
1943 // Apply dark mode immediately if needed (before theme switching)
2044 const savedMode = localStorage . getItem ( 'themeMode' ) || 'auto' ;
2145 if ( savedMode === 'dark' ) {
2852 }
2953 } ) ( ) ;
3054 </ script >
31-
55+
3256 < title > HTMLPlayer</ title >
3357</ head >
3458< body >
@@ -46,30 +70,29 @@ <h1 class="loadingTitle">HTMLPlayer</h1>
4670
4771 <!-- Load fun loading messages -->
4872 < script >
49- ( function ( ) {
50- // Detect user's language (first two letters)
73+ ( function ( ) {
5174 const userLang = ( navigator . language || 'en' ) . substring ( 0 , 2 ) ;
52-
53- // Map supported languages
54- const supportedLangs = { 'en' : 'en' , 'fr' : 'fr' } ;
55- const lang = supportedLangs [ userLang ] || 'en' ;
56-
57- // Load the appropriate language file
58- fetch ( `./locales/${ lang } /loading-messages-${ lang } .json` )
59- . then ( response => response . json ( ) )
60- . then ( messages => {
61- // Pick a random message
75+ const lang = ( userLang === 'fr' ) ? 'fr' : 'en' ;
76+ const loadingText = document . getElementById ( 'loading-text' ) ;
77+
78+ const updateText = ( messages ) => {
79+ if ( loadingText && messages ) {
6280 const randomMessage = messages [ Math . floor ( Math . random ( ) * messages . length ) ] ;
63- // Update the loading text
64- const loadingText = document . getElementById ( 'loading-text' ) ;
65- if ( loadingText ) {
66- loadingText . textContent = randomMessage ;
67- }
68- } )
69- . catch ( ( ) => {
70- // Fallback to English if loading fails
71- console . warn ( 'Failed to load loading messages, using fallback' ) ;
72- } ) ;
81+ loadingText . textContent = randomMessage ;
82+ }
83+ } ;
84+
85+ // Statically replaced by the custom plugin
86+ const inlined = __INLINED_MESSAGES__ ;
87+
88+ if ( inlined ) {
89+ updateText ( inlined [ lang ] || inlined . en ) ;
90+ } else {
91+ fetch ( `./locales/${ lang } /loading-messages-${ lang } .json` )
92+ . then ( res => res . json ( ) )
93+ . then ( updateText )
94+ . catch ( ( ) => console . warn ( 'Loading messages failed.' ) ) ;
95+ }
7396 } ) ( ) ;
7497 </ script >
7598
0 commit comments