Compatible with Tampermonkey syntax and functions:

@name
@version
@author
@description
@include
@match
@exclude
@require
@run-at

@run-at设置为main-thread时,脚本将在独立环境运行,拥有更好的稳定性和兼容性.但是此时无法直接使用DOM接口,你可以使用原生OCR接口/模拟点击/模拟滑动等原生接口.

GM_setValue(name, value)
GM_getValue(name, defaultValue)
GM_deleteValue(name)
GM_log(message)

使用介绍

自由添加您的自定义脚本,

编辑您的自定义脚本,

网址匹配支持通配符 '*' 和 '?'.

支持引入自定义Jquery等第三方库。

使用中的问题请反馈给我,邮箱contact@geekapp.cn,后续我将不断完善。

常见问题

原生接口

使用以下原生接口,请确认已经更新到最新版本。

使用过程中遇到问题或bug可以反馈给我,谢谢!





示例代码/Example:

First script: Hello World
// ==UserScript== // @name Hello World // @version 0.1 // @description My First script // @author Your Name // @match * // @exclude *login* // @run-at document-idle // @grant none // ==/UserScript== (function() { 'use strict'; //input your code console.log('Hello World'); alert('Hello World'); })();


OCR示例油管自动点击跳过广告/YouTube Skip Ad
// ==UserScript== // @name 油管自动点击跳过广告/YouTube OCR Skip Ad // @version 0.1 // @description 示例代码 // @author Your Name // @match https://*.youtube.com/* // @run-at main-thread // @grant none // ==/UserScript== (function(){ 'use strict'; window.G_findOcrTextCallback=function(data){ console.log('orc text size:'+data.length); for(var row of data) { console.log('text: '+row.text); var text = row.text.toLowerCase(); if(text.indexOf('跳过广告')>=0){ geekapp.click(row.x, row.y); }else if(text.indexOf('skip')>=0){ geekapp.click(row.x, row.y); } } }; function handle(){ geekapp.findOcrText(0.5,0,0.5,0.5); clearTimeout(timer); timer = setTimeout(handle, 2000); } var timer = setTimeout(handle, 2000); })();


OCR文本识别/OCR Text Recognition
// ==UserScript== // @name OCR文本识别/OCR Text Recognition // @version 0.1 // @description 示例代码 // @author Your Name // @match * // @exclude *login* // @run-at document-idle // @grant none // ==/UserScript== (function(){ 'use strict'; window.G_findOcrTextCallback=function(data){ console.log('orc text size:'+data.length); for(var row of data) { console.log('text: '+row.text); //click text var text = row.text.toLowerCase(); if(text.indexOf('前往')>=0){ geekapp.click(row.x, row.y); }else if(text.indexOf('go')>=0){ geekapp.click(row.x, row.y); } } }; setTimeout(function(){ /*@param left 查找范围左上角横坐标 * @param top 查找范围左上角纵坐标 * @param width 查找范围宽 * @param height 查找范围高 */ geekapp.findOcrText(0,0,1,0.5); }, 2000); })();


色值查找/Color Value Lookup
// ==UserScript== // @name 色值查找/Color Value Lookup // @version 0.1 // @description 示例代码 // @author Your Name // @match * // @exclude *login* // @grant none // ==/UserScript== (function(){ 'use strict'; window.G_findColorCallback=function(data){ console.log('color x='+data.x+',y='+data.y); }; setTimeout(function(){ /*@param color rgb颜色值 * @param offset 色值误差范围 * @param x_step 横向步进 * @param y_step 纵向步进 * @param left 查找范围左上角横坐标 * @param top 查找范围左上角纵坐标 * @param width 查找范围宽 * @param height 查找范围高 */ geekapp.findColor('#ffffff', 5, 3, 3, 0, 0, 1, 1); }, 2000); })();


