七夕<\TITLE> <\HEAD> <BODY> <P>亲爱的老公,今天是8月29日,是我们的第一个七夕节,不知道你缺什么,也没想到肯定能合你心意的礼物,只有一些攒了很久却没说出口的话,趁着七夕,用平淡的文字,写我俗气又满溢的喜欢,写我热烈而赤裸的爱意,写我无数次温习过的回忆以及关于你的梦想。 这份礼物准备的有点仓促,那天中午你问我为什么哭,我说我高兴。是真的高兴,盼了一个月的日子,终于盼到了“明天”。但只是一部分,另一部分是想起去年的七夕,那一句莫名其妙的七夕快乐,是我整晚争吵里唯一的光,也许那个时候,脑子里也曾闪过要是我的伴侣是你该多好的念头。可是,我一想到那时候你该有多难过却还要给我发消息,我就觉得一阵心疼,让你在我这里受了这么大委屈,我只剩下愧疚和自责。 我喜欢听你讲过去的事情,我羡慕那些比我早出现在你的生命里的人,我只能在你一遍遍的叙述里,靠想象构建和认识过去的你,我知道,那是一段我再也无法参与的时光。爱让人变得卑劣,让人变得不像自己。于是我自私地想私藏你的未来,自私地想占有你全部的关心和偏爱,我总是会假装自己并不需要,可我的假装在你面前显得那样赤裸,你永远都能稳稳地接住我的情绪,永远包容着我的拧巴,治愈着我的敏感,永远温柔而坚定地告诉我你爱我。你的爱,总是那样拿得出手。 我一边抱着顺其自然的心态,一边肆无忌惮地任性、懒惰、无理取闹想把你推开,却又在每个夜晚偷偷许愿只想和你永远在一起。爱是一个永恒的课题,需要用整个生命去回应。我从来不敢相信,两个没有任何关系的人,在相识和了解过后,会把对方看的比自己还重要,靠虚无缥缈的爱连接起来的两颗心,竟会让我觉得纵使隔着千山万水,却依然如此之近。 最近很喜欢一句话:“我借着你的光看到了一个全新的更好的世界,也借着喜欢你,成为了一个更好的自己。”在过去的341天里,从我们相遇的那天起,爱开始有了颜色,单调贫瘠的生活,变得生动起来。我总是在夜晚,想起我们在一起的点点滴滴,陪我逛街你从来不会不耐烦,逛饰品店、挑衣服、做美甲,永远都是认认真真帮我参考,我想去体验的所有事情,你都是那么地支持我,一起捏陶泥,一起去海洋馆,给我拍好看的照片,陪我演出…这些场景一幕幕地在我眼前播放,才让我觉得你是真实存在的,而不是一个巨大的梦。比起得到,我想我更害怕失去。我从未体会过什么叫做心动,也从未想过会为一个人变得如此柔软,我曾经认为一个人应该可以完全掌控他的身体、思想和心情,直到我发现我的全世界都是挥之不去的关于你的印记。我望向你的每个瞬间,都想和你有以后。 当初考研的时候我说过,考上了我们就一直在一起,没考上我们就分手。但真让我履行承诺,我一点也舍不得,我突然觉得,比起异地,我更不能接受失去你。我愿意每天早起赶班车去见你,也愿意跨越千里去拥抱你。如果你问我,我是什么时候爱上你的,其实我也不知道,但我知道,和你在一起的每一天,都在反反复复地爱上你。我喜欢你笑咪咪的眼睛,喜欢你上扬的嘴角,喜欢你温柔的声音,喜欢你可可爱爱的撒娇,喜欢你把我紧紧抱在怀里,喜欢关于你的一切。 爱存在,所以梦想开始生根发芽。我总幻想关于我们的未来,没有争吵没有冷战,只有打打闹闹和无微不至的相互关心,我们会一起上下班,一起在食堂吃饭,偶尔回家研究研究爱吃的菜谱,傍晚一起散步,一起看日落,一起洗澡、追剧、分享今天的发生的事情...这些我不曾期待过的美好,竟然总觉得近在眼前。我们会有一个温馨的小家,会陪伴彼此解锁人生中的每一个新角色,一直到时间尽头。 世界这么大,遇见你是这辈子最幸运的事情。我不知道自己有多喜欢你,可我比想象中的更需要你,至少有你在,好像事情就没有那么糟糕。在不能见面的日子里,一定一定要照顾好自己,不要生病,要好好吃饭,好好睡觉,每天都开开心心的,看见你笑嘻嘻的,世界都变晴朗了。<\P> <\BODY> <\HTML> </div> <style> /* 内容响应式处理 */ .content-wrapper { overflow-x: hidden; word-wrap: break-word; overflow-wrap: break-word; padding-bottom: 80px; /* 为底部平台标识留出空间 */ } .content-wrapper img { max-width: 100%; height: auto; display: block; margin: 1rem auto; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); } .content-wrapper table { max-width: 100%; overflow-x: auto; display: block; white-space: nowrap; } .content-wrapper table td, .content-wrapper table th { white-space: normal; word-wrap: break-word; } .content-wrapper pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; } .content-wrapper a { word-wrap: break-word; overflow-wrap: break-word; } .content-wrapper video, .content-wrapper iframe { max-width: 100%; height: auto; } /* 移动端优化 */ @media (max-width: 768px) { .content-wrapper img { margin: 0.5rem auto; border-radius: 4px; } .content-wrapper { font-size: 16px; line-height: 1.6; padding-bottom: 60px; /* 移动端底部间距调整 */ } } </style> <!-- 右下角固定浮层按钮组 --> <div class="floating-action-buttons"> <!-- 点赞按钮 --> <button class="floating-btn like-btn" onclick="handleLike()" title="你的点赞会把这个工具在工具库优先推荐给更多人"> <i class="bi bi-heart"></i> </button> <!-- 收藏按钮 --> <button class="floating-btn favorite-btn" onclick="handleFavorite()" title="在用户中心会展示,帮你更快速访问这些工具"> <i class="bi bi-bookmark"></i> </button> <!-- 反馈按钮 --> <button class="floating-btn feedback-btn" onclick="handleFeedback()" title="反馈问题或建议"> <i class="bi bi-chat-dots"></i> </button> <!-- 分享按钮 --> <button class="floating-btn share-btn" onclick="handleShare()" title="分享到推特、微博"> <i class="bi bi-share"></i> </button> </div> <!-- Google AdSense 广告位 - 已禁用 --> <!-- <div id="adsense-container" style="text-align: center; margin: 20px 0; padding: 10px; min-height: 100px; display: none;"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-1568926315655201" data-ad-slot="1234567890" data-ad-format="auto" data-full-width-responsive="true"></ins> </div> <script type="text/javascript"> // 等待 Google AdSense 异步加载完成 function initAdsenseAd() { // 检查是否已经初始化过 if (window.adsenseAdInitialized) { console.log('⚠️ AdSense 广告已经初始化过,跳过重复初始化'); return; } if (window.adsbygoogle && window.googleServicesLoader && window.googleServicesLoader.getServiceStatus().adsense) { try { document.getElementById('adsense-container').style.display = 'block'; // 使用更安全的广告初始化方式 if (window.adsbygoogle && window.adsbygoogle.push) { window.adsbygoogle.push({}); window.adsenseAdInitialized = true; console.log('✅ AdSense 广告初始化成功'); } } catch (error) { console.warn('AdSense 广告初始化失败:', error); } } else { // 如果 AdSense 未加载,延迟重试 setTimeout(initAdsenseAd, 1000); } } // 页面加载完成后尝试初始化广告 document.addEventListener('DOMContentLoaded', function() { // 等待 google-services-loader 完成初始化 setTimeout(initAdsenseAd, 3000); // 延迟3秒确保服务已加载 }); </script> --> <!-- 底部平台标识 --> <div class="platform-footer"> <div class="footer-brand"> <a href="/" title="DKFile - 免费HTML网页托管平台 | Free HTML Website Hosting - 免费HTML网页托管平台" onclick="logClick('dkfile_link')" rel="nofollow">DKFile</a> </div> <div class="footer-divider"></div> <div class="footer-support"> <a href="http://istester.com/page/1407.html" target="_blank" rel="noopener nofollow" title="技术支持,有任何问题,可以找我" onclick="logClick('tech_support')">技术支持 IDO老徐</a> </div> </div> <script> // 从模板变量获取数据 const pageData = { fileId: 8874, fileName: "qixi.html", projectName: "qixi", author: "smile2333" }; // 用户登录状态 - 使用简单的检查方式 const currentUserAuthenticated = false; // 调试信息 console.log('页面数据初始化:', { pageData: pageData, currentUserAuthenticated: currentUserAuthenticated, fileId: pageData.fileId, fileIdType: typeof pageData.fileId }); // HTML文件完整性检测 function validateHtmlFile() { const issues = []; // 检测是否有多个 DOCTYPE html const doctypeCount = document.querySelectorAll('html').length; if (doctypeCount > 1) { issues.push(`检测到 ${doctypeCount} 个HTML文档结构,文件可能包含重复内容`); } // 检测是否有多个 title 标签 const titleCount = document.querySelectorAll('title').length; if (titleCount > 1) { issues.push(`检测到 ${titleCount} 个title标签,文件结构异常`); } // 检测是否有多个 body 标签 const bodyCount = document.querySelectorAll('body').length; if (bodyCount > 1) { issues.push(`检测到 ${bodyCount} 个body标签,文件结构异常`); } // 检测是否有多个 pageData 对象(通过脚本内容检测) const scripts = document.querySelectorAll('script'); let pageDataCount = 0; scripts.forEach(script => { if (script.textContent && script.textContent.includes('pageData')) { pageDataCount++; } }); if (pageDataCount > 1) { issues.push(`检测到 ${pageDataCount} 个pageData对象,可能导致功能异常`); } return issues; } // 智能 pageData 选择 function getValidPageData() { console.log('getValidPageData 被调用'); console.log('当前 pageData:', pageData); // 如果当前 pageData 有效,直接使用 if (pageData && pageData.fileId && pageData.fileId !== 'null' && pageData.fileId !== null) { console.log('使用当前 pageData:', pageData); return pageData; } console.log('当前 pageData 无效,尝试查找其他数据源'); // 尝试从页面中查找其他 pageData 对象 const scripts = document.querySelectorAll('script'); let foundPageData = null; for (let script of scripts) { if (script.textContent && script.textContent.includes('pageData')) { try { // 尝试提取 pageData 对象 const match = script.textContent.match(/const\s+pageData\s*=\s*({[^}]+})/); if (match) { const dataStr = match[1]; // 简单的对象解析 const fileIdMatch = dataStr.match(/fileId:\s*(\d+)/); if (fileIdMatch) { foundPageData = { fileId: parseInt(fileIdMatch[1]), fileName: 'auto-detected', projectName: 'auto-detected', author: 'auto-detected' }; console.log('找到其他 pageData:', foundPageData); break; } } } catch (e) { console.warn('解析pageData失败:', e); } } } const result = foundPageData || pageData; console.log('getValidPageData 返回结果:', result); return result; } // 页面加载完成后进行完整性检查(仅记录到控制台,不显示给用户) document.addEventListener('DOMContentLoaded', function() { const issues = validateHtmlFile(); if (issues.length > 0) { // 仅在控制台记录,不显示给用户 console.debug('HTML文件完整性检查发现问题:', issues); // 移除用户界面警告显示 } }); // 调试信息 console.log('用户登录状态:', currentUserAuthenticated); console.log('当前用户:', ''); console.log('页面数据:', pageData); console.log('文件ID:', pageData.fileId); // 全局错误处理 window.addEventListener('error', function(event) { console.error('全局错误:', { message: event.message, filename: event.filename, lineno: event.lineno, colno: event.colno, error: event.error }); }); // 未处理的Promise拒绝处理 window.addEventListener('unhandledrejection', function(event) { console.error('未处理的Promise拒绝:', { reason: event.reason, promise: event.promise }); }); // 点击记录函数 function logClick(action) { try { // 使用智能 pageData 选择 const validPageData = getValidPageData(); if (!validPageData || !validPageData.fileId) { console.debug('No valid file ID available for click logging'); return; } // 发送点击记录请求 fetch('/api/log_click', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ log_type: 'footer_click', action: action, file_id: validPageData.fileId, extra_data: JSON.stringify({ page_url: window.location.href, page_title: document.title, timestamp: new Date().toISOString(), file_name: validPageData.fileName, project_name: validPageData.projectName, author: validPageData.author }) }) }).catch(error => { // 静默处理错误,不影响用户体验 console.debug('Click logging failed:', error); }); } catch (error) { // 静默处理错误 console.debug('Click logging error:', error); } } // 页面加载完成后记录页面访问 document.addEventListener('DOMContentLoaded', function() { // 记录页面访问(可选) logClick('page_view'); // SEO 性能监控 monitorSeoPerformance(); // 检查用户登录状态和收藏点赞状态 if (typeof currentUserAuthenticated !== 'undefined' && currentUserAuthenticated) { console.log('用户已登录,开始检查收藏点赞状态'); // 使用智能 pageData 选择 const validPageData = getValidPageData(); console.log('状态检查 - 获取到的有效数据:', validPageData); if (validPageData && validPageData.fileId) { console.log('开始检查收藏状态,文件ID:', validPageData.fileId); // 检查收藏状态 fetch('/api/check_favorite/' + validPageData.fileId) .then(response => { console.log('检查收藏状态API响应状态:', response.status); return response.json(); }) .then(data => { console.log('检查收藏状态API响应数据:', data); if (data.success && data.is_favorited) { const favoriteBtn = document.querySelector('.floating-btn.favorite-btn'); if (favoriteBtn) { favoriteBtn.classList.add('favorited'); favoriteBtn.innerHTML = '<i class="bi bi-bookmark-fill"></i>'; console.log('收藏状态已更新为已收藏'); } else { console.warn('未找到收藏按钮元素'); } } }) .catch(error => { console.error('检查收藏状态失败:', error); }); console.log('开始检查点赞状态,文件ID:', validPageData.fileId); // 检查点赞状态 fetch('/api/check_like/' + validPageData.fileId) .then(response => { console.log('检查点赞状态API响应状态:', response.status); return response.json(); }) .then(data => { console.log('检查点赞状态API响应数据:', data); if (data.success && data.is_liked) { const likeBtn = document.querySelector('.floating-btn.like-btn'); if (likeBtn) { likeBtn.classList.add('liked'); likeBtn.innerHTML = '<i class="bi bi-heart-fill"></i>'; console.log('点赞状态已更新为已点赞'); } else { console.warn('未找到点赞按钮元素'); } } }) .catch(error => { console.error('检查点赞状态失败:', error); }); } else { console.warn('无法获取有效的文件数据,跳过状态检查'); } } else { console.log('用户未登录,跳过收藏点赞状态检查'); } }); // 点赞功能 function handleLike() { console.log('handleLike 被调用'); logClick('like_click'); // 检查是否登录 - 使用JavaScript检查 if (typeof currentUserAuthenticated === 'undefined' || !currentUserAuthenticated) { console.log('用户未登录,无法点赞'); showToast('请先登录后再点赞'); setTimeout(() => { window.location.href = '/login'; }, 1500); return; } console.log('用户已登录,检查文件信息'); // 使用智能 pageData 选择 const validPageData = getValidPageData(); console.log('点赞 - 获取到的有效数据:', validPageData); if (!validPageData || !validPageData.fileId) { console.error('点赞失败:无效的文件数据', validPageData); showToast('文件信息异常,无法执行点赞操作'); return; } console.log('开始发送点赞请求,文件ID:', validPageData.fileId); fetch('/api/like', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ file_id: validPageData.fileId }) }) .then(response => { console.log('点赞API响应状态:', response.status); return response.json(); }) .then(data => { console.log('点赞API响应数据:', data); if (data.success) { const likeBtn = document.querySelector('.floating-btn.like-btn'); if (data.action === 'liked') { likeBtn.classList.add('liked'); likeBtn.innerHTML = '<i class="bi bi-heart-fill"></i>'; } else { likeBtn.classList.remove('liked'); likeBtn.innerHTML = '<i class="bi bi-heart"></i>'; } showToast(data.message); } else { showToast('操作失败:' + data.message); } }) .catch(error => { console.error('点赞请求失败:', error); showToast('操作失败,请稍后重试'); }); } // 收藏功能 function handleFavorite() { console.log('handleFavorite 被调用'); logClick('favorite_click'); // 检查是否登录 - 使用JavaScript检查 if (typeof currentUserAuthenticated === 'undefined' || !currentUserAuthenticated) { console.log('用户未登录,无法收藏'); showToast('请先登录后再收藏'); setTimeout(() => { window.location.href = '/login'; }, 1500); return; } console.log('用户已登录,检查文件信息'); // 使用智能 pageData 选择 const validPageData = getValidPageData(); console.log('收藏 - 获取到的有效数据:', validPageData); if (!validPageData || !validPageData.fileId) { console.error('收藏失败:无效的文件数据', validPageData); showToast('文件信息异常,无法执行收藏操作'); return; } console.log('开始发送收藏请求,文件ID:', validPageData.fileId); fetch('/api/favorite', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ file_id: validPageData.fileId }) }) .then(response => { console.log('收藏API响应状态:', response.status); return response.json(); }) .then(data => { console.log('收藏API响应数据:', data); if (data.success) { const favoriteBtn = document.querySelector('.floating-btn.favorite-btn'); if (data.action === 'favorited') { favoriteBtn.classList.add('favorited'); favoriteBtn.innerHTML = '<i class="bi bi-bookmark-fill"></i>'; } else { favoriteBtn.classList.remove('favorited'); favoriteBtn.innerHTML = '<i class="bi bi-bookmark"></i>'; } showToast(data.message); } else { showToast('操作失败:' + data.message); } }) .catch(error => { console.error('收藏请求失败:', error); showToast('操作失败,请稍后重试'); }); } // 分享功能 function handleShare() { logClick('share_click'); // 添加点击动画效果 const shareBtn = document.querySelector('.floating-btn.share-btn'); shareBtn.style.transform = 'scale(0.9)'; setTimeout(() => { shareBtn.style.transform = ''; }, 150); // 显示分享浮层 const shareOverlay = document.getElementById('shareOverlay'); shareOverlay.style.display = 'flex'; document.body.style.overflow = 'hidden'; // 生成二维码 generateShareQRCode(); } // 关闭分享浮层 function closeShare() { const shareOverlay = document.getElementById('shareOverlay'); shareOverlay.style.display = 'none'; document.body.style.overflow = ''; } // 生成分享二维码 function generateShareQRCode() { const qrContainer = document.getElementById('shareQrCode'); if (!qrContainer) return; const currentUrl = window.location.href; const apiUrl = `/api/qrcode?content=${encodeURIComponent(currentUrl)}&type=url&size=200&margin=2`; fetch(apiUrl) .then(response => { if (!response.ok) { throw new Error(`网络请求失败: ${response.status}`); } return response.json(); }) .then(data => { if (data.success) { qrContainer.innerHTML = ` <div class="qr-code-image"> <img src="${data.data}" alt="分享二维码" id="qrCodeImage" style="width: 120px; height: 120px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);"> </div> `; } else { throw new Error(data.error || '二维码生成失败'); } }) .catch(error => { console.error('二维码生成失败:', error); qrContainer.innerHTML = ` <div class="qr-error text-center text-muted"> <i class="bi bi-exclamation-triangle me-1"></i> <small>二维码生成失败</small> </div> `; }); } // 分享到 X (Twitter) - 保持向后兼容性 function shareToTwitter() { const url = window.location.href; const title = document.title; const projectName = pageData.projectName || '工具'; // 构建分享文本:项目名称 + 链接 const shareText = `${projectName} - ${title}`; // 使用 X 的分享 URL(twitter.com 仍然有效,但品牌已更新为 X) const xUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}&url=${encodeURIComponent(url)}&via=IdoXu401`; // 添加分享动画效果 const xButton = document.querySelector('.share-btn.x-twitter'); if (xButton) { xButton.style.transform = 'scale(0.95)'; setTimeout(() => { xButton.style.transform = ''; }, 150); } // 打开分享窗口 const shareWindow = window.open(xUrl, '_blank', 'width=600,height=500,scrollbars=yes,resizable=yes'); // 记录分享行为 logClick('x_twitter_share'); // 关闭分享菜单 closeShare(); // 检查窗口是否成功打开 if (shareWindow) { // 添加分享成功提示 setTimeout(() => { showToast('正在打开 X 分享页面...'); }, 500); } else { showToast('请允许弹出窗口以分享到 X'); } } // 分享到微博 function shareToWeibo() { const url = window.location.href; const title = document.title; const weiboUrl = `https://service.weibo.com/share/share.php?url=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}`; window.open(weiboUrl, '_blank', 'width=600,height=400'); closeShare(); } // 分享到 GitHub function shareToGithub() { const url = window.location.href; const title = document.title; const projectName = pageData.projectName || '工具'; const shareText = `Check out this awesome tool: ${projectName} - ${title}`; const githubUrl = `https://github.com/new?description=${encodeURIComponent(shareText)}&filename=${encodeURIComponent(projectName)}.md`; window.open(githubUrl, '_blank', 'width=800,height=600'); closeShare(); } // 分享到 Reddit function shareToReddit() { const url = window.location.href; const title = document.title; const redditUrl = `https://reddit.com/submit?url=${encodeURIComponent(url)}&title=${encodeURIComponent(title)}`; window.open(redditUrl, '_blank', 'width=600,height=500'); closeShare(); } // 分享到 LinkedIn function shareToLinkedIn() { const url = window.location.href; const title = document.title; const linkedinUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`; window.open(linkedinUrl, '_blank', 'width=600,height=500'); closeShare(); } // 分享到 WhatsApp function shareToWhatsApp() { const url = window.location.href; const title = document.title; const projectName = pageData.projectName || '工具'; const shareText = `${projectName} - ${title}\n\n${url}`; const whatsappUrl = `https://wa.me/?text=${encodeURIComponent(shareText)}`; window.open(whatsappUrl, '_blank', 'width=400,height=600'); closeShare(); } // 分享到 Telegram function shareToTelegram() { const url = window.location.href; const title = document.title; const projectName = pageData.projectName || '工具'; const shareText = `${projectName} - ${title}\n\n${url}`; const telegramUrl = `https://t.me/share/url?url=${encodeURIComponent(url)}&text=${encodeURIComponent(shareText)}`; window.open(telegramUrl, '_blank', 'width=400,height=600'); closeShare(); } // 分享到微信 function shareToWeChat() { const url = window.location.href; const title = document.title; const projectName = pageData.projectName || '工具'; const shareText = `${projectName} - ${title}\n\n${url}`; // 微信分享需要特殊处理,这里提供复制链接的方式 if (navigator.clipboard && window.isSecureContext) { navigator.clipboard.writeText(shareText).then(() => { showToast('内容已复制到剪贴板,请打开微信粘贴分享'); closeShare(); }).catch(() => { fallbackCopyTextToClipboard(shareText); }); } else { fallbackCopyTextToClipboard(shareText); } } // 分享到QQ function shareToQQ() { const url = window.location.href; const title = document.title; const projectName = pageData.projectName || '工具'; const shareText = `${projectName} - ${title}`; const qqUrl = `https://connect.qq.com/widget/shareqq/index.html?url=${encodeURIComponent(url)}&title=${encodeURIComponent(shareText)}&summary=${encodeURIComponent(shareText)}`; window.open(qqUrl, '_blank', 'width=600,height=500'); closeShare(); } // 关闭分享菜单 function closeShareMenu() { const shareMenu = document.querySelector('div[style*="position: fixed"]'); if (shareMenu) { shareMenu.remove(); } } // 下载二维码 function downloadQRCode() { const qrImage = document.getElementById('qrCodeImage'); if (!qrImage) { showToast('二维码未生成'); return; } try { // 创建一个临时的canvas来下载图片 const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); canvas.width = qrImage.naturalWidth || 200; canvas.height = qrImage.naturalHeight || 200; // 绘制白色背景 ctx.fillStyle = '#ffffff'; ctx.fillRect(0, 0, canvas.width, canvas.height); // 绘制二维码 qrImage.onload = function() { ctx.drawImage(qrImage, 0, 0); // 创建下载链接 canvas.toBlob(function(blob) { const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; // 使用 DKFile-文件名 格式 const fileName = pageData.projectName || '工具'; a.download = `DKFile-${fileName}.png`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); showToast('二维码下载成功'); }, 'image/png'); }; // 如果图片已经加载完成 if (qrImage.complete) { qrImage.onload(); } } catch (error) { console.error('下载二维码失败:', error); showToast('下载失败,请重试'); } } // 反馈功能 function handleFeedback() { logClick('feedback_click'); // 添加点击动画效果 const feedbackBtn = document.querySelector('.floating-btn.feedback-btn'); feedbackBtn.style.transform = 'scale(0.9)'; setTimeout(() => { feedbackBtn.style.transform = ''; }, 150); // 显示反馈浮层 const feedbackOverlay = document.getElementById('feedbackOverlay'); feedbackOverlay.style.display = 'flex'; document.body.style.overflow = 'hidden'; } // 关闭反馈浮层 function closeFeedback() { const feedbackOverlay = document.getElementById('feedbackOverlay'); feedbackOverlay.style.display = 'none'; document.body.style.overflow = ''; } // 显示提示信息 function showToast(message) { const toast = document.createElement('div'); toast.style.cssText = ` position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.8); color: white; padding: 10px 20px; border-radius: 5px; z-index: 10001; font-size: 14px; `; toast.textContent = message; document.body.appendChild(toast); setTimeout(() => { toast.remove(); }, 3000); } // SEO 性能监控函数 function monitorSeoPerformance() { try { // 检查页面加载性能 const loadTime = performance.now(); const domContentLoaded = performance.getEntriesByType('navigation')[0]?.domContentLoadedEventEnd || 0; // 检查SEO元素完整性 const seoElements = { title: document.title, description: document.querySelector('meta[name="description"]')?.content || '', keywords: document.querySelector('meta[name="keywords"]')?.content || '', ogTitle: document.querySelector('meta[property="og:title"]')?.content || '', ogDescription: document.querySelector('meta[property="og:description"]')?.content || '', canonical: document.querySelector('link[rel="canonical"]')?.href || '', structuredData: document.querySelectorAll('script[type="application/ld+json"]').length }; // 记录SEO性能数据 const seoData = { load_time: Math.round(loadTime), dom_ready_time: Math.round(domContentLoaded), seo_completeness: Object.values(seoElements).filter(v => v && v !== '').length, total_seo_elements: Object.keys(seoElements).length, timestamp: new Date().toISOString() }; // 发送SEO性能数据到后端(已禁用) // const validPageData = getValidPageData(); // if (validPageData && validPageData.fileId) { // fetch('/api/log_seo_performance', { // method: 'POST', // headers: { 'Content-Type': 'application/json' }, // body: JSON.stringify({ // file_id: validPageData.fileId, // seo_data: seoData // }) // }).catch(error => console.debug('SEO performance logging failed:', error)); // } // 控制台输出SEO信息 console.log('🔍 SEO Performance:', seoData); console.log('📊 SEO Elements:', seoElements); } catch (error) { console.debug('SEO performance monitoring failed:', error); } } // 复制链接 function copyLink() { let url = window.location.href; url = url.replace('http://', 'https://'); const title = document.title; const textToCopy = `${title}\n${url}`; if (navigator.clipboard && window.isSecureContext) { // 使用现代 Clipboard API navigator.clipboard.writeText(textToCopy).then(() => { showToast('链接已复制到剪贴板'); closeShare(); }).catch(() => { fallbackCopyTextToClipboard(textToCopy); }); } else { // 备用方法 fallbackCopyTextToClipboard(textToCopy); } } // 备用复制方法 function fallbackCopyTextToClipboard(text) { const textArea = document.createElement('textarea'); textArea.value = text; textArea.style.position = 'fixed'; textArea.style.left = '-999999px'; textArea.style.top = '-999999px'; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { document.execCommand('copy'); showToast('链接已复制到剪贴板'); closeShare(); } catch (err) { showToast('复制失败,请手动复制链接'); } document.body.removeChild(textArea); } </script> <!-- 反馈浮层弹窗 --> <div id="feedbackOverlay" class="floating-overlay" onclick="if(event.target === this) closeFeedback()"> <div class="floating-panel"> <div class="floating-header"> <h5 class="floating-title"> <i class="bi bi-chat-dots me-2"></i>问题反馈 </h5> <button type="button" class="floating-close" onclick="closeFeedback()" aria-label="Close"> <i class="bi bi-x-lg"></i> </button> </div> <form id="feedbackForm" enctype="multipart/form-data"> <div class="floating-body"> <!-- 工具信息 --> <div class="feedback-tool-info"> <i class="bi bi-info-circle me-2"></i> <strong>反馈来源:</strong>qixi <br><small class="text-muted">工具链接:http://dkfile.com/smile2333/qixi.html</small> </div> <!-- 反馈类型 --> <div class="feedback-section"> <label class="feedback-label">反馈类型</label> <div class="feedback-type-grid"> <div class="feedback-type-item"> <input type="radio" class="feedback-type-input" name="feedback_type" id="feedback_bug" value="bug"> <label class="feedback-type-btn" for="feedback_bug"> 问题反馈 </label> </div> <div class="feedback-type-item"> <input type="radio" class="feedback-type-input" name="feedback_type" id="feedback_feature" value="feature"> <label class="feedback-type-btn" for="feedback_feature"> 功能建议/需求 </label> </div> <div class="feedback-type-item"> <input type="radio" class="feedback-type-input" name="feedback_type" id="feedback_support" value="technical_support"> <label class="feedback-type-btn" for="feedback_support"> 技术支持 </label> </div> <div class="feedback-type-item"> <input type="radio" class="feedback-type-input" name="feedback_type" id="feedback_business" value="business_cooperation"> <label class="feedback-type-btn" for="feedback_business"> 商务合作 </label> </div> <div class="feedback-type-item"> <input type="radio" class="feedback-type-input" name="feedback_type" id="feedback_other" value="other" checked> <label class="feedback-type-btn" for="feedback_other"> 其他 </label> </div> </div> </div> <!-- 反馈内容 --> <div class="feedback-section"> <label for="feedbackContent" class="feedback-label">反馈内容</label> <div class="feedback-textarea-wrapper"> <textarea class="feedback-textarea" id="feedbackContent" name="description" rows="6" placeholder="请详细描述您的问题或建议..." maxlength="1000" required></textarea> <div class="feedback-char-count" id="charCount">0/1000</div> </div> <div class="feedback-hint"> <i class="bi bi-info-circle me-1"></i>请尽可能详细地描述,这有助于我们更好地理解和解决问题 </div> <div class="feedback-notice"> <i class="bi bi-envelope me-1"></i> 问题解决后,会通过你的帐号邮箱给你回复,也能在 <a href="/my_feedbacks" class="feedback-link">我的反馈</a> 查看问题处理进度。 </div> </div> </div> <div class="floating-footer"> <button type="button" class="floating-btn-action floating-btn-secondary" onclick="closeFeedback()"> 取消 </button> <button type="submit" class="floating-btn-action floating-btn-primary" id="submitFeedback"> <i class="bi bi-send me-1"></i>提交反馈 </button> </div> </form> </div> </div> <!-- 分享浮层弹窗 --> <div id="shareOverlay" class="floating-overlay" onclick="if(event.target === this) closeShare()"> <div class="floating-panel"> <div class="share-menu"> <!-- 工具信息 --> <div class="share-info"> <div class="share-info-title"> <i class="bi bi-info-circle me-1"></i>分享内容 </div> <div class="share-info-content"> <strong>qixi</strong><br> <small>来自 DKFile 免费HTML网页托管平台</small> </div> </div> <!-- 二维码区域 --> <div class="qr-code-section mb-4"> <div id="shareQrCode" class="qr-code-container"> <div class="qr-loading"> <i class="bi bi-hourglass-split"></i> 生成二维码中... </div> </div> <!-- 分享操作按钮组 --> <div class="qr-actions"> <button class="qr-action-btn download-btn" onclick="downloadQRCode()"> <i class="bi bi-download me-1"></i> <span>下载二维码</span> </button> <button class="qr-action-btn copy-btn" onclick="copyLink()"> <i class="bi bi-link-45deg me-1"></i> <span>复制链接</span> </button> </div> </div> <!-- 分享渠道标题 --> <div class="share-channels-header"> <h6 class="share-channels-title"> <i class="bi bi-share me-2"></i>一键分享到这些平台 </h6> </div> <div class="share-buttons"> <!-- 主要社交平台 --> <button class="share-btn x-twitter" onclick="shareToTwitter()"> <!-- X (Twitter) 图标 - 使用黑色背景 --> <div class="x-icon-container"> <svg class="x-icon" width="18" height="18" viewBox="0 0 24 24" fill="white"> <path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/> </svg> </div> <span>X (Twitter)</span> </button> <!-- 中文平台 --> <button class="share-btn weibo" onclick="shareToWeibo()"> <i class="bi bi-weibo"></i> <span>微博</span> </button> <!-- 全球开发者平台 --> <button class="share-btn github" onclick="shareToGithub()"> <i class="bi bi-github"></i> <span>GitHub</span> </button> <button class="share-btn reddit" onclick="shareToReddit()"> <i class="bi bi-reddit"></i> <span>Reddit</span> </button> <!-- 专业平台 --> <button class="share-btn linkedin" onclick="shareToLinkedIn()"> <i class="bi bi-linkedin"></i> <span>LinkedIn</span> </button> <!-- 即时通讯 --> <button class="share-btn whatsapp" onclick="shareToWhatsApp()"> <i class="bi bi-whatsapp"></i> <span>WhatsApp</span> </button> <button class="share-btn telegram" onclick="shareToTelegram()"> <i class="bi bi-telegram"></i> <span>Telegram</span> </button> <!-- 国内平台 --> <button class="share-btn wechat" onclick="shareToWeChat()"> <i class="bi bi-wechat"></i> <span>微信</span> </button> <button class="share-btn qq" onclick="shareToQQ()"> <i class="bi bi-qq"></i> <span>QQ</span> </button> </div> <div class="share-divider"></div> <div class="share-close-section"> <button class="floating-btn-action floating-btn-secondary" onclick="closeShare()"> <i class="bi bi-x-lg me-1"></i>关闭 </button> </div> </div> </div> </div> <!-- Bootstrap JS --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <!-- 移除重复的 Google 服务加载器,因为 base.html 已经包含 --> <!-- <script src="/static/js/google-services-loader.js"></script> --> <script> // 字符计数功能 document.addEventListener('DOMContentLoaded', function() { const textarea = document.getElementById('feedbackContent'); const charCount = document.getElementById('charCount'); if (textarea && charCount) { textarea.addEventListener('input', function() { const length = this.value.length; charCount.textContent = length + '/1000'; if (length > 900) { charCount.style.color = '#dc3545'; } else if (length > 800) { charCount.style.color = '#ffc107'; } else { charCount.style.color = '#999'; } }); } }); // 反馈表单提交 document.getElementById('feedbackForm').addEventListener('submit', function(e) { e.preventDefault(); const submitBtn = document.getElementById('submitFeedback'); const originalText = submitBtn.innerHTML; const formData = new FormData(this); // 添加工具信息 formData.append('tool_url', 'http://dkfile.com/smile2333/qixi.html'); formData.append('tool_title', 'qixi'); formData.append('tool_id', '8874'); // 显示提交中状态 submitBtn.disabled = true; submitBtn.innerHTML = '<i class="bi bi-hourglass-split me-1"></i>提交中...'; fetch('/submit_feedback', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { showToast('反馈提交成功!我们会尽快处理您的反馈。'); // 关闭浮层 closeFeedback(); // 重置表单 this.reset(); document.getElementById('charCount').textContent = '0/1000'; } else { showToast('提交失败:' + (data.message || '未知错误')); } }) .catch(error => { console.error('Error:', error); showToast('提交失败,请检查网络连接后重试'); }) .finally(() => { // 恢复按钮状态 submitBtn.disabled = false; submitBtn.innerHTML = originalText; }); }); </script> </body> </html>