-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
88 lines (86 loc) · 3.36 KB
/
index.html
File metadata and controls
88 lines (86 loc) · 3.36 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
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>DevTools Suite</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Favicon - 支持开发和生产环境 -->
<link rel="icon" type="image/png" sizes="16x16" href="/icons/icon16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon.png" />
<link rel="icon" type="image/png" sizes="48x48" href="/icons/icon48.png" />
<link rel="icon" type="image/png" sizes="128x128" href="/icons/icon128.png" />
<link rel="apple-touch-icon" sizes="128x128" href="/icons/icon128.png" />
<!-- 根目录 favicon(浏览器默认查找,兼容 GitHub Pages) -->
<link rel="shortcut icon" href="/favicon.png" />
<link rel="icon" href="/favicon.png" />
<style>
/* 基础样式 - 适用于所有环境 */
html, body {
margin: 0;
padding: 0;
box-sizing: border-box;
}
* {
box-sizing: border-box;
}
/* Chrome 插件 popup 窗口样式 - 仅在 Chrome 插件环境中生效 */
/* 这些样式会通过 JavaScript 动态添加 chrome-extension-env class 后生效 */
</style>
<script>
// 检测 Chrome 插件环境并应用样式
(function() {
const isChromeExtension = typeof chrome !== 'undefined' &&
chrome.runtime && chrome.runtime.id &&
!(typeof chrome !== 'undefined' && chrome.devtools);
if (isChromeExtension) {
document.documentElement.classList.add('chrome-extension-env');
document.body.classList.add('chrome-extension-env');
// 应用 Chrome 插件专用样式
const style = document.createElement('style');
style.textContent = `
html.chrome-extension-env, body.chrome-extension-env {
width: 720px !important;
height: 480px !important;
min-width: 720px !important;
min-height: 480px !important;
max-width: 720px !important;
max-height: 480px !important;
overflow: hidden !important;
display: flex !important;
flex-direction: column !important;
}
html.chrome-extension-env #app,
body.chrome-extension-env #app {
width: 720px !important;
height: 480px !important;
min-width: 720px !important;
min-height: 480px !important;
max-width: 720px !important;
max-height: 480px !important;
margin: 0 !important;
padding: 0 !important;
display: flex !important;
flex-direction: column !important;
flex-shrink: 0 !important;
}
html.chrome-extension-env .app,
body.chrome-extension-env .app {
width: 720px !important;
height: 480px !important;
min-width: 720px !important;
min-height: 480px !important;
max-width: 720px !important;
max-height: 480px !important;
flex-shrink: 0 !important;
}
`;
document.head.appendChild(style);
}
})();
</script>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>