您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动重定向被微信/知乎拦截的链接
- // ==UserScript==
- // @name Fuck Wechat or zhihu
- // @namespace http://tampermonkey.net/
- // @version 1.1
- // @description 自动重定向被微信/知乎拦截的链接
- // @author zheng-kun@foxmail.com
- // @match *://weixin110.qq.com/*
- // @match *://link.zhihu.com/*
- // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- //setTimeout(redirect, 1000)
- redirect()
- function getUrl(){
- const targetEl2 = document.querySelector(".weui-msg__desc")
- const targetEl = document.querySelector(".weui-msg .weui-msg__text-area .ui-ellpisis-content p");
- const zhihuLinkEl = document.querySelector(".link")
- const targetText = targetEl?.innerText
- const targetText2 = targetEl2?.innerText
- const zhihuTargetText = zhihuLinkEl?.innerText
- const urlReg = /^(http:|https:)/img;
- if(urlReg.test(targetText)) {
- return targetText
- }else if(urlReg.test(targetText2)) {
- return targetText2
- }else if(urlReg.test(zhihuTargetText)){
- return zhihuTargetText
- }
- return null;
- }
- function redirect() {
- const url = getUrl()
- if(url) { window.location.href = url }
- }
- })();