PushGo Auto Commit 2026-03-29T12:17:45.673Z
This commit is contained in:
288
options.html
Normal file
288
options.html
Normal file
@@ -0,0 +1,288 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Transly 配置</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg-top: #e6f6f1;
|
||||
--bg-bottom: #f7f9fc;
|
||||
--card: #ffffff;
|
||||
--line: #d6e6e1;
|
||||
--text-main: #13221d;
|
||||
--text-sub: #546860;
|
||||
--brand: #0f766e;
|
||||
--brand-hover: #0c625b;
|
||||
--focus: #0f766e;
|
||||
--danger: #b42318;
|
||||
--success: #126f42;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100dvh;
|
||||
font-family: "Trebuchet MS", "PingFang SC", "Noto Sans SC", sans-serif;
|
||||
color: var(--text-main);
|
||||
background: linear-gradient(165deg, var(--bg-top), var(--bg-bottom));
|
||||
}
|
||||
|
||||
.page {
|
||||
width: min(860px, 100%);
|
||||
margin: 0 auto;
|
||||
padding: 28px 16px 40px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.hero-mark {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(135deg, #0f766e, #24a781);
|
||||
color: #ffffff;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin-top: 4px;
|
||||
font-size: 14px;
|
||||
color: var(--text-sub);
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--card);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 12px 30px rgba(17, 66, 56, 0.1);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.group {
|
||||
padding: 18px 18px 16px;
|
||||
}
|
||||
|
||||
.group + .group {
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.group-title {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.group-sub {
|
||||
margin: 4px 0 14px;
|
||||
font-size: 13px;
|
||||
color: var(--text-sub);
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
border: 1px solid #bfd4cc;
|
||||
border-radius: 10px;
|
||||
margin-top: 6px;
|
||||
padding: 10px 12px;
|
||||
font-size: 14px;
|
||||
color: var(--text-main);
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
input::placeholder {
|
||||
color: #809790;
|
||||
}
|
||||
|
||||
input:focus-visible {
|
||||
outline: 2px solid var(--focus);
|
||||
outline-offset: 1px;
|
||||
border-color: var(--focus);
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
color: var(--text-sub);
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
padding: 16px 18px 18px;
|
||||
border-top: 1px solid var(--line);
|
||||
background: #f7fcfa;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
border: none;
|
||||
min-height: 44px;
|
||||
min-width: 132px;
|
||||
border-radius: 10px;
|
||||
padding: 0 18px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
background: var(--brand);
|
||||
cursor: pointer;
|
||||
transition: background-color 180ms ease, transform 180ms ease;
|
||||
}
|
||||
|
||||
.action-btn:hover {
|
||||
background: var(--brand-hover);
|
||||
}
|
||||
|
||||
.action-btn:active {
|
||||
transform: scale(0.985);
|
||||
}
|
||||
|
||||
.action-btn:disabled {
|
||||
opacity: 0.56;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.action-btn:focus-visible {
|
||||
outline: 2px solid var(--focus);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
#test {
|
||||
color: #124b41;
|
||||
background: #e9f4f1;
|
||||
border: 1px solid #bfd4cc;
|
||||
}
|
||||
|
||||
#test:hover {
|
||||
background: #deefea;
|
||||
}
|
||||
|
||||
#clear {
|
||||
color: #9b1b14;
|
||||
background: #fff4f2;
|
||||
border: 1px solid #efcdc9;
|
||||
}
|
||||
|
||||
#clear:hover {
|
||||
background: #fdebe8;
|
||||
}
|
||||
|
||||
#save:hover {
|
||||
background: var(--brand-hover);
|
||||
}
|
||||
|
||||
#save:active {
|
||||
transform: scale(0.985);
|
||||
}
|
||||
|
||||
#msg {
|
||||
min-height: 18px;
|
||||
font-size: 13px;
|
||||
color: var(--text-sub);
|
||||
}
|
||||
|
||||
#msg[data-type="error"] {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
#msg[data-type="success"] {
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
@media (min-width: 760px) {
|
||||
.grid {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
.group + .group {
|
||||
border-top: 0;
|
||||
border-left: 1px solid var(--line);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.action-btn {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main class="page">
|
||||
<header class="hero">
|
||||
<div class="hero-mark" aria-hidden="true">T</div>
|
||||
<div>
|
||||
<h1>Transly 配置</h1>
|
||||
<div class="subtitle">最小配置即可开始直译</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="card" aria-label="配置表单">
|
||||
<div class="grid">
|
||||
<section class="group">
|
||||
<h2 class="group-title">接口信息</h2>
|
||||
<p class="group-sub">支持 OpenAI 兼容接口。</p>
|
||||
|
||||
<label for="baseUrl">API Base URL</label>
|
||||
<input id="baseUrl" placeholder="https://api.openai.com" autocomplete="off" />
|
||||
<p class="hint">提示:填写接口根地址,不要加 <code>/v1</code>(例如 <code>https://api.openai.com</code>)。</p>
|
||||
|
||||
<label for="apiKey">API Key</label>
|
||||
<input id="apiKey" type="password" placeholder="sk-..." autocomplete="off" />
|
||||
<p class="hint">API Key 存在 chrome.storage.local;其余字段存在 chrome.storage.sync。</p>
|
||||
</section>
|
||||
|
||||
<section class="group">
|
||||
<h2 class="group-title">翻译偏好</h2>
|
||||
<p class="group-sub">默认低温、纯译文输出。</p>
|
||||
|
||||
<label for="model">Model</label>
|
||||
<input id="model" placeholder="gpt-4o-mini" autocomplete="off" />
|
||||
|
||||
<label for="targetLang">目标语言</label>
|
||||
<input id="targetLang" placeholder="zh-CN" autocomplete="off" />
|
||||
<p class="hint">示例:`zh-CN`、`en`、`ja`。</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer class="actions">
|
||||
<button id="save" class="action-btn" type="button">保存配置</button>
|
||||
<button id="test" class="action-btn" type="button">测试连接</button>
|
||||
<button id="clear" class="action-btn" type="button">清除配置</button>
|
||||
<div id="msg" role="status" aria-live="polite"></div>
|
||||
</footer>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user