96SEO 2026-07-24 10:48 5
安装脚本后打开工时管理程序。你会看到:
现代网页应用通常通过 XMLHttpRequest 或 Fetch API 与服务器通信。主要思路是"劫持"这些原生方法,在数据返回时插入自定义逻辑。
// 保存原始方法
const originalXhrOpen = XMLHttpRequest.prototype.open;按理说,const originalXhrSend = XMLHttpRequest.prototype.send;// 重写 open 方法,记录请求的 URL
XMLHttpRequest.prototype.open = function {
this._url = url;// 保存 URL 供后续判断
this._method = method;return originalXhrOpen.apply;},// 重写 send 方法,监听特定接口的响应
XMLHttpRequest.prototype.send = function {
if ) {
this.addEventListener {
const response = this.responseText;const data = JSON.parse;if {
localStorage.setItem);console.log,}
});}
return originalXhrSend.apply;},
const originalFetch = window.fetch;window.fetch = function {
const url = typeof input === 'string'?input : input.url;return originalFetch.apply.n(response => {
if ) {
const clonedResponse = response.clone;// 必须克隆,否则原响应会被消费
clonedResponse.json.n(data => {
if {
capturedData = data.data;console.log,}
});}
return response;// 保持页面正常逻辑
});},
捕获到的是日历形式的原始数据,需要完成以下步骤:
function getCurrentWeekDates {
const today = new Date;const dayOfWeek = today.getDay;话说回来,// 0=周日1=周一...
const mondayOffset = dayOfWeek === 0?-6 : 1 - dayOfWeek;const dates =;for { // 周一到周五
const date = new Date;date.setDate + mondayOffset + i);dates.push),// YYYY-MM-DD
}
return dates;}
function formatDate {
const year = date.getFullYear;const month = String + 1).padStart;const day = String).padStart;return `${year}-${month}-${day}`;}
function processData {
const weekDates = getCurrentWeekDates;const projectMap = new Map;weekDates.forEach(dateStr => {
const dayData = data.find;if {
dayData.list.forEach(item => {
const projectName = item.projectShortName || '其他';老实说,const content = item.remark || '';if {
if ) {
projectMap.set;说起来,}
projectMap.get.push;}
}),}
});let result = '';说起来,let index = 1;说起来,projectMap.forEach => {
const mergedContent = contents.join;result += `${numberToChinese}、${projectName}:${mergedContent}
`;index++,});话说回来,return result.trim;}
function numberToChinese { /* 简单数字转中文示例 */ return;}
const OLLAMA_URL = 'http://localhost:11434/api/generate';const MODEL_NAME = 'qwen2:3b';// 示例模型名称
const TEMPERATURE = 0.2;const MAX_TOKENS = 1024;
async function summarizeWithAI {
const prompt =
`请将以下本周工作内容进行智能要求:
- 按项目维度汇总工作内容;- 合并相似工作项,- 提炼关键成果;- 使用简洁、专业的语言;
原始工作内容:
${content}
请输出后的工作内容:`;return new Promise => {
GM_xmlhttpRequest({
至于method,'POST',url: OLLAMA_URL,headers: { 'Content-Type': 'application/json' },data: JSON.stringify({
model这方面。MODEL_NAME,prompt: prompt,stream: false,options: { temperature: TEMPERATURE,max_tokens: MAX_TOKENS }
}),onload {
try {
const result = JSON.parse;resolve,} catch { reject;}
},onerror { reject;},timeout: 120000 // 本地模型可能耗时较长
});}),说起来,}
function createButtonPanel {
const panel = document.createElement;说起来,panel.id ='tm-button-panel';panel.style.cssText =
`position:fixed;bottom:10px,right:10px;怎么说呢,z-index:9999;其实,display:flex;flex-direction:column;gap:8px,`;// 查看原始工时按钮
const viewBtn = document.createElement;viewBtn.innerText='📋 查看本周工时';viewBtn.style.cssText=getButtonStyle;话说回来,viewBtn.onclick==>{
const txt=localStorage.getItem||'暂无数据';showDataModal;},// AI 智能按钮
const aiBtn=document.createElement;aiBtn.innerText='🤖 AI 智能';aiBtn.style.cssText=getButtonStyle;aiBtn.onclick=async=>{
showLoadingModal;try{
const raw=localStorage.getItem||'';老实说,const summary=await summarizeWithAI;closeLoadingModal;showDataModal;}catch{
closeLoadingModal;showNotification;}
},panel.appendChild;panel.appendChild;document.body.appendChild;}
function getButtonStyle{
return `padding:10px 16px;background:linear-gradient(135deg。${
color1},${color2});color:#fff,border:none;border-radius:8px;cursor:pointer;font-size:13px;其实,font-weight:bold;box-shadow:
0 4px 12px rgba;transition:.3s ease;`,}
function showDataModal{
// 简易实现,仅演示结构
alert;}
function showLoadingModal{ /* 可自行实现 loading UI */ }
function closeLoadingModal{ /* 隐藏 loading UI */ }
function showNotification{
console;}
If you need AI summarization:
# ollama run qwen2:3b | 步骤 | 操作 | 效果 | ||
|---|---|---|---|---|
| 1️⃣ | 登录工时程序 | 脚本自动在后台捕获数据 | ||
| 2️⃣ | 点击 “📋 查看本周工时” | 弹出原始数据窗口 | ||
| 3️⃣ | 点击 “📝 复制到剪贴板” | 内容已复制,可直接粘贴至周报文档 | ||
| 技术点 | "?">实现方式 | "?">价值 | "?
|---|---|---|
| 接口拦截 | "?">重写 XHR / Fetch 原型方法,无侵入式获取后端返回 | "?">无需后端改造即可获取所需数据 | "?"
| 数据持久化 | "?">利用 localStorage 缓存,中断刷新不丢失 | "?">支持延迟查看与二次处理 | "?"
| AI 集成 | "?">Ollama 本地大模型调用,本机运行无网络泄露风险 | "?">提高报告质量同时保障隐私 "?" |
| GM_xmlhttpRequest 油猴特权 API 突破 CORS 限制 | 使用较稳定获取外部服务结果 | " |
| 纯原生 DOM + CSS 体积小、加载快 | 兼容性好、不冲突 | " |
作为专业的SEO优化服务提供商,我们致力于通过科学、系统的搜索引擎优化策略,帮助企业在百度、Google等搜索引擎中获得更高的排名和流量。我们的服务涵盖网站结构优化、内容优化、技术SEO和链接建设等多个维度。
| 服务项目 | 基础套餐 | 标准套餐 | 高级定制 |
|---|---|---|---|
| 关键词优化数量 | 10-20个核心词 | 30-50个核心词+长尾词 | 80-150个全方位覆盖 |
| 内容优化 | 基础页面优化 | 全站内容优化+每月5篇原创 | 个性化内容策略+每月15篇原创 |
| 技术SEO | 基本技术检查 | 全面技术优化+移动适配 | 深度技术重构+性能优化 |
| 外链建设 | 每月5-10条 | 每月20-30条高质量外链 | 每月50+条多渠道外链 |
| 数据报告 | 月度基础报告 | 双周详细报告+分析 | 每周深度报告+策略调整 |
| 效果保障 | 3-6个月见效 | 2-4个月见效 | 1-3个月快速见效 |
我们的SEO优化服务遵循科学严谨的流程,确保每一步都基于数据分析和行业最佳实践:
全面检测网站技术问题、内容质量、竞争对手情况,制定个性化优化方案。
基于用户搜索意图和商业目标,制定全面的关键词矩阵和布局策略。
解决网站技术问题,优化网站结构,提升页面速度和移动端体验。
创作高质量原创内容,优化现有页面,建立内容更新机制。
获取高质量外部链接,建立品牌在线影响力,提升网站权威度。
持续监控排名、流量和转化数据,根据效果调整优化策略。
基于我们服务的客户数据统计,平均优化效果如下:
我们坚信,真正的SEO优化不仅仅是追求排名,而是通过提供优质内容、优化用户体验、建立网站权威,最终实现可持续的业务增长。我们的目标是与客户建立长期合作关系,共同成长。
Demand feedback