-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
136 lines (118 loc) · 5.36 KB
/
index.html
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html lang="zh-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Leopold Chou</title>
<link rel="shortcut icon" href="img/home_page/favicon.png">
<link rel="bookmark" href="img/home_page/favicon.png">
<link rel="stylesheet" href="css/home.css">
</head>
<body>
<div class="page-container">
<div class="page-bg"></div>
<div class="page-view">
<div class="main-container">
<div class="page-title">欢迎来到 <span class="debugger" onclick="activate_debugger()">Leopold</span> 的页面</div>
<div class="page-nav">
<div class="nav-title">页面导航</div>
<div class="nav-container">
<div class="nav-link btn-animation" onclick="window.open('resume.html', '_self')">
<img src="img/resume_page/favicon.png" alt="resume_page/favicon" class="nav-icon">
个人简历
</div>
<div class="nav-link btn-animation"
onclick="window.open('stand_alone_apps/scut/scut_settings.html', '_self')"
>
<img src="stand_alone_apps/scut/images/favicon.png" alt="resume_page/favicon" class="nav-icon">
SCUT 应用设置
</div>
</div>
</div>
<div class="themes-selector">
<div class="theme-title">主题</div>
<div class="theme-option-border" id="theme-btn-purple" onclick="onclickChangeTheme('purple', this)">
<div class="theme-option theme-option-purple"></div>
</div>
<div class="theme-option-border" id="theme-btn-blue" onclick="onclickChangeTheme('blue', this)">
<div class="theme-option theme-option-blue"></div>
</div>
<div class="theme-option-border" id="theme-btn-green" onclick="onclickChangeTheme('green', this)">
<div class="theme-option theme-option-green"></div>
</div>
<div class="theme-option-border" id="theme-btn-yellow" onclick="onclickChangeTheme('yellow', this)">
<div class="theme-option theme-option-yellow"></div>
</div>
<div class="theme-option-border" id="theme-btn-orange" onclick="onclickChangeTheme('orange', this)">
<div class="theme-option theme-option-orange"></div>
</div>
<div class="theme-option-border" id="theme-btn-red" onclick="onclickChangeTheme('red', this)">
<div class="theme-option theme-option-red"></div>
</div>
<div class="theme-option-border" id="theme-btn-grey" onclick="onclickChangeTheme('grey', this)">
<div class="theme-option theme-option-grey"></div>
</div>
</div>
<div class="debugger-container" id="debugger-container" style="display: none;">
<div class="test-btn btn-animation" onclick="setCookie('testCookie', 'testContent')">设置 test cookie</div>
<div class="test-btn btn-animation" onclick="removeCookie()">移除所有 cookie</div>
<div class="test-btn btn-animation" onclick="showCookie()">显示 cookie</div>
<div class="debugger-log" id="debugger-log"># log</div>
</div>
</div>
</div>
</div>
</body>
<script src="js/change_theme.js"></script>
<script src="js/js.cookie/js.cookie.min.js"></script>
<script>
function log_to_custom(logMsg) {
document.getElementById("debugger-log").innerText += "\n" + logMsg;
}
const pagePos = window.location.pathname;
const projRootPath = pagePos.substring(0, pagePos.lastIndexOf("/") + 1);
function setCookie(name, value, exp = 30) {
Cookies.set(name, value, { expires: exp, path: projRootPath });
}
function removeCookie(name) {
if (!name) {
let cookies = Cookies.get();
for (let name in cookies) {
Cookies.remove(name, { path: projRootPath })
}
return;
}
Cookies.remove(name, { path: projRootPath });
}
function showCookie() {
let cookies = Cookies.get();
console.log(cookies);
log_to_custom("cookies: {");
for (let name in cookies) log_to_custom(name + ": " + cookies[name] + ",");
log_to_custom("}");
}
window.onload = function () {
let color = Cookies.get("themeColor");
if (color)
changeTheme(color, document.getElementById("theme-btn-" + color));
console.log(projRootPath);
log_to_custom(projRootPath);
}
function onclickChangeTheme(color, element) {
changeTheme(color, element);
setCookie("themeColor", color);
}
let debuggerClickedTimes = 0;
function activate_debugger() {
if (debuggerClickedTimes == -1) {
document.getElementById("debugger-container").setAttribute("style", "display: none;");
debuggerClickedTimes = 0;
return;
}
if (++debuggerClickedTimes == 10) {
document.getElementById("debugger-container").setAttribute("style", "");
debuggerClickedTimes = -1;
}
}
</script>
</html>