您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
1.电脑QQ网页拦截 2.电脑语雀/腾讯文档/知乎的网页风险 3.手机京东淘宝天猫链接转为电脑网页链接。
// ==UserScript== // @name 【电脑打开原网页】QQ/语雀/腾讯文档/京东/淘宝/天猫/知乎.避免中间页的审核拦截风险 // @namespace http://tampermonkey.net/ // @version 1.0.3 // @description 1.电脑QQ网页拦截 2.电脑语雀/腾讯文档/知乎的网页风险 3.手机京东淘宝天猫链接转为电脑网页链接。 // @author yezi_jinn // @match *://c.pc.qq.com/* // @match *://item.m.jd.com/product/*.html* // @match *://item.taobao.com/item.htm* // @match *://detail.tmall.com/item.htm* // @match *://www.yuque.com/r/goto* // @match *://docs.qq.com/scenario/link.html* // @match *://link.zhihu.com/?target=* // @grant none // @run-at document-start // @license MIT // ==/UserScript== (function() { 'use strict'; // 通用函数:快速获取URL参数 const getUrlParam = (name, url = location.href) => { const nameEq = name + '='; const queryStart = url.indexOf('?'); if (queryStart === -1) return null; const params = url.slice(queryStart + 1).split('&'); for (let i = 0; i < params.length; i++) { const pair = params[i]; if (pair.startsWith(nameEq)) { return pair.slice(nameEq.length); } } return null; }; // 主处理函数 const processUrl = () => { const { hostname, pathname, search, href } = location; // 1. 处理QQ安全拦截页 if (hostname === 'c.pc.qq.com') { const urlParamNames = ['url', 'pfurl', 'redirectUrl']; for (const name of urlParamNames) { const originalUrl = getUrlParam(name); if (!originalUrl) continue; try { const decodedUrl = decodeURIComponent(originalUrl); if (/^https?:\/\//i.test(decodedUrl)) { window.stop(); location.replace(decodedUrl); return; } } catch(e) {/* 忽略解析错误 */} } return; } // 2. 处理语雀风险提示页 if (hostname === 'www.yuque.com' && pathname.startsWith('/r/goto')) { const encodedUrl = getUrlParam('url'); if (!encodedUrl) return; try { const decodedUrl = decodeURIComponent(encodedUrl); if (/^https?:\/\//i.test(decodedUrl)) { window.stop(); location.replace(decodedUrl); } } catch(e) {/* 忽略解析错误 */} return; } // 3. 处理腾讯文档中转页 if (hostname === 'docs.qq.com' && pathname === '/scenario/link.html') { const encodedUrl = getUrlParam('url'); if (!encodedUrl) return; try { const decodedUrl = decodeURIComponent(encodedUrl); if (/^https?:\/\//i.test(decodedUrl)) { window.stop(); location.replace(decodedUrl); } } catch(e) {/* 忽略解析错误 */} return; } // 4. 处理知乎中转页 if (hostname === 'link.zhihu.com' && getUrlParam('target')) { const encodedUrl = getUrlParam('target'); if (!encodedUrl) return; try { const decodedUrl = decodeURIComponent(encodedUrl); if (/^https?:\/\//i.test(decodedUrl)) { window.stop(); location.replace(decodedUrl); } } catch(e) {/* 忽略解析错误 */} return; } // 5. 处理电商平台手机页面 // 京东处理 if (hostname === 'item.m.jd.com') { const idMatch = pathname.match(/\/(\d+)\.html/); if (idMatch && idMatch[1]) { window.stop(); location.replace(`https://item.jd.com/${idMatch[1]}.html`); } return; } // 淘宝/天猫处理 if (hostname.includes('taobao.com') || hostname.includes('tmall.com')) { // 检查是否已经是简洁链接 if (search.split('&').length <= 2 && /[?&]id=\d+/.test(search)) { return; } const idParam = getUrlParam('id') || getUrlParam('item_id'); if (idParam && /^\d+$/.test(idParam)) { window.stop(); location.replace(hostname.includes('tmall') ? `https://detail.tmall.com/item.htm?id=${idParam}` : `https://item.taobao.com/item.htm?id=${idParam}` ); } } }; // 立即执行 try { processUrl(); } catch (e) { console.error('链接优化脚本错误:', e); } })();