模拟上滑手势/Simulate up slide gesture
// ==UserScript== // @name Simulate up slide gesture // @version 0.1 // @description 模拟手势上滑操作 // @author Your Name // @match * // @exclude *login* // @run-at document-idle // @grant none // ==/UserScript== (function() { 'use strict'; //input your code setTimeout(function(){ //滑动/swipe geekapp.swipe(0.5, 0.8, 0.5, 0.2); console.log('swipe'); //点击屏幕中央/Click the center //geekapp.click(0.5, 0.5); //console.log('click'); }, 2000); })();


模拟上滑手势/Simulate up slide gesture
// ==UserScript== // @name Simulate up slide gesture // @version 0.1 // @description 模拟手势上滑操作 // @author Your Name // @match * // @exclude *login* // @run-at document-idle // @grant none // ==/UserScript== (function() { 'use strict'; //input your code setInterval(function(){ //滑动/swipe geekapp.swipe(0.5, 0.8, 0.5, 0.2); console.log('swipe'); //点击屏幕中央/Click the center //geekapp.click(0.5, 0.5); //console.log('click'); }, 3000); })();

知乎、简书、CSDN文章详情自动展开
// ==UserScript== // @name 知乎、简书、CSDN文章详情自动展开 // @namespace https://www.mumudroid.com/ // @version 0.1 // @description 代码示例 // @author You // @match https://www.zhihu.com/question/* // @match https://www.jianshu.com/p/* // @match https://blog.csdn.net/*/article/details/* // @exclude *login* // @icon https://static.zhihu.com/heifetz/assets/apple-touch-icon-152.a53ae37b.png // @grant none // ==/UserScript== (function() { 'use strict'; // Your code here... setInterval(function(){ //知乎 if(location.hostname=='www.zhihu.com'){ console.log("open zhihu"); //展开 var commentLists = document.getElementsByClassName('RichContent-inner RichContent-inner--collapsed') for(let item of commentLists) { item.removeAttribute("style") item.removeAttribute("class") } //去除按钮 var btnLists = document.getElementsByClassName('Button ContentItem-rightButton ContentItem-expandButton Button--plain') for(let btn of btnLists) { //console.log(btn); btn.style.display='none'; } } //简书 else if(location.hostname == 'www.jianshu.com'){ var shadowbox = document.querySelector('body > div.download-app-guidance'); if(shadowbox){ //console.log('简书隐藏打开客户端弹出层'); shadowbox.style.display='none'; } var element = document.querySelector('div.collapse-free-content'); if(element){ console.log('简书展开'); element.removeAttribute('class'); var btn = document.getElementsByClassName('collapse-tips')[0] if(btn){ btn.style.display='none'; } } element = document.getElementsByClassName('guidance-wrap-conetnt')[0] if(element){ element.style.display='none'; } } //CSDN else if(location.hostname == 'blog.csdn.net'){ //隐藏打开APP阅读按钮 let gotoAppBtn = document.querySelector('#main > div.btn_open_app_prompt_div'); if(gotoAppBtn){ gotoAppBtn.style.display='none'; } //隐藏浮动提示按钮(这个按钮会随机浮动刷新显示,很无语) let gotoAppBtnFlow = document.querySelector('body > span.feed-Sign-span.feed-Sign-style-new.open_app_channelCode'); if(gotoAppBtnFlow){ gotoAppBtnFlow.style.display='none'; } //关闭自动弹出的登录页面 //let loginPage = document.getElementsByClassName('passport-login-container') let loginPage = document.querySelector('body > passport-login-container'); if(loginPage){ console.log('csdn隐藏登录页面'); loginPage.style.display='none'; } //csdn隐藏打开客户端弹出层 shadowbox = document.querySelector('body > div.weixin-shadowbox.wap-shadowbox'); if(shadowbox){ console.log('csdn隐藏打开客户端弹出层'); shadowbox.style.display='none'; } //csdn显示全部文章 element = document.querySelector('#csdn-previewimg-box > div'); if(element){ console.log('csdn展开'); element.removeAttribute('style'); } //csdn隐藏关注展开按钮 element = document.querySelector('#article > div.readall_box'); if(element){ element.style.display='none'; } } }, 2000);//setInterval })();