Moodle SecureDisable

disable secure events

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          Moodle SecureDisable
// @version      0.6
// @description  disable secure events
// @author       Vitaliy Tolstyakov
// @match        *://*/*
// @grant        none
// @namespace https://greasyfork.org/users/590687
// ==/UserScript==

(function() {
    'use strict';
    if(!document.body.classList.contains("quiz-secure-window")) return;

    Array.from(document.body.classList)
        .filter(className => className.includes('secure'))
        .forEach(className => document.body.classList.remove(className));

    const eventsToUnBlock = [
        'mousedown',
        'dragstart',
        'contextmenu',
        'copy',
        'keydown',
        'beforeprint',
        'afterprint',
        'keypress',
        'keyup'
    ];

    const stopEventPropagation = (event) => {
        event.stopPropagation();
    };

    eventsToUnBlock.forEach(event => {
        window.addEventListener(event, stopEventPropagation, true);
    });
})();