feat: 简航 SimpleNav 个人网站导航系统(PHP + SQLite)
- 前台:搜索引擎切换+联想下拉、网格板块(常用/工具)、合集标签页 - 后台:初始化/登录、网站/板块/引擎增删改、上下移排序 - 添加网站自动抓取名称与图标(存储于服务器),支持自定义简称 - 一键全部更新(批量刷新图标+名称,保留自定义简称) - 搜索联想服务端代理(必应/百度/谷歌/搜狗/360/DuckDuckGo) - 零依赖:原生 CSS/JS,PDO SQLite
@@ -0,0 +1,74 @@
|
||||
/* 简航 SimpleNav —— 后台样式 */
|
||||
body.admin { background: #eef0f3; color: #333; font-size: 14px; }
|
||||
.topbar {
|
||||
display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 56px;
|
||||
background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 50;
|
||||
}
|
||||
.topbar .brand { font-size: 17px; font-weight: 700; }
|
||||
.topbar .brand a { color: #2F6BF7; }
|
||||
.topbar .brand span { color: #999; font-weight: 400; font-size: 13px; margin-left: 6px; }
|
||||
.topnav { display: flex; gap: 4px; flex: 1; }
|
||||
.topnav a { padding: 8px 14px; border-radius: 8px; color: #555; }
|
||||
.topnav a:hover { background: #f2f4f7; }
|
||||
.topnav a.active { background: #2F6BF7; color: #fff; }
|
||||
.topright { display: flex; align-items: center; gap: 10px; color: #666; }
|
||||
.wrap { max-width: 1140px; margin: 20px auto 60px; padding: 0 16px; }
|
||||
|
||||
.card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
|
||||
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
|
||||
.card-head h2 { font-size: 16px; margin: 0; }
|
||||
|
||||
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
|
||||
.grid-form label { display: flex; flex-direction: column; font-size: 13px; color: #555; gap: 5px; }
|
||||
.grid-form label.chk { flex-direction: row; align-items: center; gap: 6px; }
|
||||
.grid-form .span2 { grid-column: 1 / -1; }
|
||||
.grid-form .row { display: flex; gap: 8px; }
|
||||
.grid-form .row input { flex: 1; }
|
||||
.grid-form input[type=text], .grid-form input[type=password], .grid-form select {
|
||||
height: 38px; padding: 0 10px; border: 1px solid #d9dde3; border-radius: 8px; font-size: 14px; width: 100%;
|
||||
}
|
||||
.grid-form input:focus, .grid-form select:focus { outline: none; border-color: #2F6BF7; }
|
||||
.form-actions { display: flex; align-items: center; gap: 10px; }
|
||||
.hint { color: #999; font-size: 12px; }
|
||||
|
||||
.btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; }
|
||||
.btn.primary { background: #2F6BF7; color: #fff; }
|
||||
.btn.primary:hover { background: #2456cc; }
|
||||
.btn.ghost { background: #f2f4f7; color: #444; }
|
||||
.btn.ghost:hover { background: #e6e9ee; }
|
||||
.btn.block { width: 100%; justify-content: center; }
|
||||
|
||||
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
|
||||
.alert.ok { background: #e8f6ee; color: #1a7f45; }
|
||||
.alert.err { background: #fdecec; color: #c0392b; }
|
||||
|
||||
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
.tbl th, .tbl td { padding: 9px 8px; text-align: left; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
|
||||
.tbl th { color: #888; font-weight: 500; }
|
||||
.tbl tr:hover td { background: #fafbfc; }
|
||||
.tbl .muted { color: #999; }
|
||||
.tbl .ell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.tbl .nowrap { white-space: nowrap; }
|
||||
.mini { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; background: #f4f5f7; }
|
||||
.mini.letter { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; }
|
||||
.inline { display: inline; }
|
||||
.ico-btn { border: none; background: #f2f4f7; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; color: #555; margin: 0 1px; }
|
||||
.ico-btn:hover { background: #e6e9ee; }
|
||||
.ico-btn.danger { color: #c0392b; }
|
||||
.ok-dot { color: #1a7f45; font-size: 12px; }
|
||||
|
||||
/* 登录页 */
|
||||
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
|
||||
.login-card { width: 340px; background: #fff; border-radius: 14px; padding: 30px 26px; box-shadow: 0 10px 30px rgba(0,0,0,.08); text-align: center; }
|
||||
.login-card h1 { font-size: 20px; margin: 8px 0 2px; }
|
||||
.login-card .sub { color: #999; font-size: 13px; margin: 0 0 18px; }
|
||||
.login-card input { width: 100%; height: 42px; margin-bottom: 12px; padding: 0 12px; border: 1px solid #d9dde3; border-radius: 8px; font-size: 14px; }
|
||||
.login-card input:focus { outline: none; border-color: #2F6BF7; }
|
||||
.login-card .btn { height: 42px; }
|
||||
.login-logo { width: 56px; height: 56px; }
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.grid-form { grid-template-columns: 1fr; }
|
||||
.topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; }
|
||||
.tbl .ell { max-width: 120px; }
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/* 简航 SimpleNav —— 样式(复刻 n.yangyq.net 的灰底白卡片风格,去 Bootstrap 依赖) */
|
||||
:root { --primary: #2F6BF7; }
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
|
||||
background: #d8d9da;
|
||||
color: #333;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
a { text-decoration: none; color: inherit; }
|
||||
.container { max-width: 1140px; margin: 50px auto 40px; padding: 0 15px; }
|
||||
|
||||
/* ---------- 搜索 ---------- */
|
||||
.s-search { position: relative; z-index: 2000; margin-bottom: 10px; }
|
||||
.search-type { margin-bottom: 0; }
|
||||
.s-engine {
|
||||
display: inline-block; padding: 6px 14px; margin: 0 2px 0 0;
|
||||
background: rgba(255,255,255,.45); border-radius: 5px 5px 0 0; cursor: pointer;
|
||||
font-size: 14px; line-height: 20px; transition: background .2s;
|
||||
}
|
||||
.s-engine span { color: var(--ec, #555); }
|
||||
.s-engine:hover { background: rgba(255,255,255,.75); }
|
||||
.s-engine.active { background: #fff; }
|
||||
#search-form { position: relative; }
|
||||
#search-text {
|
||||
width: 100%; height: 50px; line-height: 50px; text-indent: 14px; font-size: 16px;
|
||||
border: none; border-radius: 5px; background: #fff; outline: 0;
|
||||
box-shadow: 0 0.5rem 0.625rem rgba(212,212,212,.3); transition: box-shadow .3s;
|
||||
}
|
||||
#search-text:focus { box-shadow: 0 0 24px 0 rgba(50,50,50,.08); }
|
||||
#search button.submit {
|
||||
position: absolute; top: 7px; right: 7px; width: 60px; height: 36px;
|
||||
background: none; border: 0; border-radius: 3px; cursor: pointer; outline: none;
|
||||
}
|
||||
#search button.submit::after {
|
||||
content: ""; display: block; width: 16px; height: 16px; margin: 0 auto;
|
||||
border: 2px solid #c9c9c9; border-radius: 50%; position: relative;
|
||||
}
|
||||
#search button.submit::before {
|
||||
content: ""; position: absolute; right: 20px; bottom: 9px; width: 7px; height: 2px;
|
||||
background: #c9c9c9; transform: rotate(45deg);
|
||||
}
|
||||
#word {
|
||||
position: absolute; list-style: none; top: 55px; left: 0; width: 100%; margin: 0;
|
||||
background: #fff; border-radius: 5px; z-index: 20000; padding: 10px;
|
||||
box-shadow: 0 0 10px #bbb; display: none;
|
||||
}
|
||||
#word li { height: 35px; padding: 0 8px; line-height: 35px; cursor: pointer; font-size: 16px; border-radius: 5px; }
|
||||
#word li:hover { background: #eee; }
|
||||
|
||||
/* ---------- 板块卡片 ---------- */
|
||||
.mylist {
|
||||
list-style: none; margin: 16px 0; padding: 12px 20px;
|
||||
background: #fff; border-radius: 15px; box-shadow: 0 0.5rem 0.625rem rgba(212,212,212,.3);
|
||||
display: flex; flex-wrap: wrap;
|
||||
}
|
||||
.mylist > li.title {
|
||||
width: 100%; margin: 0 0 10px; padding: 0 0 8px 10px; height: auto;
|
||||
font-size: 16px; font-weight: 600; line-height: 24px;
|
||||
border-bottom: 1px solid #eee; position: relative;
|
||||
}
|
||||
.mylist > li.title::before {
|
||||
content: ""; position: absolute; left: 0; top: 3px; width: 4px; height: 18px;
|
||||
background: var(--primary); border-radius: 2px;
|
||||
}
|
||||
.mylist > li.site { margin: 2px; }
|
||||
.mylist li.site a {
|
||||
display: flex; flex-direction: column; align-items: center; width: 100px; padding: 10px 4px;
|
||||
border-radius: 10px; transition: background .2s;
|
||||
}
|
||||
.mylist li.site a:hover { background: #f0f1f2; }
|
||||
.mylist li.site .icon { width: 45px; height: 45px; border-radius: 10px; background: #fff; object-fit: contain; }
|
||||
.mylist li.site .ico-letter {
|
||||
width: 45px; height: 45px; border-radius: 10px; color: #fff; font-size: 20px; font-weight: 600;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.mylist li.site .name {
|
||||
width: 100%; margin-top: 6px; text-align: center; font-size: 13px; color: #555;
|
||||
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* ---------- 合集标签页 ---------- */
|
||||
.collections { margin: 16px 0; }
|
||||
.collections-title {
|
||||
font-size: 16px; font-weight: 600; padding: 0 0 8px 10px; margin: 0 0 10px;
|
||||
position: relative;
|
||||
}
|
||||
.collections-title::before {
|
||||
content: ""; position: absolute; left: 0; top: 3px; width: 4px; height: 18px;
|
||||
background: var(--primary); border-radius: 2px;
|
||||
}
|
||||
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
|
||||
.tabs .tab {
|
||||
border: none; background: rgba(255,255,255,.65); color: #444; cursor: pointer;
|
||||
padding: 7px 16px; border-radius: 18px; font-size: 14px; transition: all .2s;
|
||||
}
|
||||
.tabs .tab:hover { background: #fff; }
|
||||
.tabs .tab.active { background: var(--primary); color: #fff; }
|
||||
.tab-panel { display: none; }
|
||||
.tab-panel.active { display: flex; }
|
||||
|
||||
/* ---------- 页脚 ---------- */
|
||||
.foot { text-align: center; color: #8a8a8a; font-size: 12px; margin: 24px 0 0; }
|
||||
.foot a { color: #8a8a8a; }
|
||||
.foot a:hover { color: var(--primary); }
|
||||
|
||||
/* ---------- 响应式 ---------- */
|
||||
@media (max-width: 767px) {
|
||||
.container { margin-top: 24px; }
|
||||
.mylist { border-radius: 10px; padding: 10px 12px; }
|
||||
.mylist li.site a { width: 25%; }
|
||||
.mylist li.site .icon, .mylist li.site .ico-letter { width: 40px; height: 40px; }
|
||||
.mylist li.site .name { font-size: 12px; }
|
||||
}
|
||||
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 615 B |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,14 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="简航 SimpleNav">
|
||||
<defs>
|
||||
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0" stop-color="#3B77FF"/>
|
||||
<stop offset="1" stop-color="#2F6BF7"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle cx="256" cy="256" r="256" fill="url(#bg)"/>
|
||||
<rect x="116" y="116" width="280" height="280" rx="72" fill="none" stroke="#FFFFFF" stroke-width="40" transform="rotate(45 256 256)"/>
|
||||
<g fill="#FFFFFF">
|
||||
<circle cx="256" cy="232" r="31"/>
|
||||
<path d="M192 324 C192 288 220 270 256 270 C292 270 320 288 320 324 Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 636 B |
@@ -0,0 +1,106 @@
|
||||
/* 简航 SimpleNav —— 后台交互 */
|
||||
(function () {
|
||||
'use strict';
|
||||
var $ = function (s) { return document.querySelector(s); };
|
||||
|
||||
/* ---------- 自动获取网站信息 ---------- */
|
||||
var fetchBtn = $('#btn-fetch');
|
||||
if (fetchBtn) {
|
||||
fetchBtn.addEventListener('click', function () {
|
||||
var url = ($('#f-url') || {}).value || '';
|
||||
var hint = $('#fetch-hint');
|
||||
if (!url) { if (hint) hint.textContent = '请先填写网址'; return; }
|
||||
if (hint) hint.textContent = '正在获取…';
|
||||
fetchBtn.disabled = true;
|
||||
fetch(fetchBtn.getAttribute('data-url') + '?url=' + encodeURIComponent(url))
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (d) {
|
||||
fetchBtn.disabled = false;
|
||||
if (!d.ok) { if (hint) hint.textContent = d.msg || '获取失败'; return; }
|
||||
if ($('#f-name')) $('#f-name').value = d.name || '';
|
||||
if ($('#f-short') && !$('#f-short').value) $('#f-short').value = d.short || d.name || '';
|
||||
if ($('#f-icon')) $('#f-icon').value = d.icon || '';
|
||||
if (hint) hint.textContent = (d.icon ? '已获取名称与图标' : '已获取名称(未找到图标)') + (d.url ? ':' + d.url : '');
|
||||
})
|
||||
.catch(function () { fetchBtn.disabled = false; if (hint) hint.textContent = '网络错误'; });
|
||||
});
|
||||
}
|
||||
var resetBtn = $('#btn-reset');
|
||||
if (resetBtn) {
|
||||
resetBtn.addEventListener('click', function () {
|
||||
['f-id', 'f-url', 'f-name', 'f-short', 'f-icon'].forEach(function (id) { var el = $('#' + id); if (el) el.value = id === 'f-id' ? '0' : ''; });
|
||||
var v = $('#f-visible'); if (v) v.checked = true;
|
||||
var h = $('#fetch-hint'); if (h) h.textContent = '';
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- 编辑网站:回填表单 ---------- */
|
||||
document.querySelectorAll('.edit-site').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var d = btn.dataset;
|
||||
$('#f-id').value = d.id;
|
||||
$('#f-group').value = d.group;
|
||||
$('#f-url').value = d.url;
|
||||
$('#f-name').value = d.name;
|
||||
$('#f-short').value = d.short;
|
||||
$('#f-icon').value = d.icon;
|
||||
$('#f-visible').checked = d.visible === '1';
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
|
||||
/* ---------- 编辑板块 / 引擎 ---------- */
|
||||
document.querySelectorAll('.edit-group').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var d = btn.dataset;
|
||||
$('#g-id').value = d.id; $('#g-name').value = d.name;
|
||||
$('#g-display').value = d.display; $('#g-visible').checked = d.visible === '1';
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
var gReset = $('#g-reset');
|
||||
if (gReset) gReset.addEventListener('click', function () { $('#g-id').value = '0'; $('#g-name').value = ''; $('#g-display').value = 'grid'; $('#g-visible').checked = true; });
|
||||
|
||||
document.querySelectorAll('.edit-engine').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var d = btn.dataset;
|
||||
$('#e-id').value = d.id; $('#e-name').value = d.name; $('#e-slug').value = d.slug;
|
||||
$('#e-search').value = d.search; $('#e-param').value = d.param; $('#e-sug').value = d.sug;
|
||||
$('#e-sugtype').value = d.sugtype; $('#e-color').value = d.color; $('#e-active').checked = d.active === '1';
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
var eReset = $('#e-reset');
|
||||
if (eReset) eReset.addEventListener('click', function () {
|
||||
['e-id', 'e-name', 'e-slug', 'e-search', 'e-sug', 'e-color'].forEach(function (id) { var el = $('#' + id); if (el) el.value = id === 'e-id' ? '0' : ''; });
|
||||
$('#e-param').value = 'q'; $('#e-active').checked = false;
|
||||
});
|
||||
|
||||
/* ---------- 一键“全部更新”(分批循环) ---------- */
|
||||
var upBtn = $('#btn-update-all');
|
||||
if (upBtn) {
|
||||
upBtn.addEventListener('click', function () {
|
||||
if (!confirm('将批量刷新所有网站的图标与名称(用户自定义简称不受影响),确定继续?')) return;
|
||||
var base = upBtn.getAttribute('data-url');
|
||||
var total = 0, updated = 0, failed = 0, offset = 0;
|
||||
upBtn.disabled = true;
|
||||
function step() {
|
||||
fetch(base + '?offset=' + offset + '&limit=6')
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (d) {
|
||||
total = d.total; updated += d.updated; failed += d.failed; offset = d.offset;
|
||||
upBtn.textContent = '⟳ 更新中 ' + Math.min(offset, total) + '/' + total;
|
||||
if (!d.done) { step(); }
|
||||
else {
|
||||
upBtn.disabled = false;
|
||||
upBtn.textContent = '⟳ 全部更新(图标+名称)';
|
||||
alert('更新完成:成功 ' + updated + ',失败/无变化 ' + failed + ',共 ' + total + ' 个网站。');
|
||||
location.reload();
|
||||
}
|
||||
})
|
||||
.catch(function () { upBtn.disabled = false; upBtn.textContent = '⟳ 全部更新(图标+名称)'; alert('更新中断,请重试。'); });
|
||||
}
|
||||
step();
|
||||
});
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,90 @@
|
||||
/* 简航 SimpleNav —— 前台交互:搜索引擎切换 + 联想下拉 + 合集标签页 */
|
||||
(function () {
|
||||
'use strict';
|
||||
var cfg = window.SIMPLENAV || {};
|
||||
|
||||
/* ---------- 搜索引擎切换 ---------- */
|
||||
var tabs = document.querySelectorAll('#engine-tabs .s-engine');
|
||||
var form = document.getElementById('search-form');
|
||||
var input = document.getElementById('search-text');
|
||||
|
||||
function activateEngine(el) {
|
||||
tabs.forEach(function (t) { t.classList.remove('active'); });
|
||||
el.classList.add('active');
|
||||
var search = el.getAttribute('data-search');
|
||||
var param = el.getAttribute('data-param');
|
||||
var slug = el.getAttribute('data-slug');
|
||||
var ph = el.getAttribute('data-placeholder') || '搜索';
|
||||
if (form) { form.setAttribute('action', search); }
|
||||
if (input) { input.setAttribute('name', param); input.setAttribute('placeholder', ph); }
|
||||
form.setAttribute('data-slug', slug);
|
||||
hideWord();
|
||||
}
|
||||
tabs.forEach(function (el) {
|
||||
el.addEventListener('click', function () { activateEngine(el); input && input.focus(); });
|
||||
});
|
||||
|
||||
/* ---------- 联想下拉 ---------- */
|
||||
var word = document.getElementById('word');
|
||||
var timer = null;
|
||||
var lastQ = '';
|
||||
|
||||
function hideWord() { if (word) { word.innerHTML = ''; word.style.display = 'none'; } }
|
||||
function showWord(items) {
|
||||
if (!word) return;
|
||||
if (!items || !items.length) { hideWord(); return; }
|
||||
word.innerHTML = items.map(function (t) {
|
||||
var d = document.createElement('div');
|
||||
d.textContent = t;
|
||||
return '<li>' + d.innerHTML + '</li>';
|
||||
}).join('');
|
||||
word.style.display = 'block';
|
||||
}
|
||||
|
||||
if (input) {
|
||||
input.addEventListener('input', function () {
|
||||
var q = input.value.trim();
|
||||
if (q === '') { hideWord(); return; }
|
||||
if (q === lastQ) return;
|
||||
lastQ = q;
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function () {
|
||||
var slug = form ? (form.getAttribute('data-slug') || '') : '';
|
||||
fetch(cfg.suggest + '?slug=' + encodeURIComponent(slug) + '&q=' + encodeURIComponent(q))
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (data) { showWord(data && data.items); })
|
||||
.catch(function () { hideWord(); });
|
||||
}, 180);
|
||||
});
|
||||
|
||||
input.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Enter' && word && word.style.display === 'block' && word.firstChild) {
|
||||
// 默认走第一条建议
|
||||
input.value = word.firstChild.textContent;
|
||||
hideWord();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
if (word && !word.contains(e.target) && e.target !== input) { hideWord(); }
|
||||
var li = e.target.closest ? e.target.closest('#word li') : null;
|
||||
if (li) {
|
||||
input.value = li.textContent;
|
||||
hideWord();
|
||||
if (form) { form.submit(); }
|
||||
}
|
||||
});
|
||||
|
||||
/* ---------- 合集标签页 ---------- */
|
||||
var collTabs = document.querySelectorAll('#coll-tabs .tab');
|
||||
collTabs.forEach(function (tab) {
|
||||
tab.addEventListener('click', function () {
|
||||
collTabs.forEach(function (t) { t.classList.remove('active'); });
|
||||
tab.classList.add('active');
|
||||
document.querySelectorAll('.tab-panel').forEach(function (p) { p.classList.remove('active'); });
|
||||
var panel = document.getElementById(tab.getAttribute('data-target'));
|
||||
if (panel) { panel.classList.add('active'); }
|
||||
});
|
||||
});
|
||||
})();
|
||||