Free Copy

支持复制受限网站的文本内容

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name                Free Copy
// @name:CN:zh          自由复制
// @namespace           https://github.com/GuoChen-thlg
// @version             0.1.1
// @description         支持复制受限网站的文本内容
// @author              THLG
// @supportURL          [email protected]
// @contributionURL     https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CK755FJ9PSBZ8
// @contributionAmount  1
// @match               *://wenku.baidu.com/*
// @match               *://*.360doc.com/*
// @grant               none
// @run-at              document-end
// ==/UserScript==
(function () {
    'use strict';
    function rejectOtherHandlers (e) {
        e.stopPropagation()
        if (e.stopImmediatePropagation) {
            e.stopImmediatePropagation()
        }
    }
    ['cut',
        'copy',
        'keydown',
        'keyup',
    ].forEach((event) => {
        document.documentElement.addEventListener(event, rejectOtherHandlers, {
            capture: true,
        })
    })
    var style = [
        "*::before",
        "*",
        "*::after",
    ].join(',') + "{ user-select: initial !important;\n -webkit-user-select: initial !important; }"
    var n_style = document.createElement('style')
    n_style.innerHTML = style
    document.getElementsByTagName('head')[0].appendChild(n_style)
})();