Greasy Fork

Greasy Fork is available in English.

网页强制复制

右键强力解锁,可以复制一些特殊网站的文字

当前为 2021-03-31 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name    网页强制复制
// @namespace    https://gitcafe.net/
// @author	无法诉说的吟荡
// @icon	  https://gitcafe.net/favicon.ico
// @version	3.4
// @description	右键强力解锁,可以复制一些特殊网站的文字
// @homepage	http://greasyfork.icu/zh-CN/scripts/218
// @include        *
// @run-at        document-end
// @grant          unsafeWindow
// @require        https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js

// ==/UserScript==

function restore() {
	with(document.wrappedJSObject || document) {
		onmouseup = null;
		onmousedown = null;
		oncontextmenu = null;
    ondragstart = null;
    onselectstart = null
	}
	var arAllElements = document.getElementsByTagName('*');
	for (var i = arAllElements.length - 1; i >= 0; i--) {
		var elmOne = arAllElements[i];
		with(elmOne.wrappedJSObject || elmOne) {
			onmouseup = null;
			onmousedown = null;
      ondragstart = null;
      onselectstart = null
		}
	}
}
window.addEventListener('load', restore, true);

function addGlobalStyle(css) {
	var head, style;
	head = document.getElementsByTagName('head')[0];
	if (!head) {
		return
	}
	style = document.createElement('style');
	style.type = 'text/css';
	style.innerHTML = css;
	head.appendChild(style)
}
addGlobalStyle("html, * {-moz-user-select:text!important;}");
addGlobalStyle("body, * {-webkit-touch-callout: default!important;}");
addGlobalStyle("body, * {-webkit-user-select: auto!important;}");
addGlobalStyle("body, * {-khtml-user-select: auto!important;}");
addGlobalStyle("body, * {-moz-user-select: auto!important;}");
addGlobalStyle("body, * {-ms-user-select: auto!important;}");
addGlobalStyle("body, * {user-select: auto!important;}");
// <style type="text/css">  
// body {  
//     -webkit-touch-callout: none;  //default
//     -webkit-user-select: none;  //auto
//     -khtml-user-select: none;  //auto
//     -moz-user-select: none;  //auto
//     -ms-user-select: none;  //auto
//     user-select: none;  //auto
// }  
// </style> 


// document.ondragstart 拖动时触发
// document.onkeydown 按下键盘触发
// document.oncontextmenu 右键触发
// document.onmouseup 鼠标抬起

// 拖动
// 意外的发现把文本设置成可拖拽也可以禁止拖动。
// draggable=“ture”