Chrome插件英雄榜085《nonstop》无感跳转到知乎,微博,简书,qq 邮箱等无法直接跳转的外链
title: Chrome插件英雄榜085《nonstop》无感跳转到知乎,微博,简书,qq 邮箱等无法直接跳转的外链
nonstop国内下载链接
https://zhaoolee.lanzoux.com/b00nnabad
获取安装包后,解压安装即可
演示图
nonstop开源
开源地址: https://github.com/yuxiaoy1/nonstop
核心代码就只有不到30行,非常安全透明,无需担心信息泄露(支持关闭知乎登录界面, 知乎, 微博, QQ邮箱, 简书链接自动重定向)
(function() {
'use strict'
let href = window.location.href
if (href.indexOf('www.zhihu.com/question/') != -1) {
// 关闭知乎登录页面
window.onload = () => {
let btn = document.querySelector('.Button.Modal-closeButton.Button--plain')
if (btn) btn.click()
return
}
}
// 知乎, 微博, QQ邮箱, 简书链接自动重定向
let link = document.querySelector('.link') || document.querySelector('.safety-url')
let url = link ? link.textContent : ''
if (url) {
window.location.href = url
return
}
// redirect for jianshu site
let getParams = field => {
let urlObject = new URL(href)
let res = urlObject.searchParams.get(field)
return res
}
url = getParams('url')
if (url) window.location.href = url
})()
看到一则留言
我在 https://www.v2fy.com/p/085-nonstop-2020-12-15/ 看到留言,有的小伙伴,希望推出油猴版本, 于是我稍微改了一下.
油猴版本
如果不知什么是油猴可以来这里: https://www.v2fy.com/p/004_tampermonkey/
// ==UserScript==
// @name nonstop
// @namespace http://tampermonkey.net/
// @include *://*.zhihu.com/*
// @include *://*.jianshu.com/*
// @include *://*.weibo.com/*
// @include *://*.t.cn.com/*
// @include *://*.qq.com/*
// @version 0.1
// @description try to take over the world!
// @author zhaoolee
// @match http://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
let href = window.location.href
if (href.indexOf('www.zhihu.com/question/') != -1) {
// 关闭知乎登录页面
window.onload = () => {
let btn = document.querySelector('.Button.Modal-closeButton.Button--plain')
if (btn) btn.click()
return
}
}
// 知乎, 微博, QQ邮箱, 简书链接自动重定向
let link = document.querySelector('.link') || document.querySelector('.safety-url')
let url = link ? link.textContent : ''
if (url) {
window.location.href = url
return
}
// redirect for jianshu site
let getParams = field => {
let urlObject = new URL(href)
let res = urlObject.searchParams.get(field)
return res
}
url = getParams('url')
if (url) window.location.href = url
// Your code here...
})();
使用方法
在油猴新建脚本,粘贴以上代码, Ctrl+s
保存代码即可
无感跳转js代码改造为油猴脚本方法解密
《nonstop》下载地址
https://github.com/yuxiaoy1/nonstop
小结
外链无法直接跳转的设置,设计之初只是为了避免用户进入垃圾网站, 但随着各平台审核力度的增大, 已经很少能看到垃圾网站链接了, 而跳转确认页面反而影响了用户体验.
nonstop 用不到30行代码解决了用户跳转确认的问题, 是极其优秀的小工具.
两行就可以搞定…油猴匹配外链中转页面地址, 然后直接拿跳转地址就可以了 https://greasyfork.org/zh-CN/scripts/423035-外链跳转
我觉得这个写成插件没有必要,30多行的代码,为什么不内置到Greasy fork上去,装在tempmonkey上呢,然后在可用站点激活??
话说我找到greasy fork上有了啊
https://greasyfork.org/zh-CN/scripts?set=323929
这个就是
已提供Tampermonkey油猴版本 https://www.v2fy.com/p/085-nonstop-2020-12-15/
谢谢,我找到油猴版了。