自动链接跳转
// ==UserScript==
// @name 自动链接跳转
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author 李恒道
// @match http://link.zhihu.com/?target=*
// @match https://link.csdn.net/?target=*
// @match https://www.jianshu.com/go-wild*
// @match https://link.juejin.cn/?target=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=zhihu.com
// @grant none
// @require https://scriptcat.org/lib/513/1.2.0/ElementGetter.js
// ==/UserScript==
let elmGetter = null
function find_button_click(match_str,btn_inner_text,is_getter=true){
if(is_getter){
if(!elmGetter){
elmGetter = new ElementGetter();
}
elmGetter.get(match_str,undefined,3000).then(dom => {
if(dom.innerHTML===btn_inner_text){
dom.click()
}
});
}else{
let list= document.querySelectorAll(match_str)
for(let index=0;index<list.length;index++){
const dom=list[index]
if(dom.innerHTML===btn_inner_text){
console.log('dom',dom)
debugger;
dom.click()
break;
}
}
}
}
if(location.href.indexOf('zhihu.com')!==-1){
find_button_click('.button','继续访问')
}
if(location.href.indexOf('link.csdn.net')!==-1){
find_button_click('.loading-btn','继续')
}
if(location.href.indexOf('www.jianshu.com')!==-1){
find_button_click('div','继续前往',false)
}
if(location.href.indexOf('link.juejin.cn')!==-1){
find_button_click('.btn','继续访问')
}