惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News: Ask HN
Hacker News: Ask HN
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Secure Thoughts
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
The Blog of Author Tim Ferriss
B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Google DeepMind News
Google DeepMind News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
Arctic Wolf
T
The Exploit Database - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
GbyAI
GbyAI
AWS News Blog
AWS News Blog
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
Google Online Security Blog
Google Online Security Blog
T
Troy Hunt's Blog
I
InfoQ
L
LINUX DO - 热门话题
WordPress大学
WordPress大学
C
Cisco Blogs
G
GRAHAM CLULEY
The Register - Security
The Register - Security
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Project Zero
Project Zero
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
H
Hacker News: Front Page
小众软件
小众软件
雷峰网
雷峰网
The Hacker News
The Hacker News
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Tor Project blog
博客园 - 聂微东
N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
The GitHub Blog
The GitHub Blog
腾讯CDC
P
Palo Alto Networks Blog
Scott Helme
Scott Helme

博客园 - jack_Meng

油候脚本中,使用GM_info对象,打印脚本信息 高中免费电子教辅资料合集 Windows防火墙关闭445端口:Windows在防火墙禁用echo-reply(type 0)、time-exceeded(type 11)、destination-unreachable(type 3)类型的ICMP包 WinForm 双屏开发中屏幕适配与窗口定位 高考志愿填报之计算机类专业院校报考指南(2026版) WebSocket 快速入门教程(附示例源码) 自动生成项目工具--AutoBuilder,一键干掉80%的重复CRUD工作 C#/.NET/.NET Core优秀项目和框架2026年5月简报 在Win10系统中,默认使用照片查看器 C#实现控制台多区域输出 解决: 您的连接不是私密连接,您目前无法访问 因为此网站使用了 HSTS 小说下载 网页版时间,可全屏显示 个人笔记本连接公共WIFI的安全措施 追更 HelloGitHub 一整年,年度盘点 基于Rust开发的m3u8下载器M3U8Quicker:支持断点续传、边下边播 新写了个直播录制工具,可录制抖音快手斗鱼直播 bing 每日一图 --- 桌面壁纸 一款基于 C# 开发的 Windows 10/11 系统增强优化工具 适合个人的免费域名 语雀里存了三年的笔记,导出到了本地插件----YuqueOut C# 也能像 Python 一样写脚本 | .NET 10 构建基于文件的应用 js 双击页面 开始/暂停 页面滚动 使用bat批量给txt追加内容 Python摄像头监控:运动检测+自动录像+时间水印 【译】告别繁琐查错:认识下新的 Visual Studio Debugger Agent Workflow 好消息,在 Visual Studio 中可以免费使用 GitHub Copilot 了! [C#] 零依赖高性能跨平台 Web 胶水库 -- PicoServer 我的第一款独立产品--TaskManager 写 EF Core 查询,优化查询语句 最新.NET新手入门学习网站合集(2026更新版) Avalonia UI:.NET 跨平台桌面开发的“真香”选择 一个 txt 生成并保存 mp3的 Python 脚本 开源可商用 .NET Office 转 PDF 工具/库 - MiniPdf c# 常用且免费的 AI 编程工具 CodeGeeX,在vs 2019中使用的 AI 大模型工具 支持在 vs studio 2019中安装的 免费的 AI 辅助工具 .Net Framework 使用Lazy<T>延迟初始化对象 微软官网wpf例程源码下载地址 GitHub“神级”项目学习网址 开源协议介绍 Windows 窗体控件和等效的 WPF 控件 sql server backup database 爬取七猫中文网小说 ASP.NET Core 内存缓存实战 CliWrap —— .NET 最优雅的命令行交互库 .NET 高级开发 | 设计、实现一个事件总线框架 一个基于 .NET Core + Vue3 构建的开源全栈平台 Admin 系统 C#/.NET/.NET Core优秀项目和框架2026年3月简报--工作流引擎 C# 如何减少代码运行时间:7 个实战优化技巧
使用油候脚本,移除页面无法选择文字
jack_Meng · 2026-07-25 · via 博客园 - jack_Meng

在浏览页面的时候,页面上使用了禁用选择文字,禁用了右键等功能,找豆包给了一个解决方案,如下:

方案 1:解绑 document 上所有 selectstart 事件(最简单)

// jQuery 解绑document所有selectstart绑定
$(document).unbind('selectstart');

// 顺带把右键、拖拽一并清掉
$(document).unbind('contextmenu dragstart mousedown');

