You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
216 lines
5.2 KiB
216 lines
5.2 KiB
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>文本差异对比</title>
|
|
<style>
|
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
body {
|
|
margin: 0;
|
|
padding: 36px 24px;
|
|
background: radial-gradient(circle at top, #111827, #0b0f14);
|
|
color: #e5e7eb;
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.box {
|
|
max-width: 1200px;
|
|
margin: auto;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 22px;
|
|
font-weight: 600;
|
|
color: #f3f4f6;
|
|
margin-bottom: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.card {
|
|
background: rgba(255,255,255,0.03);
|
|
border: 1px solid rgba(255,255,255,0.08);
|
|
border-radius: 16px;
|
|
padding: 24px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.section-label {
|
|
font-size: 12px;
|
|
color: #6b7280;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
textarea {
|
|
width: 100%;
|
|
background: #0d1117;
|
|
border: 1px solid rgba(255,255,255,0.1);
|
|
border-radius: 12px;
|
|
color: #e6edf3;
|
|
font-family: "SF Mono", "Fira Code", Consolas, monospace;
|
|
font-size: 13.5px;
|
|
line-height: 1.7;
|
|
padding: 16px;
|
|
outline: none;
|
|
transition: border-color 0.2s;
|
|
resize: vertical;
|
|
}
|
|
|
|
textarea:focus { border-color: rgba(59,130,246,0.5); }
|
|
textarea::placeholder { color: #484f58; }
|
|
|
|
.grid-inputs {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 16px;
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.input-area {
|
|
min-height: 240px;
|
|
border-color: rgba(59,130,246,0.15);
|
|
}
|
|
|
|
.btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
padding: 10px 20px;
|
|
font-size: 13px;
|
|
border-radius: 10px;
|
|
border: none;
|
|
cursor: pointer;
|
|
font-weight: 500;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-primary { background: #2563eb; color: white; }
|
|
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }
|
|
|
|
/* diff result */
|
|
.diff-card {
|
|
background: rgba(255,255,255,0.02);
|
|
border: 1px solid rgba(255,255,255,0.08);
|
|
border-radius: 14px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.diff-header-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 14px 18px;
|
|
background: rgba(255,255,255,0.03);
|
|
border-bottom: 1px solid rgba(255,255,255,0.06);
|
|
}
|
|
|
|
.diff-header-bar span {
|
|
font-size: 12px;
|
|
color: #6b7280;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
}
|
|
|
|
.diff-wrapper {
|
|
overflow: auto;
|
|
max-height: 500px;
|
|
}
|
|
|
|
.diff-wrapper table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
font-size: 13px;
|
|
font-family: "SF Mono", "Fira Code", Consolas, monospace;
|
|
}
|
|
|
|
.diff-wrapper table td {
|
|
padding: 10px 16px;
|
|
border-bottom: 1px solid rgba(255,255,255,0.04);
|
|
vertical-align: top;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.diff-wrapper .diff-header { background: #0d1117; color: #6b7280; font-size: 11px; }
|
|
.diff-wrapper .diff-equal { background: transparent; color: #8b949e; }
|
|
.diff-wrapper .diff-remove { background: rgba(248,81,73,0.12); color: #ffa198; }
|
|
.diff-wrapper .diff-add { background: rgba(63,185,80,0.12); color: #7ee787; }
|
|
|
|
.diff-wrapper .diff-equal:hover { background: rgba(255,255,255,0.03); }
|
|
.diff-wrapper .diff-remove:hover { background: rgba(248,81,73,0.2); }
|
|
.diff-wrapper .diff-add:hover { background: rgba(63,185,80,0.2); }
|
|
|
|
.toast {
|
|
position: fixed;
|
|
right: 24px;
|
|
bottom: 24px;
|
|
background: rgba(17,24,39,0.96);
|
|
color: #e5e7eb;
|
|
padding: 10px 16px;
|
|
border-radius: 10px;
|
|
border: 1px solid rgba(34,197,94,0.3);
|
|
font-size: 13px;
|
|
opacity: 0;
|
|
transform: translateY(8px);
|
|
transition: all 0.25s ease;
|
|
z-index: 9999;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.toast.show { opacity: 1; transform: translateY(0); }
|
|
|
|
@media (max-width: 900px) {
|
|
.grid-inputs { grid-template-columns: 1fr; }
|
|
body { padding: 24px 16px; }
|
|
.card { padding: 18px 16px; }
|
|
.input-area { min-height: 180px; }
|
|
.btn { width: 100%; justify-content: center; }
|
|
.diff-wrapper { max-height: 350px; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="box">
|
|
<div class="page-title">📝 文本差异对比</div>
|
|
|
|
<div class="card">
|
|
<div class="section-label">输入文本</div>
|
|
<form method="get">
|
|
<div class="grid-inputs">
|
|
<div>
|
|
<textarea class="input-area" name="text1" placeholder="输入第一段文本(原始版本)...">{{ text1 or '' }}</textarea>
|
|
</div>
|
|
<div>
|
|
<textarea class="input-area" name="text2" placeholder="输入第二段文本(对比版本)...">{{ text2 or '' }}</textarea>
|
|
</div>
|
|
</div>
|
|
<button class="btn btn-primary">🔍 开始对比</button>
|
|
</form>
|
|
</div>
|
|
|
|
{% if diff_result %}
|
|
<div class="diff-card">
|
|
<div class="diff-header-bar">
|
|
<span>📊 对比结果</span>
|
|
</div>
|
|
<div class="diff-wrapper">{{ diff_result|safe }}</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="toast" id="toast"></div>
|
|
|
|
<script>
|
|
function showToast(msg) {
|
|
const t = document.getElementById('toast');
|
|
t.innerText = msg;
|
|
t.classList.add('show');
|
|
setTimeout(() => t.classList.remove('show'), 2000);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |