// ==UserScript== // @name 网站健康检测助手 // @namespace https://x.aixgn.cn/ // @version 1.1.0 // @description 一键检测网站健康状况,包括CSS样式、JavaScript错误、SEO优化、安全漏洞、性能问题等。免费诊断,生成详细检测报告。 // @author 网站健康检测 // @match http://*/* // @match https://*/* // @grant GM_xmlhttpRequest // @grant GM_addStyle // @connect x.aixgn.cn // @run-at document-idle // ==/UserScript== (function() { 'use strict'; // 隐私声明:仅发送URL进行检测,不收集任何个人信息 if (window.__health_check_injected) return; window.__health_check_injected = true; // 创建悬浮按钮 var btn = document.createElement('div'); btn.innerHTML = '🔍 检测'; btn.style.cssText = 'position:fixed;bottom:80px;right:20px;z-index:2147483647;background:linear-gradient(135deg,#3b82f6,#60a5fa);color:#fff;padding:10px 18px;border-radius:25px;cursor:pointer;font-size:13px;font-weight:bold;box-shadow:0 4px 15px rgba(59,130,246,.4);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;user-select:none;'; document.body.appendChild(btn); // 创建结果面板 var panel = document.createElement('div'); panel.style.cssText = 'position:fixed;bottom:130px;right:20px;z-index:2147483647;width:340px;background:#fff;border-radius:12px;box-shadow:0 8px 30px rgba(0,0,0,.15);padding:16px;display:none;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;font-size:13px;max-height:450px;overflow-y:auto;border:1px solid #e5e7eb;'; document.body.appendChild(panel); // 按钮点击事件 btn.onclick = function() { if (panel.style.display === 'none') { panel.style.display = 'block'; panel.innerHTML = '
🔍
正在检测网站健康状况...
仅发送URL进行分析,不收集个人信息
'; scanSite(); } else { panel.style.display = 'none'; } }; // 检测函数 function scanSite() { var url = location.href; GM_xmlhttpRequest({ method: 'POST', url: 'https://x.aixgn.cn/xrepair/scan', headers: {'Content-Type': 'application/json'}, data: JSON.stringify({url: url}), timeout: 30000, onload: function(res) { try { var data = JSON.parse(res.responseText); var issues = data.issues || []; var score = data.health_score || data.score || '-'; var html = '
📊 网站健康检测报告
'; html += '
'; html += '
' + score + '分
'; html += '
健康评分
'; var high = issues.filter(function(i){return i.severity==='high';}).length; var medium = issues.filter(function(i){return i.severity==='medium';}).length; var low = issues.filter(function(i){return i.severity==='low';}).length; html += '
'; html += '
' + high + '
严重
'; html += '
' + medium + '
中等
'; html += '
' + low + '
轻微
'; html += '
检测到 ' + issues.length + ' 个问题:
'; issues.slice(0, 10).forEach(function(i) { var color = i.severity === 'high' ? '#ef4444' : i.severity === 'medium' ? '#f59e0b' : '#10b981'; var label = i.severity === 'high' ? '严重' : i.severity === 'medium' ? '中等' : '轻微'; html += '
'; html += '' + label + ' '; html += (i.type || i.category || '未知问题') + '
'; }); if (issues.length > 10) { html += '
还有 ' + (issues.length - 10) + ' 个问题...
'; } html += '查看完整检测报告'; html += '
🔒 仅发送URL检测,不收集个人信息
'; panel.innerHTML = html; } catch(e) { panel.innerHTML = '
检测失败,请稍后重试
'; } }, onerror: function() { panel.innerHTML = '
网络错误,请检查网络连接
'; }, ontimeout: function() { panel.innerHTML = '
检测超时,请稍后重试
'; } }); } })();