forked from MizuhaHimuraki/github-name-mapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.html
More file actions
362 lines (340 loc) · 14.8 KB
/
options.html
File metadata and controls
362 lines (340 loc) · 14.8 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub Name Mapper - 控制面板</title>
<link rel="stylesheet" href="options.css">
</head>
<body>
<div class="container">
<!-- 侧边栏 -->
<aside class="sidebar">
<div class="sidebar-header">
<div class="logo">
<svg width="28" height="28" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/>
</svg>
<div class="logo-text">
<span class="title">Name Mapper</span>
<span class="subtitle">控制面板</span>
</div>
</div>
</div>
<nav class="nav">
<a href="#config" class="nav-item active" data-section="config">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="3"/>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
</svg>
基础配置
</a>
<a href="#rules" class="nav-item" data-section="rules">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
<circle cx="8.5" cy="7" r="4"/>
<line x1="20" y1="8" x2="20" y2="14"/>
<line x1="23" y1="11" x2="17" y2="11"/>
</svg>
本地规则
</a>
<a href="#data" class="nav-item" data-section="data">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<ellipse cx="12" cy="5" rx="9" ry="3"/>
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
</svg>
数据预览
</a>
</nav>
<div class="sidebar-footer">
<div class="status-badge" id="statusBadge">
<span class="dot"></span>
<span class="text">已启用</span>
</div>
</div>
</aside>
<!-- 主内容区 -->
<main class="main">
<!-- 基础配置 -->
<section id="config" class="section active">
<div class="section-header">
<h1>基础配置</h1>
<p>配置数据源和更新策略</p>
</div>
<div class="card">
<div class="card-header">
<h3>功能开关</h3>
</div>
<div class="card-body">
<div class="form-group switch-group main-switch">
<div class="switch-info">
<label>🔌 启用插件</label>
<p>总开关,关闭后所有功能停用</p>
</div>
<label class="toggle-switch">
<input type="checkbox" id="enableToggle">
<span class="slider"></span>
</label>
</div>
<div class="sub-switches" id="subSwitches">
<div class="form-group switch-group">
<div class="switch-info">
<label>👤 识别用户</label>
<p>将 GitHub 用户名替换为「用户名(花名)」格式</p>
</div>
<label class="toggle-switch">
<input type="checkbox" id="featureReplaceToggle">
<span class="slider"></span>
</label>
</div>
<div class="form-group switch-group">
<div class="switch-info">
<label>✨ 文字高亮</label>
<p>为已识别的用户名文字添加微妙的背景色</p>
</div>
<label class="toggle-switch">
<input type="checkbox" id="featureHighlightToggle">
<span class="slider"></span>
</label>
</div>
<div class="form-group switch-group">
<div class="switch-info">
<label>🖼️ 头像高亮</label>
<p>为已识别用户的头像添加渐变边框</p>
</div>
<label class="toggle-switch">
<input type="checkbox" id="featureAvatarHighlightToggle">
<span class="slider"></span>
</label>
</div>
<div class="form-group switch-group">
<div class="switch-info">
<label>💬 @@ 快速补全</label>
<p>输入 @@ 或按 ⌘/Ctrl+Shift+M 快速提及团队成员</p>
</div>
<label class="toggle-switch">
<input type="checkbox" id="featureMentionToggle">
<span class="slider"></span>
</label>
</div>
<div class="form-group switch-group">
<div class="switch-info">
<label>🐛 调试模式</label>
<p>在浏览器控制台输出调试日志(F12 查看)</p>
</div>
<label class="toggle-switch">
<input type="checkbox" id="debugToggle">
<span class="slider"></span>
</label>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h3>数据源配置</h3>
</div>
<div class="card-body">
<div class="form-group">
<label for="jsonUrl">JSON URL</label>
<p class="form-hint">配置包含 developers 数组的 JSON 文件地址</p>
<div class="input-group">
<input type="url" id="jsonUrl" placeholder="https://example.com/developers.json">
<button class="btn btn-primary" id="fetchBtn">加载</button>
</div>
</div>
<div class="form-group switch-group">
<div class="switch-info">
<label>每日自动更新</label>
<p>每天自动从 URL 获取最新数据</p>
</div>
<label class="toggle-switch">
<input type="checkbox" id="autoUpdate">
<span class="slider"></span>
</label>
</div>
<div class="form-group">
<label>数据状态</label>
<div class="status-info">
<div class="status-row">
<span>远程规则:</span>
<strong id="remoteCount">0</strong> 条
</div>
<div class="status-row">
<span>本地规则:</span>
<strong id="localCount">0</strong> 条
</div>
<div class="status-row">
<span>最后更新:</span>
<strong id="lastUpdate">从未</strong>
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h3>JSON 格式说明</h3>
</div>
<div class="card-body">
<pre class="code-block">{
"developers": [
{
"domain": "zhangsan",
"nick": "张三",
"github_name": "zhangsan-dev",
"github_acc": "zhangsan@example.com"
}
]
}</pre>
</div>
</div>
</section>
<!-- 本地规则 -->
<section id="rules" class="section">
<div class="section-header">
<h1>本地规则</h1>
<p>添加和管理本地映射规则,优先级高于远程数据</p>
</div>
<div class="card">
<div class="card-header">
<h3>添加规则</h3>
</div>
<div class="card-body">
<form id="addRuleForm" class="rule-form">
<div class="form-row">
<div class="form-group">
<label for="ruleDomain">域账号</label>
<input type="text" id="ruleDomain" placeholder="zhangsan">
</div>
<div class="form-group">
<label for="ruleNick">花名 *</label>
<input type="text" id="ruleNick" placeholder="张三" required>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="ruleGithub">GitHub 用户名 *</label>
<input type="text" id="ruleGithub" placeholder="zhangsan-dev" required>
</div>
<div class="form-group">
<label for="ruleEmail">GitHub 邮箱</label>
<input type="email" id="ruleEmail" placeholder="zhangsan@example.com">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="12" y1="5" x2="12" y2="19"/>
<line x1="5" y1="12" x2="19" y2="12"/>
</svg>
添加规则
</button>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-header">
<h3>规则列表</h3>
<div class="card-header-actions">
<input id="localRulesImportFile" type="file" accept="application/json" hidden>
<button type="button" class="btn btn-secondary" id="importLocalRulesBtn" title="从本地 JSON 文件导入本地规则">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" y1="15" x2="12" y2="3"/>
</svg>
导入
</button>
<button type="button" class="btn btn-secondary" id="exportLocalRulesBtn" title="导出当前本地规则为 JSON 文件">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="17 8 12 3 7 8"/>
<line x1="12" y1="3" x2="12" y2="15"/>
</svg>
导出
</button>
<span class="badge" id="localRuleBadge">0</span>
</div>
</div>
<div class="card-body">
<div class="rules-list" id="localRulesList">
<div class="empty-state">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
<circle cx="9" cy="7" r="4"/>
<path d="M23 21v-2a4 4 0 0 0-3-3.87"/>
<path d="M16 3.13a4 4 0 0 1 0 7.75"/>
</svg>
<p>暂无本地规则</p>
<span>使用上方表单添加自定义映射规则</span>
</div>
</div>
</div>
</div>
</section>
<!-- 数据预览 -->
<section id="data" class="section">
<div class="section-header">
<h1>数据预览</h1>
<p>查看所有已加载的开发者映射数据</p>
</div>
<div class="card">
<div class="card-header">
<h3>搜索</h3>
</div>
<div class="card-body">
<div class="search-box">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/>
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
<input type="text" id="searchInput" placeholder="搜索域账号、花名或 GitHub 用户名...">
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h3>开发者列表</h3>
<span class="badge" id="totalBadge">0</span>
</div>
<div class="card-body">
<div class="table-container">
<table class="data-table">
<thead>
<tr>
<th>域账号</th>
<th>花名</th>
<th>GitHub 用户名</th>
<th>邮箱</th>
<th>来源</th>
</tr>
</thead>
<tbody id="dataTableBody">
</tbody>
</table>
</div>
<div class="empty-state" id="emptyData" style="display: none;">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<ellipse cx="12" cy="5" rx="9" ry="3"/>
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/>
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/>
</svg>
<p>暂无数据</p>
<span>请先配置 JSON URL 并加载数据</span>
</div>
</div>
</div>
</section>
</main>
</div>
<!-- Toast 提示 -->
<div class="toast" id="toast">
<span class="toast-icon"></span>
<span class="toast-message"></span>
</div>
<script src="options.js"></script>
</body>
</html>