1- <!doctype html> < html lang ="en " class ="{{ .Theme }} "> < head > < meta charset ="utf-8 "/> < script > window . config = { logo : "{{ .UI.Logo }}" , header : "{{ .UI.Header }}" , dashboardHeading : "{{ .UI.DashboardHeading }}" , dashboardSubheading : "{{ .UI.DashboardSubheading }}" , link : "{{ .UI.Link }}" , buttons : [ ] , maximumNumberOfResults : "{{ .UI.MaximumNumberOfResults }}" , defaultSortBy : "{{ .UI.DefaultSortBy }}" , defaultFilterBy : "{{ .UI.DefaultFilterBy }}" } ; { { - range . UI . Buttons } } window . config . buttons . push ( { name :"{{ .Name }}" , link :"{{ .Link }}" } ) ; { { end } }
2- // Initialize theme immediately to prevent flash
3- ( function ( ) {
1+ <!doctype html> < html lang ="en " class ="{{ .Theme }} "> < head > < meta charset ="utf-8 "/> < title > {{ .UI.Title }}</ title > < script > ( function ( ) {
2+ // String is percent-encoded to prevent it from being replaced when ui config is injected
3+ if ( document . title !== decodeURIComponent ( "%7B%7B%20.UI.Title%20%7D%7D" ) ) {
4+ window . config = {
5+ logo : "{{ .UI.Logo }}" ,
6+ header : "{{ .UI.Header }}" ,
7+ dashboardHeading : "{{ .UI.DashboardHeading }}" ,
8+ dashboardSubheading : "{{ .UI.DashboardSubheading }}" ,
9+ link : "{{ .UI.Link }}" ,
10+ buttons : [ ] ,
11+ maximumNumberOfResults : "{{ .UI.MaximumNumberOfResults }}" ,
12+ defaultSortBy : "{{ .UI.DefaultSortBy }}" ,
13+ defaultFilterBy : "{{ .UI.DefaultFilterBy }}"
14+ } ;
15+ { { - range . UI . Buttons } } window . config . buttons . push ( { name :"{{ .Name }}" , link :"{{ .Link }}" } ) ; { { end } }
16+ } else {
17+ console . warn ( 'Running in development mode; UI configuration is not injected.' ) ;
18+ document . title = 'Gatus (Development)' ;
19+ }
20+ // Initialize theme immediately to prevent flash
421 const themeFromCookie = document . cookie . match ( / t h e m e = ( d a r k | l i g h t ) ; ? / ) ?. [ 1 ] ;
522 const prefersDark = window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches ;
623 if ( themeFromCookie === 'dark' || ( ! themeFromCookie && prefersDark ) ) {
724 document . documentElement . classList . add ( 'dark' ) ;
825 } else {
926 document . documentElement . classList . remove ( 'dark' ) ;
1027 }
11- } ) ( ) ; </ script > < title > {{ .UI.Title }}</ title > < meta http-equiv ="X-UA-Compatible " content ="IE=edge "/> < meta name ="viewport " content ="width=device-width,initial-scale=1 "/> < link rel ="apple-touch-icon " sizes ="180x180 " href ="/apple-touch-icon.png "/> < link rel ="icon " type ="image/png " sizes ="32x32 " href ="/favicon-32x32.png "/> < link rel ="icon " type ="image/png " sizes ="16x16 " href ="/favicon-16x16.png "/> < link rel ="manifest " href ="/manifest.json " crossorigin ="use-credentials "/> < link rel ="shortcut icon " href ="/favicon.ico "/> < link rel ="stylesheet " href ="/css/custom.css "/> < meta name ="description " content ="{{ .UI.Description }} "/> < meta name ="apple-mobile-web-app-status-bar-style " content ="black-translucent "/> < meta name ="apple-mobile-web-app-title " content ="{{ .UI.Title }} "/> < meta name ="application-name " content ="{{ .UI.Title }} "/> < meta name ="theme-color " content ="#f7f9fb "/> < script defer ="defer " src ="/js/chunk-vendors.js "> </ script > < script defer ="defer " src ="/js/app.js "> </ script > < link href ="/css/app.css " rel ="stylesheet "> </ head > < body > < noscript > < strong > Enable JavaScript to view this page.</ strong > </ noscript > < div id ="app "> </ div > </ body > </ html >
28+ } ) ( ) ; </ script > < meta http-equiv ="X-UA-Compatible " content ="IE=edge "/> < meta name ="viewport " content ="width=device-width,initial-scale=1 "/> < link rel ="apple-touch-icon " sizes ="180x180 " href ="/apple-touch-icon.png "/> < link rel ="icon " type ="image/png " sizes ="32x32 " href ="/favicon-32x32.png "/> < link rel ="icon " type ="image/png " sizes ="16x16 " href ="/favicon-16x16.png "/> < link rel ="manifest " href ="/manifest.json " crossorigin ="use-credentials "/> < link rel ="shortcut icon " href ="/favicon.ico "/> < link rel ="stylesheet " href ="/css/custom.css "/> < meta name ="description " content ="{{ .UI.Description }} "/> < meta name ="apple-mobile-web-app-status-bar-style " content ="black-translucent "/> < meta name ="apple-mobile-web-app-title " content ="{{ .UI.Title }} "/> < meta name ="application-name " content ="{{ .UI.Title }} "/> < meta name ="theme-color " content ="#f7f9fb "/> < script defer ="defer " src ="/js/chunk-vendors.js "> </ script > < script defer ="defer " src ="/js/app.js "> </ script > < link href ="/css/app.css " rel ="stylesheet "> </ head > < body > < noscript > < strong > Enable JavaScript to view this page.</ strong > </ noscript > < div id ="app "> </ div > </ body > </ html >
0 commit comments