添加并更改了一些新特性,优化网页操作逻辑
This commit is contained in:
1 parent
e09fc8ae6a
commit
c3bfce7afb
11 files changed
+704
-132
No files matched your search
+62
-21
@@ -131,6 +131,15 @@ select { width: auto; min-width: 150px; }
|
||||
transition: transform .2s ease, background .2s ease;
|
||||
}
|
||||
.theme-fab:hover { transform: scale(1.08); }
|
||||
/* 返回顶部按钮:与昼夜按钮并排(靠右两枚圆钮,仅滚动后出现) */
|
||||
.theme-fab.to-top {
|
||||
right: 76px; opacity: 0; visibility: hidden;
|
||||
transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
|
||||
}
|
||||
.theme-fab.to-top.show { opacity: 1; visibility: visible; }
|
||||
@media (max-width: 520px) {
|
||||
.theme-fab.to-top { right: 74px; }
|
||||
}
|
||||
|
||||
/* ============ 通用头部(品牌条 / 顶部条) ============ */
|
||||
.brand { display: inline-flex; align-items: center; gap: 12px; }
|
||||
@@ -174,27 +183,27 @@ select { width: auto; min-width: 150px; }
|
||||
/* 首页板块区:内容放得下时填满视口剩余高度(不出现竖向滚动条),内容超高时自然滚动 */
|
||||
.board-section { flex: 1 0 auto; display: flex; flex-direction: column; padding: 26px 0 24px; }
|
||||
.board-section > .wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; }
|
||||
/* 首页快捷站点条(后台“内容与顺序”配置,点击新标签页打开) */
|
||||
.quick-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 24px; }
|
||||
.quick-chip {
|
||||
position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 999px;
|
||||
background: var(--card); border: 1px solid var(--line-2); color: var(--text-2); font-size: 14px;
|
||||
box-shadow: var(--shadow-sm); text-decoration: none;
|
||||
transition: border-color .15s ease, color .15s ease, transform .12s ease, box-shadow .15s ease;
|
||||
/* 首页快捷站点:磁贴卡片(圆形图标底 + 名称 + 备注常显,网格对齐) */
|
||||
.quick-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 12px; margin-bottom: 24px; }
|
||||
.quick-tile {
|
||||
display: flex; align-items: center; gap: 12px; padding: 13px 14px; min-width: 0;
|
||||
background: var(--card); border: 1px solid var(--line); border-radius: 14px;
|
||||
text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
|
||||
transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
|
||||
}
|
||||
.quick-chip:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }
|
||||
.quick-chip .q-icon { font-size: 15px; line-height: 1; display: inline-flex; align-items: center; }
|
||||
.quick-chip .icon-img { width: 16px; height: 16px; object-fit: contain; }
|
||||
/* 快捷站点按钮 hover 备注(data-note) */
|
||||
a.quick-chip[data-note]::after {
|
||||
content: attr(data-note); position: absolute; z-index: 60; bottom: calc(100% + 8px); left: 50%;
|
||||
transform: translateX(-50%) translateY(4px); width: max-content; max-width: 320px;
|
||||
background: var(--tooltip-bg); color: var(--tooltip-text); font-size: 12px; line-height: 1.5;
|
||||
padding: 6px 10px; border-radius: 7px; white-space: normal; word-break: break-word;
|
||||
text-align: center; opacity: 0; pointer-events: none; box-shadow: var(--shadow);
|
||||
transition: opacity .14s ease, transform .14s ease;
|
||||
.quick-tile:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow); }
|
||||
.q-tile-ic {
|
||||
flex: 0 0 42px; width: 42px; height: 42px; border-radius: 12px;
|
||||
background: var(--accent-soft); display: flex; align-items: center; justify-content: center;
|
||||
font-size: 20px; line-height: 1;
|
||||
}
|
||||
.q-tile-ic .icon-img { width: 22px; height: 22px; object-fit: contain; }
|
||||
.q-tile-b { min-width: 0; flex: 1; }
|
||||
.q-tile-b b { display: block; font-size: 14.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.q-tile-b small {
|
||||
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-clamp: 2;
|
||||
overflow: hidden; color: var(--text-3); font-size: 12px; line-height: 1.5; margin-top: 2px; word-break: break-word;
|
||||
}
|
||||
a.quick-chip[data-note]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
|
||||
/* 通用图标 <img>(site_icon 输出)在各容器中的尺寸 */
|
||||
.icon-img { object-fit: contain; vertical-align: middle; }
|
||||
.board-icon img.icon-img { width: 30px; height: 30px; }
|
||||
@@ -423,6 +432,7 @@ a.nav-btn[data-note]:hover::after { opacity: 1; transform: translateX(-50%) tran
|
||||
.m-block-head input.b-title { flex: 1 1 240px; width: auto; max-width: 520px; }
|
||||
.m-block-head .ops { margin-left: auto; display: flex; gap: 6px; align-items: center; }
|
||||
.m-items { padding: 4px 12px 12px; }
|
||||
.m-block.is-fold .m-items { display: none; }
|
||||
.m-item { display: grid; grid-template-columns: 1fr 1.4fr 1.2fr 36px; gap: 8px; align-items: center; margin-top: 8px; }
|
||||
.m-item .m-del { text-align: center; }
|
||||
/* 后台搜索引擎管理行 */
|
||||
@@ -453,12 +463,15 @@ a.nav-btn[data-note]:hover::after { opacity: 1; transform: translateX(-50%) tran
|
||||
.l-row .l-note { flex: 1 1 170px; min-width: 120px; }
|
||||
/* 外部工具管理:分区分组折叠 */
|
||||
.xg { border: 1px dashed var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
|
||||
.xg-h { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg-2); cursor: pointer; user-select: none; }
|
||||
.xg-h { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg-2); cursor: pointer; user-select: none; flex-wrap: wrap; row-gap: 4px; }
|
||||
.xg-h .xg-arr { flex: 0 0 auto; border: none; background: none; padding: 2px 4px; font-size: 12px; color: var(--text-3); cursor: pointer; transition: transform .18s ease; }
|
||||
.xg.is-fold .xg-arr { transform: rotate(-90deg); }
|
||||
.xg-h .xg-name { font-weight: 600; color: var(--text-2); }
|
||||
.xg-h .xg-cnt { font-size: 12px; color: var(--text-3); }
|
||||
.xg-h .xg-acts { margin-left: auto; display: flex; gap: 6px; align-items: center; }
|
||||
.xg-h .xg-acts { margin-left: auto; display: flex; gap: 8px; align-items: center; }
|
||||
.xg-h .xg-cat .t-cats { padding: 2px 8px; }
|
||||
.xg-h .xg-cat label { cursor: pointer; }
|
||||
.xg-h .xg-cat { display: flex; align-items: center; min-width: 0; flex: 0 0 auto; margin-left: auto; }
|
||||
.xg-b { padding: 4px 14px 10px; }
|
||||
.xg-b .t-row:first-child { margin-top: 8px; }
|
||||
.xg.is-fold .xg-b { display: none; }
|
||||
@@ -469,6 +482,18 @@ a.nav-btn[data-note]:hover::after { opacity: 1; transform: translateX(-50%) tran
|
||||
.ext-filter select { width: auto; min-width: 130px; flex: 0 1 auto; }
|
||||
.ext-filter #fKw { flex: 1 1 220px; min-width: 180px; }
|
||||
.ext-stat { font-size: 13px; color: var(--text-3); white-space: nowrap; margin-left: auto; }
|
||||
/* 通用拖动手柄 / 拖拽反馈 */
|
||||
.drag-h {
|
||||
flex: 0 0 auto; cursor: grab; user-select: none; touch-action: none;
|
||||
border: none; background: none; padding: 4px 6px; font-size: 13px; line-height: 1; color: var(--text-3);
|
||||
}
|
||||
.drag-h:hover { color: var(--brand); }
|
||||
.drag-h:active { cursor: grabbing; }
|
||||
.drag-src { opacity: .4; }
|
||||
.drop-target, .drag-over { border-color: var(--brand) !important; box-shadow: 0 0 0 2px var(--accent-soft) !important; }
|
||||
/* 折叠头箭头(块头/分区头通用) */
|
||||
.c-arr { flex: 0 0 auto; border: none; background: none; padding: 2px 6px; font-size: 12px; color: var(--text-3); cursor: pointer; transition: transform .18s ease; }
|
||||
.is-fold .c-arr { transform: rotate(-90deg); }
|
||||
.t-row .ops, .l-row .ops { display: flex; gap: 6px; flex: 0 0 auto; margin-left: auto; }
|
||||
.t-on { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); white-space: nowrap; flex: 0 0 auto; }
|
||||
/* 滑动圆条开关:内部 OFF/ON 文本,用于后台行内即时启停 */
|
||||
@@ -507,6 +532,22 @@ a.nav-btn[data-note]:hover::after { opacity: 1; transform: translateX(-50%) tran
|
||||
.t-cats label input { margin: 0; accent-color: var(--brand); }
|
||||
.add-btn { margin: 6px 0 18px; }
|
||||
|
||||
/* 站点风格确认弹窗(回车确认 / Esc 取消) */
|
||||
.sc-overlay {
|
||||
position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
|
||||
padding: 20px; background: rgba(0, 0, 0, .45); backdrop-filter: blur(2px); animation: scFade .14s ease;
|
||||
}
|
||||
.sc-card {
|
||||
width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 14px;
|
||||
box-shadow: 0 18px 50px rgba(0, 0, 0, .25); overflow: hidden; animation: scPop .16s ease;
|
||||
}
|
||||
.sc-head { padding: 16px 18px 0; font-size: 15px; font-weight: 700; color: var(--text); }
|
||||
.sc-body { padding: 8px 18px 4px; font-size: 13.5px; color: var(--text-2); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
|
||||
.sc-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px 18px; }
|
||||
.sc-foot .btn { min-width: 76px; }
|
||||
@keyframes scFade { from { opacity: 0; } to { opacity: 1; } }
|
||||
@keyframes scPop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
|
||||
|
||||
/* 登录页 */
|
||||
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-2); padding: 20px; }
|
||||
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: var(--shadow); }
|
||||
|
||||
+93
-1
@@ -291,6 +291,95 @@
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- 站点风格确认弹窗(回车确认 / Esc 取消 / 点击遮罩取消) ---------- */
|
||||
function escHtml(s) {
|
||||
return String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
}
|
||||
function siteConfirm(message, opts) {
|
||||
opts = opts || {};
|
||||
return new Promise(function (resolve) {
|
||||
var danger = opts.danger !== false;
|
||||
var okText = opts.okText || (danger ? '删除' : '确认');
|
||||
var overlay = document.createElement('div');
|
||||
overlay.className = 'sc-overlay';
|
||||
overlay.innerHTML =
|
||||
'<div class="sc-card" role="alertdialog" aria-modal="true">' +
|
||||
'<div class="sc-head">' + escHtml(opts.title || '操作确认') + '</div>' +
|
||||
'<div class="sc-body">' + escHtml(message || '') + '</div>' +
|
||||
'<div class="sc-foot">' +
|
||||
'<button type="button" class="btn btn-sm sc-cancel">' + escHtml(opts.cancelText || '取消') + '</button>' +
|
||||
'<button type="button" class="btn btn-sm ' + (danger ? 'btn-danger' : 'btn-primary') + ' sc-ok">' + escHtml(okText) + '</button>' +
|
||||
'</div></div>';
|
||||
var okBtn = overlay.querySelector('.sc-ok');
|
||||
var cancelBtn = overlay.querySelector('.sc-cancel');
|
||||
var finished = false;
|
||||
function close(val) {
|
||||
if (finished) return;
|
||||
finished = true;
|
||||
document.removeEventListener('keydown', onKey, true);
|
||||
if (overlay.parentNode) overlay.parentNode.removeChild(overlay);
|
||||
resolve(val);
|
||||
}
|
||||
function onKey(ev) {
|
||||
if (ev.key === 'Escape') { ev.preventDefault(); close(false); }
|
||||
else if (ev.key === 'Enter') { ev.preventDefault(); close(true); }
|
||||
}
|
||||
okBtn.addEventListener('click', function () { close(true); });
|
||||
cancelBtn.addEventListener('click', function () { close(false); });
|
||||
overlay.addEventListener('mousedown', function (ev) { if (ev.target === overlay) close(false); });
|
||||
document.addEventListener('keydown', onKey, true);
|
||||
document.body.appendChild(overlay);
|
||||
okBtn.focus();
|
||||
});
|
||||
}
|
||||
// 统一入口:旧浏览器/异常时回落原生 confirm(仍然以 Promise 风格使用)
|
||||
function askConfirm(message, opts) {
|
||||
return siteConfirm(message, opts);
|
||||
}
|
||||
// 表单:带 data-confirm="提示文案" 的表单提交前弹窗确认
|
||||
function bindConfirmForms() {
|
||||
document.addEventListener('submit', function (ev) {
|
||||
var f = ev.target;
|
||||
if (!f || !f.getAttribute || !f.hasAttribute('data-confirm')) return;
|
||||
ev.preventDefault();
|
||||
siteConfirm(f.getAttribute('data-confirm')).then(function (ok) { if (ok) f.submit(); });
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- 返回顶部(右下角按钮,滚动后出现;兼容内滚容器页面) ---------- */
|
||||
function initToTop() {
|
||||
var btn = document.querySelector('.js-to-top');
|
||||
if (!btn) return;
|
||||
var scrollables = [];
|
||||
var doc = document.scrollingElement || document.documentElement;
|
||||
if (doc) scrollables.push(doc);
|
||||
Array.prototype.forEach.call(document.querySelectorAll('*'), function (el) {
|
||||
if (el === doc || el === btn) return;
|
||||
if (el.scrollHeight <= el.clientHeight + 40) return;
|
||||
var cs;
|
||||
try { cs = window.getComputedStyle(el); } catch (e) { cs = null; }
|
||||
if (!cs) return;
|
||||
if (cs.overflowY === 'auto' || cs.overflowY === 'scroll') scrollables.push(el);
|
||||
});
|
||||
function measure() {
|
||||
var v = 0;
|
||||
for (var i = 0; i < scrollables.length; i++) {
|
||||
if (scrollables[i].scrollTop > v) v = scrollables[i].scrollTop;
|
||||
}
|
||||
btn.classList.toggle('show', v > 260);
|
||||
}
|
||||
for (var s = 0; s < scrollables.length; s++) {
|
||||
scrollables[s].addEventListener('scroll', measure, { passive: true });
|
||||
}
|
||||
window.addEventListener('resize', measure);
|
||||
btn.addEventListener('click', function () {
|
||||
var root = doc || document.documentElement;
|
||||
if (root && root.scrollTop > 0) root.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
else window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
measure();
|
||||
}
|
||||
|
||||
/* ---------- 自动初始化 ---------- */
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
initTheme();
|
||||
@@ -300,9 +389,12 @@
|
||||
initSearch();
|
||||
initIconControls();
|
||||
initCopyButtons();
|
||||
bindConfirmForms();
|
||||
initToTop();
|
||||
});
|
||||
|
||||
global.HomePage = {
|
||||
$: $, $$: $$, copyText: copyText, applyTheme: applyTheme, currentTheme: currentTheme
|
||||
$: $, $$: $$, copyText: copyText, applyTheme: applyTheme, currentTheme: currentTheme,
|
||||
confirm: siteConfirm, ask: askConfirm
|
||||
};
|
||||
})(window);
|
||||
Reference in new issue
Block a user