Update app.js

This commit is contained in:
Furrium Network authored and GitHub committed 2026-08-09 19:58:22 +08:00
1 parent bbaa1e9748
commit ff46812564
1 file changed
-19
-19
View File
@@ -116,7 +116,6 @@ function switchPage(page, param) {
document.getElementById('fileInput').value = '';
document.getElementById('postCaptchaInput').value = '';
refreshCaptcha('post');
// 重置上传区域文字
const dropText = document.getElementById('dropZoneText');
if (dropText) dropText.textContent = '点击或拖拽上传图片';
}
@@ -390,7 +389,6 @@ async function init() {
// 绑定所有事件
// ============================================================
// 主题切换
const themeToggle = document.getElementById('themeToggle');
if (themeToggle) {
themeToggle.addEventListener('click', function(e) {
@@ -401,7 +399,6 @@ async function init() {
});
}
// 头像下拉
document.getElementById('avatarImg').addEventListener('click', function(e) {
e.stopPropagation();
document.getElementById('dropdownMenu').classList.toggle('show');
@@ -410,7 +407,6 @@ async function init() {
document.getElementById('dropdownMenu').classList.remove('show');
});
// 导航菜单
document.querySelectorAll('[data-page]').forEach(el => {
el.addEventListener('click', function(e) {
e.preventDefault();
@@ -424,14 +420,12 @@ async function init() {
});
});
// 返回按钮
document.querySelectorAll('.back-btn').forEach(btn => {
btn.addEventListener('click', function() {
switchPage('feed');
});
});
// 设置保存
document.getElementById('settingsSave').addEventListener('click', async () => {
if (!currentUser) { alert('请先登录'); return; }
const username = document.getElementById('settingsUsername').value.trim();
@@ -455,18 +449,15 @@ async function init() {
}
});
// 点击论坛名回首页
document.getElementById('forumName').addEventListener('click', function() {
switchPage('feed');
});
// 发帖按钮
document.getElementById('fab').addEventListener('click', () => {
if (!currentUser) { alert('请先登录'); return; }
switchPage('new');
});
// 发帖提交
document.getElementById('postSubmit').addEventListener('click', async () => {
if (!currentUser || !currentUser.id) {
alert('请先登录');
@@ -495,7 +486,6 @@ async function init() {
}
});
// 验证码刷新
document.getElementById('postCaptchaQuestion').addEventListener('click', function() {
refreshCaptcha('post');
});
@@ -503,7 +493,6 @@ async function init() {
refreshCaptcha('reg');
});
// 图片上传 - 拖拽区域
const dropZone = document.getElementById('dropZone');
const fileInput = document.getElementById('fileInput');
const dropZoneText = document.getElementById('dropZoneText');
@@ -540,7 +529,6 @@ async function init() {
});
}
// 举报提交
document.getElementById('reportSubmit').addEventListener('click', async () => {
if (!reportTargetPostId) return;
const reason = document.getElementById('reportReason').value;
@@ -554,7 +542,6 @@ async function init() {
}
});
// 模态框关闭
document.querySelectorAll('.modal .close').forEach(btn => {
btn.addEventListener('click', function() {
document.getElementById(this.dataset.modal).classList.remove('active');
@@ -566,7 +553,6 @@ async function init() {
});
});
// 浏览器前进后退
window.addEventListener('popstate', function(e) {
const state = e.state || {};
const page = state.page || 'feed';
@@ -581,7 +567,6 @@ async function init() {
}
});
// 私信按钮
const messageBtn = document.getElementById('messageBtn');
if (messageBtn) {
const newBtn = messageBtn.cloneNode(true);
@@ -593,19 +578,16 @@ async function init() {
});
}
// 私信列表关闭
const closeMessageListBtn = document.querySelector('#messageListModal .close');
if (closeMessageListBtn) {
closeMessageListBtn.addEventListener('click', closeMessageList);
}
// 聊天关闭
const closeChatBtn = document.querySelector('#chatModal .close');
if (closeChatBtn) {
closeChatBtn.addEventListener('click', closeChat);
}
// 聊天输入框 Enter 发送
const chatInput = document.getElementById('chatInput');
if (chatInput) {
chatInput.addEventListener('keydown', function(e) {
@@ -616,7 +598,6 @@ async function init() {
});
}
// 点击模态框背景关闭
document.querySelectorAll('.modal').forEach(m => {
m.addEventListener('click', function(e) {
if (e.target === this) {