Greasy Fork

Greasy Fork is available in English.

解锁PTA复制粘贴限制

这个用户脚本旨在解除PTA(拼题A、Pintia)平台上的复制和粘贴限制,使用户能够自由复制和粘贴文本

当前为 2024-09-27 提交的版本,查看 最新版本

// ==UserScript==
// @name         解锁PTA复制粘贴限制
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  这个用户脚本旨在解除PTA(拼题A、Pintia)平台上的复制和粘贴限制,使用户能够自由复制和粘贴文本
// @author       MadelineCarter
// @match        https://pintia.cn/problem-sets/*/exam/problems/*
// @grant        none
// @license      All Rights Reserved
// ==/UserScript==

(function () {
    'use strict';

    // 移除复制事件的监听器
    document.addEventListener('copy', function(event) {
        event.stopImmediatePropagation(); // 阻止复制事件传播
    }, true);

    // 移除粘贴事件的监听器
    document.addEventListener('paste', function(event) {
        event.stopImmediatePropagation(); // 阻止粘贴事件传播
    }, true);

    // 允许文本选择
    document.body.style.userSelect = 'text'; // 允许用户选择文本

    // 额外的兼容性
    document.body.style.webkitUserSelect = 'text'; // 针对Safari浏览器
    document.body.style.msUserSelect = 'text'; // 针对IE和Edge
})();
/*
    This script is not licensed for use, modification, or distribution.
    All rights are reserved by the author.
*/