FeedLite 初始提交:通用轻量级反馈系统(PHP + SQLite,零依赖)
- 前台:问题列表 / 详情 / 发布与回复(趣味问答验证码、蜜罐、IP 限流) - 后台:先审后显、站点设置(站点标题/描述、附件存储、OSS 参数)、操作日志 - 附件:关闭 / 本机硬盘 / 阿里云 OSS 浏览器直传(ECS 实例 RAM 角色)三种模式 - 品牌资源:全套图标(favicon.ico / SVG / PNG 各尺寸 / manifest) - 安全:CSRF、session 加固、.htaccess 屏蔽敏感文件、口令仅存哈希 - 配置:config.example.php 为模板,config.php 不入库
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,627 @@
|
||||
/* FeedLite · 轻反馈 —— 轻量交互(含图片/视频直传 OSS) */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/* ---------- 公共小工具 ---------- */
|
||||
function $(sel, root) { return (root || document).querySelector(sel); }
|
||||
function $$(sel, root) {
|
||||
var out = [], list = (root || document).querySelectorAll(sel);
|
||||
for (var i = 0; i < list.length; i++) { out.push(list[i]); }
|
||||
return out;
|
||||
}
|
||||
function qs(obj) {
|
||||
var parts = [];
|
||||
for (var k in obj) {
|
||||
if (obj.hasOwnProperty(k) && obj[k] !== undefined && obj[k] !== null) {
|
||||
parts.push(encodeURIComponent(k) + '=' + encodeURIComponent(obj[k]));
|
||||
}
|
||||
}
|
||||
return parts.join('&');
|
||||
}
|
||||
function human(bytes) {
|
||||
var b = Number(bytes) || 0;
|
||||
if (b < 1024) { return b + ' B'; }
|
||||
if (b < 1048576) { return (b / 1024).toFixed(1) + ' KB'; }
|
||||
return (b / 1048576).toFixed(1) + ' MB';
|
||||
}
|
||||
function extByMime(mime) {
|
||||
if (mime === 'image/webp') { return 'webp'; }
|
||||
if (mime === 'image/png') { return 'png'; }
|
||||
if (mime === 'image/gif') { return 'gif'; }
|
||||
if (mime === 'video/mp4') { return 'mp4'; }
|
||||
if (mime === 'video/quicktime') { return 'mov'; }
|
||||
if (mime === 'video/webm') { return 'webm'; }
|
||||
return 'jpg';
|
||||
}
|
||||
function renameExt(name, mime) {
|
||||
var base = String(name || 'file').replace(/\.[A-Za-z0-9]{1,8}$/, '') || 'file';
|
||||
return base + '.' + extByMime(mime);
|
||||
}
|
||||
|
||||
/* ---------- 换一题:AJAX 刷新验证题,不丢失已填内容 ---------- */
|
||||
function bindCaptchaRefresh() {
|
||||
var links = document.querySelectorAll('[data-captcha-refresh]');
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
links[i].addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
var box = this.closest('.captcha-line');
|
||||
var qEl = box ? box.querySelector('.c-q') : null;
|
||||
var input = box ? box.querySelector('input[name=captcha]') : null;
|
||||
var self = this;
|
||||
self.style.opacity = '.5';
|
||||
fetch('captcha.php', { credentials: 'same-origin' })
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (d) {
|
||||
if (d && d.ok && qEl) { qEl.textContent = d.q; }
|
||||
if (input) { input.value = ''; input.focus(); }
|
||||
})
|
||||
.catch(function () { window.location.href = 'captcha.php'; })
|
||||
.then(function () { self.style.opacity = '1'; });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 管理员口令:填写后显示"处理状态",并解除邮箱必填 ---------- */
|
||||
function bindAdminToggle() {
|
||||
var pw = document.querySelector('input[name=admin_password]');
|
||||
if (!pw) { return; }
|
||||
var statusBox = document.querySelector('.admin-status');
|
||||
var emailInput = document.querySelector('input[name=email]');
|
||||
var emailField = document.getElementById('emailField');
|
||||
|
||||
function sync() {
|
||||
var isAdmin = pw.value.trim() !== '';
|
||||
if (statusBox) { statusBox.hidden = !isAdmin; }
|
||||
if (emailInput) {
|
||||
emailInput.required = !isAdmin;
|
||||
if (isAdmin) { emailInput.removeAttribute('required'); }
|
||||
}
|
||||
if (emailField) {
|
||||
var req = emailField.querySelector('.req');
|
||||
if (req) { req.style.visibility = isAdmin ? 'hidden' : 'visible'; }
|
||||
}
|
||||
}
|
||||
pw.addEventListener('input', sync);
|
||||
sync();
|
||||
}
|
||||
|
||||
/* ---------- 防止重复提交(上传未完成时阻止提交) ---------- */
|
||||
function bindNoDoubleSubmit() {
|
||||
var forms = document.querySelectorAll('form');
|
||||
for (var i = 0; i < forms.length; i++) {
|
||||
forms[i].addEventListener('submit', function (ev) {
|
||||
var box = this.querySelector('[data-uploader-root]');
|
||||
if (box && Number(box.getAttribute('data-pending') || 0) > 0) {
|
||||
ev.preventDefault();
|
||||
alert('还有文件正在上传,请等待上传完成后再提交。');
|
||||
return;
|
||||
}
|
||||
var btn = this.querySelector('button[type=submit]');
|
||||
if (btn) {
|
||||
setTimeout(function () { btn.disabled = true; btn.style.opacity = '.6'; }, 0);
|
||||
setTimeout(function () { btn.disabled = false; btn.style.opacity = '1'; }, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 图片压缩(canvas,保留动图) ---------- */
|
||||
function prepareImage(file, maxSide) {
|
||||
return new Promise(function (resolve) {
|
||||
// GIF 可能带动画,压缩会丢失动画 —— 原样上传
|
||||
if (file.type === 'image/gif') {
|
||||
resolve({ blob: file, mime: file.type, name: file.name });
|
||||
return;
|
||||
}
|
||||
var url = URL.createObjectURL(file);
|
||||
var img = new Image();
|
||||
img.onload = function () {
|
||||
var w = img.naturalWidth, h = img.naturalHeight;
|
||||
var scale = Math.min(1, maxSide / Math.max(w, h));
|
||||
var tw = Math.max(1, Math.round(w * scale));
|
||||
var th = Math.max(1, Math.round(h * scale));
|
||||
var small = file.size <= 600 * 1024;
|
||||
if (small && scale >= 1) {
|
||||
URL.revokeObjectURL(url);
|
||||
resolve({ blob: file, mime: file.type, name: file.name });
|
||||
return;
|
||||
}
|
||||
var cv = document.createElement('canvas');
|
||||
cv.width = tw; cv.height = th;
|
||||
cv.getContext('2d').drawImage(img, 0, 0, tw, th);
|
||||
|
||||
var prefer = (file.type === 'image/png' || file.type === 'image/webp') ? 'image/webp' : 'image/jpeg';
|
||||
var quality = 0.82;
|
||||
|
||||
function done(blob, mime) {
|
||||
URL.revokeObjectURL(url);
|
||||
if (!blob || (blob.size >= file.size && small)) {
|
||||
resolve({ blob: file, mime: file.type, name: file.name });
|
||||
return;
|
||||
}
|
||||
var real = blob.type || mime;
|
||||
resolve({ blob: blob, mime: real, name: renameExt(file.name, real) });
|
||||
}
|
||||
cv.toBlob(function (blob) {
|
||||
if (blob && blob.type !== prefer) {
|
||||
cv.toBlob(function (b2) { done(b2, 'image/jpeg'); }, 'image/jpeg', quality);
|
||||
} else {
|
||||
done(blob, prefer);
|
||||
}
|
||||
}, prefer, quality);
|
||||
};
|
||||
img.onerror = function () {
|
||||
URL.revokeObjectURL(url);
|
||||
resolve({ blob: file, mime: file.type, name: file.name });
|
||||
};
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- 附件直传 ---------- */
|
||||
function initUploaderRoot(root) {
|
||||
var csrf = root.getAttribute('data-csrf') || '';
|
||||
var signUrl = root.getAttribute('data-sign-url') || 'upload.php';
|
||||
var field = root.querySelector('.att-field');
|
||||
var state = []; // 已成功的附件描述
|
||||
var pending = 0;
|
||||
|
||||
try {
|
||||
var init = JSON.parse(root.getAttribute('data-init') || '[]');
|
||||
for (var i = 0; i < init.length; i++) { state.push(init[i]); }
|
||||
} catch (e) { /* 忽略 */ }
|
||||
|
||||
function setPending(n) {
|
||||
pending = Math.max(0, pending + n);
|
||||
root.setAttribute('data-pending', String(pending));
|
||||
}
|
||||
|
||||
function sync() {
|
||||
if (!field) { return; }
|
||||
var out = [];
|
||||
for (var i = 0; i < state.length; i++) {
|
||||
var s = state[i];
|
||||
out.push({ kind: s.kind, key: s.key, size: s.size, name: s.name || '', mime: s.mime || '', w: s.w || 0, h: s.h || 0 });
|
||||
}
|
||||
field.value = out.length ? JSON.stringify(out) : '';
|
||||
}
|
||||
|
||||
function countOf(kind) {
|
||||
var n = 0;
|
||||
for (var i = 0; i < state.length; i++) { if (state[i].kind === kind) { n++; } }
|
||||
return n;
|
||||
}
|
||||
|
||||
function makeNode(box, meta) {
|
||||
var list = box.querySelector('.up-list');
|
||||
var el = document.createElement('div');
|
||||
el.className = 'up-item' + (meta.kind === 'video' ? ' video' : '');
|
||||
|
||||
var thumb = document.createElement('div');
|
||||
thumb.className = 'up-thumb';
|
||||
if (meta.kind === 'image') {
|
||||
var im = document.createElement('img');
|
||||
im.alt = '';
|
||||
if (meta.thumb) { im.src = meta.thumb; }
|
||||
thumb.appendChild(im);
|
||||
} else {
|
||||
thumb.classList.add('up-thumb-video');
|
||||
thumb.textContent = 'VIDEO';
|
||||
}
|
||||
|
||||
var info = document.createElement('div');
|
||||
info.className = 'up-info';
|
||||
var nm = document.createElement('div');
|
||||
nm.className = 'up-name';
|
||||
nm.textContent = meta.name || (meta.kind === 'image' ? '图片' : '视频');
|
||||
var st = document.createElement('div');
|
||||
st.className = 'up-state';
|
||||
st.textContent = '等待上传…';
|
||||
var bar = document.createElement('div');
|
||||
bar.className = 'up-bar';
|
||||
var fill = document.createElement('i');
|
||||
bar.appendChild(fill);
|
||||
info.appendChild(nm); info.appendChild(st); info.appendChild(bar);
|
||||
|
||||
var rm = document.createElement('button');
|
||||
rm.type = 'button';
|
||||
rm.className = 'up-del';
|
||||
rm.textContent = '移除';
|
||||
|
||||
el.appendChild(thumb); el.appendChild(info); el.appendChild(rm);
|
||||
list.appendChild(el);
|
||||
return { el: el, fill: fill, st: st, rm: rm, thumb: thumb };
|
||||
}
|
||||
|
||||
function removeItem(node, item) {
|
||||
if (node && node.el && node.el.parentNode) { node.el.parentNode.removeChild(node.el); }
|
||||
if (item) {
|
||||
for (var i = 0; i < state.length; i++) {
|
||||
if (state[i].key === item.key) { state.splice(i, 1); break; }
|
||||
}
|
||||
}
|
||||
sync();
|
||||
}
|
||||
|
||||
function sign(kind, ext, size, mime) {
|
||||
return fetch(signUrl, {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' },
|
||||
body: qs({ csrf: csrf, kind: kind, ext: ext, size: size, mime: mime })
|
||||
}).then(function (r) {
|
||||
return r.json().catch(function () { throw new Error('服务器返回异常(' + r.status + ')'); });
|
||||
}).then(function (d) {
|
||||
if (!d || !d.ok) { throw new Error((d && d.error) || '获取上传凭证失败'); }
|
||||
return d;
|
||||
});
|
||||
}
|
||||
|
||||
function upload(cred, fields, blob, filename, onProgress) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var fd = new FormData();
|
||||
for (var k in fields) {
|
||||
if (fields.hasOwnProperty(k)) { fd.append(k, fields[k]); }
|
||||
}
|
||||
fd.append('file', blob, filename); // 文件必须是最后一个字段
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', cred.host, true);
|
||||
xhr.upload.onprogress = function (e) {
|
||||
if (e.lengthComputable && onProgress) { onProgress(e.loaded / e.total); }
|
||||
};
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200 || xhr.status === 204) { resolve(true); }
|
||||
else {
|
||||
var msg = String(xhr.responseText || '').replace(/<[^>]*>/g, ' ').slice(0, 160).trim();
|
||||
reject(new Error('上传到存储失败(' + xhr.status + ')' + (msg ? ':' + msg : '')));
|
||||
}
|
||||
};
|
||||
xhr.onerror = function () { reject(new Error('网络异常,上传中断')); };
|
||||
xhr.send(fd);
|
||||
});
|
||||
}
|
||||
|
||||
async function handleFiles(box, files) {
|
||||
var kind = box.getAttribute('data-kind') || 'image';
|
||||
var maxCount = parseInt(box.getAttribute('data-max-count') || '1', 10);
|
||||
var maxBytes = parseInt(box.getAttribute('data-max-bytes') || '0', 10);
|
||||
var maxSide = parseInt(box.getAttribute('data-max-side') || '1600', 10);
|
||||
var label = box.getAttribute('data-label') || '附件';
|
||||
var allowed = (box.getAttribute('data-accept') || '').split(',');
|
||||
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var file = files[i];
|
||||
|
||||
if (allowed.length && allowed.indexOf(file.type) < 0) {
|
||||
alert('「' + file.name + '」格式不支持,请选择:' + allowed.join(' / '));
|
||||
continue;
|
||||
}
|
||||
if (maxBytes > 0 && file.size > maxBytes) {
|
||||
alert('「' + file.name + '」超过 ' + human(maxBytes) + ' 上限。');
|
||||
continue;
|
||||
}
|
||||
if (countOf(kind) >= maxCount) {
|
||||
alert(label + '最多上传 ' + maxCount + ' 个,请先移除已上传的文件。');
|
||||
break;
|
||||
}
|
||||
|
||||
var node = makeNode(box, { kind: kind, name: file.name, thumb: '' });
|
||||
setPending(1);
|
||||
node.rm.disabled = true;
|
||||
|
||||
try {
|
||||
node.st.textContent = '处理中…';
|
||||
var prepared;
|
||||
if (kind === 'image') {
|
||||
prepared = await prepareImage(file, maxSide);
|
||||
if (prepared.blob !== file && prepared.blob.size > 0) {
|
||||
node.st.textContent = '已压缩 ' + human(file.size) + ' → ' + human(prepared.blob.size);
|
||||
try { node.thumb.querySelector('img').src = URL.createObjectURL(prepared.blob); } catch (e2) { /* 忽略 */ }
|
||||
}
|
||||
} else {
|
||||
prepared = { blob: file, mime: file.type, name: file.name };
|
||||
}
|
||||
|
||||
var ext = extByMime(prepared.mime);
|
||||
var d = await sign(kind, ext, prepared.blob.size, prepared.mime);
|
||||
|
||||
node.st.textContent = '上传中…';
|
||||
await upload(d.credential, d.fields, prepared.blob, prepared.name, function (p) {
|
||||
node.fill.style.width = Math.round(p * 100) + '%';
|
||||
node.st.textContent = '上传中 ' + Math.round(p * 100) + '%';
|
||||
});
|
||||
|
||||
var item = {
|
||||
kind: kind,
|
||||
key: d.credential.key,
|
||||
size: prepared.blob.size,
|
||||
name: prepared.name,
|
||||
mime: prepared.mime,
|
||||
w: 0, h: 0,
|
||||
thumb: d.credential.url || ''
|
||||
};
|
||||
state.push(item);
|
||||
sync();
|
||||
|
||||
node.el.classList.add('done');
|
||||
node.fill.style.width = '100%';
|
||||
node.st.textContent = '已上传 · ' + human(item.size);
|
||||
if (kind === 'image' && item.thumb) {
|
||||
var imgEl = node.thumb.querySelector('img');
|
||||
if (imgEl) { imgEl.src = item.thumb; }
|
||||
}
|
||||
node.rm.disabled = false;
|
||||
node.rm.addEventListener('click', function (it) {
|
||||
return function () { removeItem(node, it); };
|
||||
}(item));
|
||||
} catch (e) {
|
||||
node.el.classList.add('fail');
|
||||
node.st.textContent = (e && e.message) ? e.message : '上传失败';
|
||||
node.rm.textContent = '删除';
|
||||
node.rm.disabled = false;
|
||||
node.rm.addEventListener('click', function () { removeItem(node, null); });
|
||||
} finally {
|
||||
setPending(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 回填服务端已保存的附件(校验失败后重新提交时)
|
||||
var byKind = {};
|
||||
for (var s = 0; s < state.length; s++) {
|
||||
var it0 = state[s];
|
||||
var box0 = root.querySelector('[data-uploader][data-kind="' + it0.kind + '"]');
|
||||
if (!box0) { continue; }
|
||||
byKind[it0.kind] = (byKind[it0.kind] || 0) + 1;
|
||||
var nd = makeNode(box0, it0);
|
||||
nd.el.classList.add('done');
|
||||
nd.fill.style.width = '100%';
|
||||
nd.st.textContent = '已上传 · ' + human(it0.size);
|
||||
nd.rm.addEventListener('click', function (item, node) {
|
||||
return function () { removeItem(node, item); };
|
||||
}(it0, nd));
|
||||
}
|
||||
sync();
|
||||
|
||||
var boxes = $$('[data-uploader]', root);
|
||||
for (var b = 0; b < boxes.length; b++) {
|
||||
(function (box) {
|
||||
var pick = box.querySelector('.up-pick');
|
||||
var input = box.querySelector('.up-file');
|
||||
if (!pick || !input) { return; }
|
||||
pick.addEventListener('click', function () { input.click(); });
|
||||
input.addEventListener('change', function () {
|
||||
var files = [];
|
||||
for (var k = 0; k < input.files.length; k++) { files.push(input.files[k]); }
|
||||
input.value = '';
|
||||
if (files.length) { handleFiles(box, files); }
|
||||
});
|
||||
// 拖拽上传
|
||||
['dragenter', 'dragover'].forEach(function (ev) {
|
||||
box.addEventListener(ev, function (e) { e.preventDefault(); box.classList.add('dragging'); });
|
||||
});
|
||||
['dragleave', 'drop'].forEach(function (ev) {
|
||||
box.addEventListener(ev, function (e) { e.preventDefault(); box.classList.remove('dragging'); });
|
||||
});
|
||||
box.addEventListener('drop', function (e) {
|
||||
e.preventDefault();
|
||||
var files = [];
|
||||
if (e.dataTransfer && e.dataTransfer.files) {
|
||||
for (var k = 0; k < e.dataTransfer.files.length; k++) { files.push(e.dataTransfer.files[k]); }
|
||||
}
|
||||
if (files.length) { handleFiles(box, files); }
|
||||
});
|
||||
}(boxes[b]));
|
||||
}
|
||||
}
|
||||
|
||||
function bindUploaders() {
|
||||
var roots = $$('[data-uploader-root]');
|
||||
for (var i = 0; i < roots.length; i++) { initUploaderRoot(roots[i]); }
|
||||
}
|
||||
|
||||
/* ---------- 附件灯箱:点击放大 + 左右切换 ---------- */
|
||||
function bindLightbox() {
|
||||
var galleries = $$('[data-gallery]');
|
||||
if (!galleries.length) { return; }
|
||||
|
||||
var ov = null, items = [], cur = 0, lastFocus = null, built = false;
|
||||
var media = null, nameEl = null, metaEl = null, origEl = null, prevBtn = null, nextBtn = null;
|
||||
|
||||
function buildOverlay() {
|
||||
ov = document.createElement('div');
|
||||
ov.className = 'lb';
|
||||
ov.hidden = true;
|
||||
ov.setAttribute('role', 'dialog');
|
||||
ov.setAttribute('aria-modal', 'true');
|
||||
ov.setAttribute('aria-label', '附件查看');
|
||||
ov.innerHTML =
|
||||
'<button type="button" class="lb-x" aria-label="关闭">✕</button>' +
|
||||
'<div class="lb-stage">' +
|
||||
'<button type="button" class="lb-nav lb-prev" aria-label="上一个">‹</button>' +
|
||||
'<div class="lb-media"></div>' +
|
||||
'<button type="button" class="lb-nav lb-next" aria-label="下一个">›</button>' +
|
||||
'</div>' +
|
||||
'<div class="lb-bar">' +
|
||||
'<span class="lb-name"></span>' +
|
||||
'<span class="lb-meta"></span>' +
|
||||
'<a class="lb-orig" href="#" target="_blank" rel="noopener noreferrer">查看原图</a>' +
|
||||
'</div>';
|
||||
document.body.appendChild(ov);
|
||||
|
||||
media = $('.lb-media', ov);
|
||||
nameEl = $('.lb-name', ov);
|
||||
metaEl = $('.lb-meta', ov);
|
||||
origEl = $('.lb-orig', ov);
|
||||
prevBtn = $('.lb-prev', ov);
|
||||
nextBtn = $('.lb-next', ov);
|
||||
|
||||
$('.lb-x', ov).addEventListener('click', close);
|
||||
prevBtn.addEventListener('click', function () { go(-1); });
|
||||
nextBtn.addEventListener('click', function () { go(1); });
|
||||
ov.addEventListener('click', function (e) {
|
||||
// 点空白处(遮罩本身或图片外的区域)关闭
|
||||
if (e.target === ov || e.target === media) { close(); }
|
||||
});
|
||||
|
||||
// 触摸左右滑动
|
||||
var tx = 0, ty = 0, tracking = false;
|
||||
ov.addEventListener('touchstart', function (e) {
|
||||
if (!e.touches || e.touches.length !== 1) { tracking = false; return; }
|
||||
tx = e.touches[0].clientX; ty = e.touches[0].clientY; tracking = true;
|
||||
}, { passive: true });
|
||||
ov.addEventListener('touchend', function (e) {
|
||||
if (!tracking || !e.changedTouches || !e.changedTouches.length) { return; }
|
||||
tracking = false;
|
||||
var dx = e.changedTouches[0].clientX - tx;
|
||||
var dy = e.changedTouches[0].clientY - ty;
|
||||
if (Math.abs(dx) < 40 || Math.abs(dx) < Math.abs(dy)) { return; }
|
||||
go(dx < 0 ? 1 : -1); // 左滑=看下一个,与浏览图片的直觉一致
|
||||
}, { passive: true });
|
||||
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (!ov || ov.hidden) { return; }
|
||||
var k = e.key;
|
||||
if (k === 'Escape') { close(); }
|
||||
else if (k === 'ArrowLeft') { go(-1); }
|
||||
else if (k === 'ArrowRight') { go(1); }
|
||||
else if (k === 'Home') { cur = 0; render(); }
|
||||
else if (k === 'End') { cur = items.length - 1; render(); }
|
||||
else { return; }
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
function render() {
|
||||
if (!items.length) { return; }
|
||||
var it = items[cur];
|
||||
media.className = 'lb-media loading';
|
||||
media.innerHTML = '';
|
||||
|
||||
var node;
|
||||
if (it.kind === 'video') {
|
||||
node = document.createElement('video');
|
||||
node.controls = true;
|
||||
node.autoplay = true;
|
||||
node.playsInline = true;
|
||||
node.setAttribute('playsinline', '');
|
||||
node.src = it.src;
|
||||
if (it.poster) { node.poster = it.poster; }
|
||||
} else {
|
||||
node = document.createElement('img');
|
||||
node.alt = it.name || '';
|
||||
node.src = it.src;
|
||||
}
|
||||
function ready() { media.classList.remove('loading'); }
|
||||
node.addEventListener('load', ready);
|
||||
node.addEventListener('loadeddata', ready);
|
||||
node.addEventListener('error', ready);
|
||||
media.appendChild(node);
|
||||
|
||||
nameEl.textContent = it.name || (it.kind === 'video' ? '视频' : '图片');
|
||||
metaEl.textContent = (cur + 1) + ' / ' + items.length + (it.size ? ' · ' + it.size : '');
|
||||
if (it.kind === 'video') {
|
||||
origEl.hidden = true;
|
||||
} else {
|
||||
origEl.hidden = false;
|
||||
origEl.href = it.full || it.src;
|
||||
}
|
||||
|
||||
var multi = items.length > 1;
|
||||
prevBtn.hidden = !multi;
|
||||
nextBtn.hidden = !multi;
|
||||
|
||||
// 预载相邻图片,切换时更快
|
||||
if (multi) {
|
||||
var nb = [items[(cur + 1) % items.length], items[(cur - 1 + items.length) % items.length]];
|
||||
for (var i = 0; i < nb.length; i++) {
|
||||
if (nb[i].kind === 'image' && nb[i].src) { (new Image()).src = nb[i].src; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function go(step) {
|
||||
if (items.length < 2) { return; }
|
||||
cur = (cur + step + items.length) % items.length;
|
||||
render();
|
||||
}
|
||||
|
||||
function open(list, idx) {
|
||||
if (!built) { buildOverlay(); built = true; }
|
||||
if (!list.length) { return; }
|
||||
items = list;
|
||||
cur = Math.max(0, Math.min(idx, list.length - 1));
|
||||
lastFocus = document.activeElement;
|
||||
|
||||
// 打开灯箱时暂停正文里的内嵌视频,避免两个声音一起响
|
||||
var inline = document.querySelectorAll('.atts video');
|
||||
for (var i = 0; i < inline.length; i++) { try { inline[i].pause(); } catch (e) {} }
|
||||
|
||||
ov.hidden = false;
|
||||
document.documentElement.classList.add('lb-open');
|
||||
document.body.classList.add('lb-open');
|
||||
render();
|
||||
var x = $('.lb-x', ov);
|
||||
if (x) { x.focus(); }
|
||||
}
|
||||
|
||||
function close() {
|
||||
if (!ov || ov.hidden) { return; }
|
||||
ov.hidden = true;
|
||||
media.innerHTML = ''; // 顺带停止灯箱里的视频播放
|
||||
document.documentElement.classList.remove('lb-open');
|
||||
document.body.classList.remove('lb-open');
|
||||
if (lastFocus && lastFocus.focus) { try { lastFocus.focus(); } catch (e) {} }
|
||||
}
|
||||
|
||||
// 收集一个画廊里的全部附件(按 DOM 顺序)
|
||||
function itemsOf(gal) {
|
||||
var els = $$('[data-lb-kind]', gal), out = [];
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i];
|
||||
out.push({
|
||||
kind: el.getAttribute('data-lb-kind') || 'image',
|
||||
src: el.getAttribute('data-lb-src') || el.getAttribute('href') || '',
|
||||
full: el.getAttribute('data-lb-full') || '',
|
||||
poster: el.getAttribute('data-lb-poster') || '',
|
||||
name: el.getAttribute('data-lb-name') || '',
|
||||
size: el.getAttribute('data-lb-size') || ''
|
||||
});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
for (var g = 0; g < galleries.length; g++) {
|
||||
(function (gal) {
|
||||
gal.addEventListener('click', function (e) {
|
||||
var t = e.target, trigger = null;
|
||||
while (t && t !== gal) {
|
||||
if (t.getAttribute && t.getAttribute('data-lb-kind')) { trigger = t; break; }
|
||||
t = t.parentNode;
|
||||
}
|
||||
if (!trigger) { return; }
|
||||
e.preventDefault(); // 图片是 <a>,有 JS 时就在页内放大
|
||||
|
||||
var all = $$('[data-lb-kind]', gal), idx = 0;
|
||||
for (var i = 0; i < all.length; i++) { if (all[i] === trigger) { idx = i; break; } }
|
||||
open(itemsOf(gal), idx);
|
||||
});
|
||||
}(galleries[g]));
|
||||
}
|
||||
}
|
||||
|
||||
function boot() {
|
||||
bindCaptchaRefresh();
|
||||
bindAdminToggle();
|
||||
bindNoDoubleSubmit();
|
||||
bindUploaders();
|
||||
bindLightbox();
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', boot);
|
||||
} else {
|
||||
boot();
|
||||
}
|
||||
})();
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 9.6 KiB |
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512" role="img" aria-label="轻量反馈系统图标">
|
||||
<!-- 潘通蓝 PANTONE 2935 C = #0057B8,纯色无渐变 -->
|
||||
<rect x="0" y="0" width="512" height="512" rx="112" fill="#0057B8"/>
|
||||
|
||||
<!-- 气泡外接框 320x280(占画布 63%),居中 -->
|
||||
<g fill="#ffffff">
|
||||
<rect x="96" y="112" width="320" height="240" rx="60"/>
|
||||
<path d="M214 348 Q256 408 298 348 Z"/>
|
||||
</g>
|
||||
<!-- 三条反馈横线,左对齐,宽度递减 -->
|
||||
<g fill="#0057B8">
|
||||
<rect x="140" y="176" width="232" height="26" rx="13"/>
|
||||
<rect x="140" y="232" width="180" height="26" rx="13"/>
|
||||
<rect x="140" y="288" width="126" height="26" rx="13"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 740 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 854 B |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 989 B |
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "轻反馈 FeedLite",
|
||||
"short_name": "轻反馈",
|
||||
"description": "轻量级反馈系统:任何人都可以提交反馈与回复,无需注册。",
|
||||
"start_url": "./",
|
||||
"display": "standalone",
|
||||
"background_color": "#f5f6f8",
|
||||
"theme_color": "#0057B8",
|
||||
"icons": [
|
||||
{ "src": "android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
|
||||
{ "src": "android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" },
|
||||
{ "src": "android-chrome-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,373 @@
|
||||
/* FeedLite · 轻反馈 —— 简洁、克制的基础视觉基调 */
|
||||
:root{
|
||||
--fg:#1f2329; --muted:#6b7280; --line:#e5e7eb; --line-strong:#d7dbe0;
|
||||
--bg:#f5f6f8; --card:#ffffff; --brand:#0057B8; --brand-600:#004a9e; --brand-soft:#e8f0f9;
|
||||
/* 顶栏品牌图标:与官网首页同一枚应用图标(内联,离线预览也能显示) */
|
||||
--icon-mark:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAADsOAAA7DgHMtqGDAAADj0lEQVR4nO1b205TQRTdGB/UB78B0BdfRNA3NUT/QPHMHIgaP0BeMPqoog8mJqDyCfoBImJnDuCFyEWhIGiUegONimkFodYEaqpj9qEEwZbS0zOXXlaykqZNO2uvM9M9Z8/ZABkhysBy9gLhl4Dwh0B5CAj7CZQLo4iaCJtwNRLWDITVZI4tY+CMAOGvtQfnnSGwnWNuLFmBBnYAZU8NCMAvDoLlVGwseCtwAAgLGyDaZ7IZsJ3D6wdP+CEg7Jd+sdIYBytQm+bKOxVAecQAkfJngsV3rolelBXYms/EgdV/jJRTA0SpJeF1K1c/v1OdRwPYxFL8dtc+7WJ00Q5U4/S/rF2INrKLkNzeiqIkYfcBCHujXYg+hgAoixkgRBNZDHL5gU22IxraxsXdkYiYnlsUid9/hGzgGDhWRzAi6tvGXQ05mQAev1jZ2CtGp6JCN0Ymo64WpQZUNvaKSDQuTEE4GhcVXk0AD9PehCu/FsH3UW/LAbL8Aq55U2HfGJNvQOdoRJiKO8GwfAO+zi0KU/Hl+6J8AxIKUp1XoDbpBqTCp9kFsftsf/aDe2TVuX7xeXYhpRYtBrR0TikLfpmt9z6YY8DQu3mx5XiXsuC3nuh2054xBiBwe9rzYkZ0P5dLHGO9P2JtBpiCkgG0NANEQaTBbSe7xdWOyfxYAi2S0uD2Uz35YcCQpDRoXRvLDwNkpMEnb+c9bbu1GWAKSgbQ0gwQUpdAIsW69JoGNzc4oq71mW+32Epuh6dT7MNzTYNY2fUDeIss3YCOYMTXNIjV3NhCwhcDbg8pKInVpymKekmDj17O+hY8gl5XUBTdZDu+TVk/MayqLA7JgxE8jDAFqKX8tKKDEfhn7aaryqi+8p5PhWgOBiwvBzyMwHo8lqRVHY7iWO3DYXfNazscBQ88cyuUMcCmmyFlekC1Acgr7env8fEz1XpA+YDJ88WP31bq+vga39OhBbQMmtwG72p67BJf69IB2gY2haBbgG4C5T+0i9BFwqNQlI/JrnpclrIHxf6gZLN2Ifp4Hg2oKd4ZwKuSzRI8VHzBs1crDRPYWqZbkGragSNrWmb4oHZRysj6/u8lpKy8aJqmsC8yTc9grdtapl2kNMaBsoMZeged/QXbOIl9kRuC5fYQDhRQ8H3uEs8OArvJ6tztovYAckh1lB2FnGEHqt0GI9w6uoaY2GXCYkvt86iRXwDL2bOR0P4Cy8Hrhv+SooQAAAAASUVORK5CYII=");
|
||||
--ok:#0f9d58; --ok-soft:#e9f7ef; --warn:#b7791f; --warn-soft:#fff8e6;
|
||||
--danger:#d93025; --danger-soft:#fdecea; --shadow:0 1px 3px rgba(16,24,40,.06);
|
||||
}
|
||||
*{box-sizing:border-box}
|
||||
html{-webkit-text-size-adjust:100%}
|
||||
body{
|
||||
margin:0; background:var(--bg); color:var(--fg);
|
||||
font-family:-apple-system,BlinkMacSystemFont,"HarmonyOS Sans SC","HarmonyOS Sans","PingFang SC","Helvetica Neue","Microsoft YaHei",sans-serif;
|
||||
font-size:15.5px; line-height:1.75; letter-spacing:.01em;
|
||||
}
|
||||
.wrap{max-width:880px; margin:0 auto; padding:0 16px}
|
||||
a{color:var(--brand); text-decoration:none}
|
||||
a:hover{text-decoration:underline}
|
||||
h1{font-size:23px; margin:0 0 8px; font-weight:700}
|
||||
h2{font-size:17px; margin:0 0 12px; font-weight:700}
|
||||
p{margin:8px 0}
|
||||
.muted{color:var(--muted)}
|
||||
.small{font-size:13px}
|
||||
.dot{color:var(--line-strong); padding:0 2px}
|
||||
|
||||
/* ---------- 顶栏(与官网首页同一套导航样式) / 页脚 ---------- */
|
||||
.topbar{
|
||||
position:sticky; top:0; z-index:20;
|
||||
background:rgba(255,255,255,.82);
|
||||
backdrop-filter:saturate(180%) blur(14px);
|
||||
-webkit-backdrop-filter:saturate(180%) blur(14px);
|
||||
border-bottom:1px solid var(--line);
|
||||
}
|
||||
.topbar .wrap{display:flex; align-items:center; gap:14px; height:64px}
|
||||
.topbar .brand-mini{display:flex; align-items:center; gap:10px; font-weight:700; font-size:17px; color:var(--fg); min-width:0}
|
||||
.topbar .brand-mini:hover{text-decoration:none; color:var(--fg)}
|
||||
.topbar .brand-text{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
|
||||
.topbar .logo-mark{
|
||||
width:30px; height:30px; flex:none; display:block; border-radius:8px;
|
||||
background-image:var(--icon-mark); background-size:cover; background-position:center;
|
||||
box-shadow:var(--shadow);
|
||||
}
|
||||
.topbar .spacer{flex:1}
|
||||
.topbar .navlink{color:var(--muted); font-size:14.5px; padding:8px 10px; border-radius:8px; white-space:nowrap}
|
||||
.topbar .navlink:hover{color:var(--brand); background:var(--brand-soft); text-decoration:none}
|
||||
.topbar .btn-mini{
|
||||
flex:none; font-size:14.5px; font-weight:600; color:#fff; background:var(--brand);
|
||||
padding:9px 18px; border-radius:999px; white-space:nowrap;
|
||||
box-shadow:0 4px 14px -4px rgba(0,87,184,.55);
|
||||
}
|
||||
.topbar .btn-mini:hover{background:var(--brand-600); color:#fff; text-decoration:none}
|
||||
.hide-sm{display:inline-block}
|
||||
@media (max-width:640px){
|
||||
.hide-sm{display:none}
|
||||
.topbar .wrap{gap:10px}
|
||||
.topbar .brand-mini{font-size:15.5px; gap:9px}
|
||||
.topbar .logo-mark{width:28px; height:28px}
|
||||
}
|
||||
main.wrap{padding-top:24px; padding-bottom:40px; min-height:60vh}
|
||||
.foot{border-top:1px solid var(--line); background:var(--card); padding:22px 0 34px; margin-top:40px}
|
||||
.foot p{margin:4px 0; text-align:center; font-size:13px; color:var(--muted)}
|
||||
.foot a{color:var(--muted); text-decoration:underline}
|
||||
|
||||
/* ---------- 按钮 ---------- */
|
||||
.btn{
|
||||
display:inline-block; border:1px solid var(--line-strong); background:var(--card);
|
||||
color:var(--fg); border-radius:9px; padding:8px 16px; font-size:14.5px;
|
||||
cursor:pointer; line-height:1.4; font-family:inherit;
|
||||
}
|
||||
.btn:hover{border-color:var(--brand); color:var(--brand); text-decoration:none}
|
||||
.btn.primary{background:var(--brand); border-color:var(--brand); color:#fff; font-weight:600}
|
||||
.btn.primary:hover{background:var(--brand-600); color:#fff}
|
||||
|
||||
/* ---------- 页头 ---------- */
|
||||
.page-head{display:flex; align-items:flex-start; gap:16px; margin:6px 0 18px}
|
||||
.page-head .btn{margin-left:auto; flex:none; margin-top:4px}
|
||||
.page-head h1{margin-bottom:4px}
|
||||
.page-head .muted{font-size:14px; margin:0}
|
||||
|
||||
/* ---------- 筛选 ---------- */
|
||||
.filters{margin-bottom:16px}
|
||||
.chips{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px}
|
||||
.chip{
|
||||
padding:5px 13px; border-radius:999px; background:var(--card);
|
||||
border:1px solid var(--line); font-size:13.5px; color:var(--fg);
|
||||
}
|
||||
.chip:hover{border-color:var(--brand); color:var(--brand); text-decoration:none}
|
||||
.chip.on{background:var(--brand); border-color:var(--brand); color:#fff; font-weight:600}
|
||||
.filter-row{display:flex; flex-wrap:wrap; gap:8px}
|
||||
.filter-row select,.filter-row input[type=search]{
|
||||
border:1px solid var(--line-strong); border-radius:9px; padding:8px 10px;
|
||||
font-size:14px; background:var(--card); color:var(--fg); font-family:inherit;
|
||||
}
|
||||
.filter-row input[type=search]{flex:1; min-width:160px}
|
||||
|
||||
/* ---------- 列表 ---------- */
|
||||
.list{display:flex; flex-direction:column; gap:12px}
|
||||
.item{
|
||||
display:block; background:var(--card); border:1px solid var(--line);
|
||||
border-radius:13px; padding:15px 17px; box-shadow:var(--shadow); color:inherit;
|
||||
}
|
||||
.item:hover{border-color:var(--brand); text-decoration:none; box-shadow:0 3px 12px rgba(0,87,184,.10)}
|
||||
.item-top{display:flex; align-items:center; flex-wrap:wrap; gap:8px}
|
||||
.item-title{font-weight:600; font-size:16px; flex:1; min-width:160px}
|
||||
.item-ex{color:var(--muted); font-size:14px; margin:8px 0 8px; word-break:break-word}
|
||||
.item-meta{display:flex; flex-wrap:wrap; align-items:center; gap:6px; font-size:13px; color:var(--muted)}
|
||||
.item-meta .who{color:#3a424d; font-weight:600}
|
||||
/* 问题编号:便于按 id 逐条跟进与引用 */
|
||||
.item-id{
|
||||
flex:none; font-size:12.5px; font-weight:600; color:var(--muted);
|
||||
font-variant-numeric:tabular-nums; letter-spacing:.02em;
|
||||
border:1px solid var(--line); border-radius:6px; padding:0 7px; line-height:1.9;
|
||||
}
|
||||
|
||||
/* ---------- 徽标 ---------- */
|
||||
.badge{
|
||||
display:inline-block; font-size:12px; line-height:1.6; padding:1px 9px;
|
||||
border-radius:999px; background:var(--brand-soft); color:var(--brand);
|
||||
font-weight:600; white-space:nowrap;
|
||||
}
|
||||
.badge.st{background:#f1f3f5; color:#5b636e}
|
||||
.badge.st-open{background:var(--warn-soft); color:var(--warn)}
|
||||
.badge.st-doing{background:var(--brand-soft); color:var(--brand)}
|
||||
.badge.st-resolved{background:var(--ok-soft); color:var(--ok)}
|
||||
.badge.st-closed{background:#f1f3f5; color:#8a929c}
|
||||
.badge.official{background:var(--brand); color:#fff}
|
||||
|
||||
/* ---------- 分页 ---------- */
|
||||
.pager{display:flex; align-items:center; gap:12px; margin:22px 0 0; justify-content:center}
|
||||
.pager-info{font-size:13.5px; color:var(--muted)}
|
||||
|
||||
/* ---------- 空态 ---------- */
|
||||
.empty{
|
||||
background:var(--card); border:1px dashed var(--line-strong); border-radius:13px;
|
||||
padding:34px 20px; text-align:center; color:var(--muted);
|
||||
}
|
||||
.empty.small{padding:20px}
|
||||
|
||||
/* ---------- 面包屑 ---------- */
|
||||
.crumbs{margin:4px 0 14px; font-size:14px}
|
||||
|
||||
/* ---------- 主题 / 回复 ---------- */
|
||||
.subject{background:var(--card); border:1px solid var(--line); border-radius:14px; padding:20px 22px; box-shadow:var(--shadow)}
|
||||
.subject-title{font-size:21px; margin:0; flex:1; min-width:200px}
|
||||
.subject-body{margin-top:14px; white-space:normal; word-break:break-word; line-height:1.85}
|
||||
.subject-body br{content:""}
|
||||
|
||||
.replies{margin-top:22px}
|
||||
.reply{
|
||||
background:var(--card); border:1px solid var(--line); border-left:3px solid var(--line-strong);
|
||||
border-radius:11px; padding:13px 16px; margin-bottom:11px;
|
||||
}
|
||||
.reply.admin{border-left-color:var(--brand); background:linear-gradient(180deg,var(--brand-soft),var(--card) 42%)}
|
||||
.reply-head{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); margin-bottom:6px}
|
||||
.reply-head .who{font-weight:600; color:#3a424d; font-size:14px}
|
||||
.reply-body{word-break:break-word; line-height:1.8}
|
||||
|
||||
/* ---------- 表单 ---------- */
|
||||
.narrow{max-width:640px}
|
||||
.card-form{background:var(--card); border:1px solid var(--line); border-radius:14px; padding:20px 22px; box-shadow:var(--shadow); margin-top:14px}
|
||||
.field{display:block; margin-bottom:16px}
|
||||
.field > span{display:block; font-size:14px; font-weight:600; margin-bottom:6px}
|
||||
.field .req{color:var(--danger)}
|
||||
.field .hint{font-style:normal; font-weight:400; font-size:12.5px; color:var(--muted); margin-left:6px}
|
||||
.field input[type=text],.field input[type=email],.field input[type=tel],
|
||||
.field input[type=password],.field textarea,.field select{
|
||||
width:100%; border:1px solid var(--line-strong); border-radius:9px;
|
||||
padding:9px 12px; font-size:15px; font-family:inherit; background:var(--card);
|
||||
color:var(--fg); line-height:1.6;
|
||||
}
|
||||
.field textarea{resize:vertical; min-height:110px}
|
||||
.field input:focus,.field textarea:focus,.field select:focus{
|
||||
outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft);
|
||||
}
|
||||
.row2{display:grid; grid-template-columns:1fr 1fr; gap:14px}
|
||||
@media (max-width:560px){ .row2{grid-template-columns:1fr} }
|
||||
|
||||
.captcha{margin:18px 0 0; padding:14px 16px; background:#fafbfc; border:1px solid var(--line); border-radius:11px}
|
||||
.captcha .field{margin-bottom:0}
|
||||
.captcha-line{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
|
||||
.captcha-line .c-q{
|
||||
flex:1; min-width:200px; font-weight:600; color:var(--brand);
|
||||
background:var(--brand-soft); border-radius:8px; padding:8px 12px;
|
||||
}
|
||||
.captcha-line input{flex:none; width:110px}
|
||||
.captcha-line .reload{font-size:13.5px; white-space:nowrap}
|
||||
|
||||
.form-actions{margin-top:20px}
|
||||
.form-actions .btn{padding:10px 26px; font-size:15px}
|
||||
.admin-pw{margin-top:6px}
|
||||
.admin-status{margin-bottom:16px}
|
||||
|
||||
/* 蜜罐字段:对用户不可见,但保留在 DOM 中诱捕机器人 */
|
||||
.hp-field{position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden}
|
||||
|
||||
/* ---------- 提示条 ---------- */
|
||||
.flash{border-radius:10px; padding:11px 15px; font-size:14px; margin:0 0 16px}
|
||||
.flash.error{background:var(--danger-soft); border:1px solid #f6c6c1; color:#9c2b21}
|
||||
.flash.ok{background:var(--ok-soft); border:1px solid #bfe5cd; color:#0b6b3d}
|
||||
|
||||
/* ---------- 附件上传(浏览器直传 OSS) ---------- */
|
||||
.uploader-box{
|
||||
margin:18px 0 0; padding:14px 16px; background:#fafbfc;
|
||||
border:1px solid var(--line); border-radius:11px;
|
||||
}
|
||||
.uploader{border-radius:10px; transition:background .15s, box-shadow .15s}
|
||||
.uploader + .uploader{margin-top:14px; padding-top:14px; border-top:1px dashed var(--line)}
|
||||
.uploader.dragging{background:var(--brand-soft); box-shadow:0 0 0 2px var(--brand) inset}
|
||||
.up-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
|
||||
.up-title{font-size:14px; font-weight:600}
|
||||
.up-head .btn{margin-left:auto; padding:6px 14px; font-size:13.5px; flex:none}
|
||||
.up-file{display:none}
|
||||
.up-list{display:flex; flex-wrap:wrap; gap:9px; margin-top:10px}
|
||||
.up-list:empty{display:none}
|
||||
.up-item{
|
||||
position:relative; display:flex; gap:10px; align-items:center; width:100%;
|
||||
padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:var(--card);
|
||||
}
|
||||
.up-thumb{
|
||||
width:52px; height:52px; flex:none; border-radius:8px; overflow:hidden; background:#eef1f4;
|
||||
display:flex; align-items:center; justify-content:center;
|
||||
}
|
||||
.up-thumb img{width:100%; height:100%; object-fit:cover; display:block}
|
||||
.up-thumb-video{font-size:10px; font-weight:700; color:var(--muted); letter-spacing:.08em}
|
||||
.up-info{flex:1; min-width:0}
|
||||
.up-name{font-size:13.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
|
||||
.up-state{font-size:12.5px; color:var(--muted); word-break:break-word}
|
||||
.up-bar{height:4px; border-radius:2px; background:#e6eaee; overflow:hidden; margin-top:5px}
|
||||
.up-bar i{display:block; height:100%; width:0; background:var(--brand); transition:width .2s}
|
||||
.up-item.done .up-bar{display:none}
|
||||
.up-item.fail{border-color:#f6c6c1; background:var(--danger-soft)}
|
||||
.up-item.fail .up-state{color:var(--danger)}
|
||||
.up-del{
|
||||
flex:none; border:1px solid var(--line-strong); background:var(--card); color:var(--muted);
|
||||
border-radius:7px; padding:5px 10px; font-size:12.5px; cursor:pointer; font-family:inherit;
|
||||
}
|
||||
.up-del:hover{border-color:var(--danger); color:var(--danger)}
|
||||
.up-del:disabled{opacity:.45; cursor:default}
|
||||
|
||||
/* ---------- 附件展示 ---------- */
|
||||
/* align-items:flex-start —— 否则同行里有视频(多了标题栏)时,图片盒子会被拉伸,底部留白 */
|
||||
.atts{display:flex; flex-wrap:wrap; align-items:flex-start; gap:10px; margin-top:14px}
|
||||
.atts .att{
|
||||
margin:0; max-width:100%; border:1px solid var(--line); border-radius:11px;
|
||||
overflow:hidden; background:var(--card);
|
||||
}
|
||||
.atts .att-image img{display:block; width:220px; height:auto; max-height:200px; object-fit:cover}
|
||||
.atts.compact .att-image img{width:150px; max-height:140px}
|
||||
.atts .att-video{flex:1 1 320px; max-width:440px}
|
||||
.atts .att-video video{display:block; width:100%; max-height:330px; background:#000}
|
||||
.att-video-ph{
|
||||
width:360px; max-width:100%; height:200px; background:#11161c; color:#8b97a5;
|
||||
display:flex; align-items:center; justify-content:center; font-size:13px;
|
||||
}
|
||||
.atts figcaption{
|
||||
display:flex; gap:8px; align-items:center; padding:6px 9px; font-size:12px; color:var(--muted);
|
||||
}
|
||||
.atts .att-name{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
|
||||
.atts .att-size{margin-left:auto; flex:none}
|
||||
.thumbs{display:flex; gap:8px; margin:0 0 8px}
|
||||
.thumbs img{
|
||||
width:78px; height:78px; object-fit:cover; display:block;
|
||||
border-radius:9px; border:1px solid var(--line);
|
||||
}
|
||||
.att-tag{color:var(--brand); font-weight:600}
|
||||
|
||||
/* ---------- 附件灯箱(点击放大 + 左右切换) ---------- */
|
||||
.atts .att-image .att-lb{display:block; line-height:0; cursor:zoom-in}
|
||||
.atts .att-image .att-lb:focus-visible{outline:2px solid var(--brand); outline-offset:2px}
|
||||
.att-zoom{
|
||||
flex:none; border:1px solid var(--line-strong); background:var(--card); color:var(--muted);
|
||||
border-radius:6px; padding:2px 9px; font-size:12px; line-height:1.6; cursor:pointer; font-family:inherit;
|
||||
}
|
||||
.att-zoom:hover{border-color:var(--brand); color:var(--brand)}
|
||||
|
||||
html.lb-open,body.lb-open{overflow:hidden}
|
||||
.lb{
|
||||
position:fixed; inset:0; z-index:1000; background:rgba(12,14,17,.94);
|
||||
display:flex; flex-direction:column; animation:lb-in .16s ease-out;
|
||||
}
|
||||
.lb[hidden]{display:none}
|
||||
@keyframes lb-in{from{opacity:0} to{opacity:1}}
|
||||
.lb-stage{flex:1; min-height:0; position:relative}
|
||||
.lb-media{
|
||||
position:absolute; inset:0; z-index:1; padding:48px 62px;
|
||||
display:flex; align-items:center; justify-content:center;
|
||||
}
|
||||
.lb-media img,.lb-media video{
|
||||
display:block; max-width:100%; max-height:100%; border-radius:6px;
|
||||
box-shadow:0 10px 44px rgba(0,0,0,.55);
|
||||
}
|
||||
.lb-media video{background:#000; width:auto}
|
||||
.lb-media.loading::after{
|
||||
content:''; position:absolute; width:26px; height:26px; border-radius:50%;
|
||||
border:3px solid rgba(255,255,255,.26); border-top-color:#fff;
|
||||
animation:lb-spin .8s linear infinite;
|
||||
}
|
||||
@keyframes lb-spin{to{transform:rotate(360deg)}}
|
||||
.lb-nav{
|
||||
position:absolute; top:50%; transform:translateY(-50%); z-index:2;
|
||||
width:46px; height:46px; padding:0 0 3px; border:0; border-radius:50%; cursor:pointer;
|
||||
background:rgba(255,255,255,.14); color:#fff; font-size:26px; line-height:1;
|
||||
display:flex; align-items:center; justify-content:center; font-family:inherit;
|
||||
}
|
||||
.lb-nav:hover{background:rgba(255,255,255,.32)}
|
||||
.lb-nav[hidden]{display:none}
|
||||
.lb-prev{left:14px}
|
||||
.lb-next{right:14px}
|
||||
.lb-x{
|
||||
position:absolute; top:14px; right:14px; z-index:3;
|
||||
width:40px; height:40px; border:0; border-radius:50%; cursor:pointer;
|
||||
background:rgba(255,255,255,.14); color:#fff; font-size:17px; font-family:inherit;
|
||||
}
|
||||
.lb-x:hover{background:rgba(255,255,255,.32)}
|
||||
.lb-bar{
|
||||
flex:none; display:flex; align-items:center; gap:10px; flex-wrap:wrap;
|
||||
padding:10px 18px 16px; color:#e9edf2; font-size:13.5px;
|
||||
}
|
||||
.lb-name{font-weight:600; max-width:58vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
|
||||
.lb-meta{color:#9aa4b0; white-space:nowrap}
|
||||
.lb-orig{margin-left:auto; color:#9ec5ff; white-space:nowrap}
|
||||
.lb-orig[hidden]{display:none}
|
||||
@media (max-width:560px){
|
||||
.lb-media{padding:40px 10px}
|
||||
.lb-nav{width:38px; height:38px; font-size:22px}
|
||||
.lb-prev{left:6px} .lb-next{right:6px}
|
||||
.lb-name{max-width:44vw}
|
||||
}
|
||||
|
||||
/* ---------- 深色模式 ---------- */
|
||||
@media (prefers-color-scheme: dark){
|
||||
:root{
|
||||
--fg:#e6e8eb; --muted:#9aa2ad; --line:#2c3138; --line-strong:#3a4149;
|
||||
--bg:#15181c; --card:#1c2024; --brand:#5aa2ff; --brand-soft:#1e2a3d;
|
||||
--ok:#4ec98a; --ok-soft:#16301f; --warn:#e2b559; --warn-soft:#2a2517;
|
||||
--danger:#ff8a80; --danger-soft:#33191a; --shadow:0 1px 3px rgba(0,0,0,.35);
|
||||
}
|
||||
.item-meta .who,.reply-head .who{color:#cfd4da}
|
||||
.field > span{color:#e6e8eb}
|
||||
.captcha{background:#21262b}
|
||||
.uploader-box{background:#21262b}
|
||||
.up-thumb{background:#2c3138}
|
||||
.up-bar{background:#2c3138}
|
||||
.up-item.fail{border-color:#5a2a2a}
|
||||
.badge.st{background:#242a30; color:#a8b0ba}
|
||||
.badge.st-closed{background:#242a30; color:#8a929c}
|
||||
.topbar{background:rgba(21,24,28,.82)}
|
||||
.topbar .navlink:hover{background:var(--brand-soft)}
|
||||
.btn:hover{border-color:var(--brand)}
|
||||
.reply.admin{background:linear-gradient(180deg,var(--brand-soft),var(--card) 42%)}
|
||||
.flash.error{background:var(--danger-soft); border-color:#5a2a2a; color:#ffb4ab}
|
||||
.flash.ok{background:var(--ok-soft); border-color:#26503a; color:#9fe3bd}
|
||||
}
|
||||
|
||||
/* ---- 管理后台 ---- */
|
||||
.tabs{display:flex; flex-wrap:wrap; gap:8px; margin:16px 0 4px; border-bottom:1px solid var(--line); padding-bottom:10px}
|
||||
.tab{padding:7px 14px; border-radius:999px; font-size:14px; color:var(--muted); background:var(--card); border:1px solid var(--line)}
|
||||
.tab:hover{color:var(--brand); border-color:var(--brand)}
|
||||
.tab.on{background:var(--brand); border-color:var(--brand); color:#fff}
|
||||
.grid2{display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:12px 16px; margin:12px 0}
|
||||
.grid2 .field{margin:0}
|
||||
.check{display:flex; align-items:center; gap:8px; font-size:14px; color:var(--muted); margin:8px 0}
|
||||
.check input{width:16px; height:16px}
|
||||
.btn.danger{border-color:#e08b84; color:#c0392b}
|
||||
.btn.danger:hover{background:#fdecea}
|
||||
.filters{display:flex; flex-wrap:wrap; gap:8px; margin:18px 0 4px}
|
||||
.filters input[type=text]{flex:1 1 220px; min-width:180px}
|
||||
.filters select{max-width:160px}
|
||||
@media (max-width:640px){
|
||||
.grid2{grid-template-columns:1fr}
|
||||
.filters input[type=text],.filters select{width:100%; max-width:none}
|
||||
}
|
||||