// 再强制修复CSS不能选中问题
$('body, *').css({
    'user-select': 'auto',
    '-webkit-user-select': 'auto'
});

方案 2:精准只解绑那一个匿名函数(严谨版)

如果页面其他代码也绑定了 selectstart,不想全部清空,只能保存原函数引用再解绑,但匿名函数无法直接获取,只能用 jQuery 内部清理:

// 清空document上jQuery托管的所有事件(慎用,会清掉所有jQuery绑定事件)
$(document).unbind();

方案 3:不用管解绑,直接强行重写事件拦截(终极覆盖)

不管它绑了多少层 jQuery 事件、原生 addEventListener,直接覆盖:

// 原生事件置空
document.onselectstart = null;
document.oncontextmenu = null;

// 阻止jQuery再次绑定生效
Object.defineProperty(document, 'onselectstart', {
    set: function() {},
    get: function() { return null; }
});

// 全局CSS放开选中
document.querySelectorAll('*').forEach(el => {
    el.style.userSelect = 'auto';
    el.style.webkitUserSelect = 'auto';
});

方案 4:彻底根治:禁用 JavaScript(推荐一劳永逸)

  1. F12 打开开发者工具 → 右上角设置图标
  2. Settings → Debugger → 取消 Enable JavaScript
  3. 刷新页面,所有 jQuery 绑定、原生事件全部失效,CSS 限制也可手动修改,百分百可以选中文字。

补充小知识

  1. .bind() 对应解绑 .unbind()
  2. 新版 jQuery .on() 对应解绑 .off()
  3. 原生 addEventListener 只能通过相同函数引用 removeEventListener,匿名函数无法单个移除;
  4. 绝大多数不能选文字,CSS user-select: none 才是大头,只清事件不改 CSS 依然选不动。

======================================================================================

个人使用

版本1

主要是移除页面上的jQuery的绑定的事件

// ==UserScript==
// @name         moveSelect
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http*://shyahs.chneic.sh.cn/*


// @icon         https://www.google.com/s2/favicons?sz=64&domain=doubao.com
// @grant        none
// ==/UserScript==


(function (){
    'use strict';
    // Your code here...

    $(document).ready(function(){
        // 在此处执行希望在页面加载完成后执行的操作
        console.log("moveSelect==========页面加载完成")
        //setTimeout(unbindSelect,1000);
        unbindSelect();

    });

})();



function unbindSelect()
{
    // 主要解决延安中学网站无法选择的问题,jQuery 解绑document所有selectstart绑定, 顺带把右键、拖拽一并清掉
    $(document).unbind('selectstart contextmenu dragstart mousedown');
    // 再强制修复CSS不能选中问题
    $('body, *').css({
        'user-select': 'auto',
        '-webkit-user-select': 'auto'
    });
    console.log("moveSelect==========解绑document所有selectstart绑定")

    // GM_info 内置对象,不需要额外权限
    console.log('当前脚本名称:', GM_info.script.name);
    console.log('脚本信息:', GM_info.script);
    console.log('脚本完整信息:', GM_info);
}

View Code

版本2

增加统一日志打印的功能

// ==UserScript==
// @name         moveSelect
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http*://*
// @match        http*://shyahs.chneic.sh.cn/*

// @icon         https://www.google.com/s2/favicons?sz=64&domain=baidu.com
// @grant        none
// ==/UserScript==


(function (){
    'use strict';
    // Your code here...

    $(document).ready(function(){
        // 在此处执行希望在页面加载完成后执行的操作
        log("==========页面加载完成事件")
        //setTimeout(unbindSelect,1000);
        unbindSelect();

    });

})();

//匿名函数调用日志
(()=>{
    log('匿名函数内容');
})();

//* 统一日志打印
//* @param  {...any} args 要打印的内容
function log(...args) {
    const fnName = new Error().stack.split('\n')[2].match(/at (\w+)/)[1];
    console.log(`[${GM_info.script.name}]-[${fnName}]`, ...args);
}


function unbindSelect()
{
    // 主要解决延安中学网站无法选择的问题,jQuery 解绑document所有selectstart绑定, 顺带把右键、拖拽一并清掉
    $(document).unbind('selectstart contextmenu dragstart mousedown');
    // 再强制修复CSS不能选中问题
    $('body, *').css({
        'user-select': 'auto',
        '-webkit-user-select': 'auto'
    });
    log("==========解绑document所有selectstart绑定")
}

View Code