Last active
February 10, 2022 02:57
-
-
Save yuchen/c2222e5a833d4e58434e2fab7bb92f23 to your computer and use it in GitHub Desktop.
[Userscript合集] 老鱼 UserScript 合集(有些自己写的,有些抄别人的自用) #tampermonkey #userscript #chrome #firefox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name clark_ban_jumper | |
// @icon https://pic3.zhimg.com/7cbdec71eea51ba2e78251e3b4145717_is.jpg | |
// @version 0.0.1 | |
// @namespace https://gist.github.com/yuchen | |
// @description 遇到屏蔽时自动跳转 | |
// @author yuchen | |
// downloadURL https://gist.github.com/yuchen/c2222e5a833d4e58434e2fab7bb92f23/raw/326032e7d44b00fb3f01852f07799c993e0f0c74/ban_jumper.user.js | |
// updateURL https://gist.github.com/yuchen/c2222e5a833d4e58434e2fab7bb92f23/raw/326032e7d44b00fb3f01852f07799c993e0f0c74/ban_jumper.user.js | |
// | |
// include * | |
// @match *://weixin110.qq.com/* | |
// @match *://link.juejin.cn/* | |
// @match *://link.csdn.net/* | |
// @match *://link.zhihu.com/* | |
// @match *://www.oschina.net/action/* | |
// | |
// @require https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js | |
// //require https://cdn.bootcss.com/vue/2.6.11/vue.min.js | |
// @grant GM.notification | |
// @grant GM.openInTab | |
// @grant GM.setClipboard | |
// | |
// @run-at document-end | |
// ==/UserScript== | |
// GM.openInTab('https://www.google.com'); | |
// GM.setClipboard('Hello World'); | |
// GM.notification({text: 'This is a text', title: 'Notification 2', onclick: () => console.log('NotificationClick') }); | |
const config = { | |
'weixin110.qq.com' : function() { | |
let ele = document.querySelector('p.weui-msg__desc'); | |
if (ele) { | |
location.replace( ele.textContent ); | |
} else { | |
console.log('❌ cannot locate element'); | |
} | |
}, | |
'link.juejin.cn' : function() { | |
let ele = document.querySelector('div.link-content p'); | |
if (ele) { | |
location.replace( ele.textContent ); | |
} else { | |
console.log('❌ cannot locate element'); | |
} | |
}, | |
'link.csdn.net' : function() { | |
let ele = document.querySelector('a.loading-color2'); | |
if (ele) { | |
location.replace( ele.textContent ); | |
} else { | |
console.log('❌ cannot locate element'); | |
} | |
}, | |
'link.zhihu.com' : function() { | |
let ele = document.querySelector('a.button'); | |
if (ele) { | |
location.replace( ele.href ); | |
} else { | |
console.log('❌ cannot locate element'); | |
} | |
}, | |
'www.oschina.net' : function() { | |
if (location.pathname == '/action/GoToLink') { | |
let ele = document.querySelector('a.link-button'); | |
if (ele) { | |
location.replace( ele.href ); | |
} else { | |
console.log('❌ cannot locate element @' + location.hostname); | |
} | |
} else { | |
console.log('❌ not goto page @' + location.hostname); | |
} | |
} | |
}; | |
const host = location.host; | |
if (config[host]) { | |
var callback = config[host]; | |
setTimeout(function() { | |
callback(); | |
}, 1000); | |
} else { | |
console.log('😯 have a good day.'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name clark_drive | |
// @icon https://pic3.zhimg.com/7cbdec71eea51ba2e78251e3b4145717_is.jpg | |
// @version 0.0.1 | |
// @namespace https://gist.github.com/yuchen | |
// @description 遇到屏蔽时自动跳转 | |
// @author yuchen | |
// //downloadURL https://gist.github.com/yuchen/c2222e5a833d4e58434e2fab7bb92f23/raw/326032e7d44b00fb3f01852f07799c993e0f0c74/ban_jumper.user.js | |
// //updateURL https://gist.github.com/yuchen/c2222e5a833d4e58434e2fab7bb92f23/raw/326032e7d44b00fb3f01852f07799c993e0f0c74/ban_jumper.user.js | |
// | |
// include * | |
// @match *://www.aliyundrive.com/* | |
// | |
// @require https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js | |
// //require https://cdn.bootcss.com/vue/2.6.11/vue.min.js | |
// @grant GM.notification | |
// @grant GM.openInTab | |
// @grant GM.setClipboard | |
// @grant GM.setValue | |
// @grant GM.getValue | |
// | |
// @run-at document-end | |
// ==/UserScript== | |
// GM.openInTab('https://www.google.com'); | |
// GM.setClipboard('Hello World'); | |
// GM.notification({text: 'This is a text', title: 'Notification 2', onclick: () => console.log('NotificationClick') }); | |
(function () { | |
'use strict'; | |
// based on https://gist.github.com/mynameislau/b7eabfcdc0a17ac41cdc0b974f94d807 | |
const ignores = [ | |
'test' | |
]; | |
Object.defineProperty(window, 'localStorage', { | |
configurable: true, | |
enumerable: true, | |
value: new Proxy(localStorage, { | |
set: function (ls, prop, value) { | |
if (ignores.indexOf(prop) === -1) { | |
//console.error(`LS direct assignment of ${prop}`); | |
debugger; | |
} | |
ls[prop] = value; | |
return true; | |
}, | |
get: function (ls, prop) { | |
if (prop !== 'setItem') { | |
if (typeof ls[prop] === 'function') { | |
return ls[prop].bind(ls); | |
} else { | |
return ls[prop]; | |
} | |
} | |
return (...args) => { | |
const key = args[0]; | |
if (ignores.indexOf(key) === -1) { | |
//console.error(`LS setItem(${key})`); | |
debugger; | |
} | |
ls.setItem.apply(ls, args); | |
}; | |
}, | |
}), | |
}); | |
})(); | |
var finded = false; | |
if (typeof localStorage.token !== 'undefined') { | |
var token = JSON.parse(localStorage.token); | |
if ((typeof token == 'object') && (typeof token.refresh_token !== 'undefined')) { | |
finded = token.refresh_token; | |
} | |
} | |
console.log(finded ? `✅ ${finded}` : '❌ 获取 refresh_token 失败'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment