-
-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathindex.html
More file actions
80 lines (72 loc) · 2.76 KB
/
index.html
File metadata and controls
80 lines (72 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="color-scheme" content="light dark" />
<meta name="viewport"
content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="apple-touch-icon" href="/pwa-192x192.png">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9">
<meta name="msapplication-TileColor" content="#00aba9">
<meta name="theme-color" content="#ffffff">
<meta name="description" content="webapp to manage your OTA updates for capacitor">
<meta name="title" content="Capgo app">
<title>Capgo app</title>
</head>
<body class="overflow-hidden h-full antialiased font-inter">
<div id="app-loader"></div>
<div id="app" class="overflow-hidden h-full"></div>
<script>
// Initialize theme before Vue app loads to prevent flash
(function () {
function applyTheme(isDark) {
const html = document.documentElement;
if (isDark) {
html.classList.add('dark');
html.setAttribute('data-theme', 'capgodark');
} else {
html.classList.remove('dark');
html.setAttribute('data-theme', 'capgolight');
}
}
// Check for saved theme preference or default to system preference
const savedTheme = localStorage.getItem('theme');
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
// Determine initial theme
let isDark;
if (savedTheme === 'dark') {
isDark = true;
} else if (savedTheme === 'light') {
isDark = false;
} else {
// No saved preference, use system preference
isDark = mediaQuery.matches;
}
applyTheme(isDark);
// Listen for system preference changes (only if no saved preference)
mediaQuery.addEventListener('change', function (e) {
const currentSavedTheme = localStorage.getItem('theme');
// Only auto-switch if user hasn't set a manual preference
if (!currentSavedTheme || currentSavedTheme === 'auto') {
applyTheme(e.matches);
}
});
// Expose theme toggle function globally for Vue to use
window.__setTheme = function (theme) {
if (theme === 'auto') {
localStorage.setItem('theme', 'auto');
applyTheme(mediaQuery.matches);
} else {
localStorage.setItem('theme', theme);
applyTheme(theme === 'dark');
}
};
})();
</script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>