// ==UserScript== // @name 自动跳转以下各类外链跳转页到目的地址 // @description 自动跳转以下各类外链跳转页到目的地址,包括 QQ、微信所谓“非官方页面”等 // @author AnnAngela // @version 1.0.0 // @namespace https://greasyfork.org/users/129402 // @match http://c.pc.qq.com/* // @match https://c.pc.qq.com/* // @match http://docs.qq.com/scenario/link.html* // @match https://docs.qq.com/scenario/link.html* // @match http://afdian.net/link* // @match https://afdian.net/link* // @match http://*.afdian.net/link* // @match https://*.afdian.net/link* // @match http://weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi* // @match https://weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi* // @match http://t.cn/* // @match https://t.cn/* // @run-at document-end // @license GNU General Public License v3.0 or later // @downloadURL none // ==/UserScript== "use strict"; const url = new URL(location.href); if (location.href.includes("c.pc.qq.com/middle.html") || location.href.includes("c.pc.qq.com/middlem.html") || location.href.includes("c.pc.qq.com/index.html")) { location.replace(url.searchParams.get("pfurl")); } if (location.href.includes("docs.qq.com/scenario/link.html")) { location.replace(url.searchParams.get("url")); } if (location.href.includes("afdian.net/link")) { location.replace(url.searchParams.get("target")); } if (location.href.includes("weixin110.qq.com/cgi-bin/mmspamsupport-bin/newredirectconfirmcgi")) { let flag = false; setInterval(() => { if (!flag && "url" in (unsafeWindow.cgiData || {})) { flag = true; location.replace(new DOMParser().parseFromString(unsafeWindow.cgiData.url, "text/html").documentElement.textContent); } }, 100); } if (location.href.includes("t.cn/")) { let flag = false; setInterval(() => { const url_view_code = unsafeWindow.document.querySelector(".url_view_code"); if (!flag && url_view_code) { try { const url = new URL(url_view_code.innerText); flag = true; location.replace(url); } catch (e) { //a } } }, 100); }