您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
移除icve考试期间切换屏幕检查的方法
// ==UserScript== // @name 移除执教云/智慧职教/icve平台的事件监听器 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 移除icve考试期间切换屏幕检查的方法 // @author Yitong233 // @match *://*.icve.com.cn/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function removeMethods() { // 假设这些方法存在于某个对象中,例如 `exam` let objNames = ['exam', 'someOtherObject']; // 根据实际情况调整对象名称 objNames.forEach(name => { if (window[name] && typeof window[name] === 'object') { let obj = window[name]; if (obj.winFlag && typeof obj.winFlag === 'function') { obj.winFlag = function() { console.log(name + '.winFlag function removed.'); }; } if (obj.check && typeof obj.check === 'function') { obj.check = function() { console.log(name + '.check function removed.'); }; } if (obj.onVisibilityChange && typeof obj.onVisibilityChange === 'function') { obj.onVisibilityChange = function() { console.log(name + '.onVisibilityChange function removed.'); }; } if (obj.onmouseleaveChange && typeof obj.onmouseleaveChange === 'function') { obj.onmouseleaveChange = function() { console.log(name + '.onmouseleaveChange function removed.'); }; } if (obj.isScreen && typeof obj.isScreen === 'function') { obj.isScreen = function() { console.log(name + '.isScreen function removed.'); }; } } }); // 如果方法存在于 Vue 组件中 if (window.Vue) { Vue.mixin({ beforeCreate() { if (this.$options.methods) { if (this.$options.methods.winFlag) { this.$options.methods.winFlag = function() { console.log('winFlag function removed.'); }; } if (this.$options.methods.check) { this.$options.methods.check = function() { console.log('check function removed.'); }; } if (this.$options.methods.onVisibilityChange) { this.$options.methods.onVisibilityChange = function() { console.log('onVisibilityChange function removed.'); }; } if (this.$options.methods.onmouseleaveChange) { this.$options.methods.onmouseleaveChange = function() { console.log('onmouseleaveChange function removed.'); }; } if (this.$options.methods.isScreen) { this.$options.methods.isScreen = function() { console.log('isScreen function removed.'); }; } } } }); } } function removeVisibilityChangeListeners() { const originalDocumentAddEventListener = document.addEventListener.bind(document); document.addEventListener = function(type, listener, options) { if (type === 'visibilitychange') { console.log('VisibilityChange listener prevented:', listener); } else { originalDocumentAddEventListener(type, listener, options); } }; // 清除已经存在的 visibilitychange 事件监听器 const events = getEventListeners(document); const visibilityChangeListeners = events.visibilitychange || []; visibilityChangeListeners.forEach(listener => { document.removeEventListener('visibilitychange', listener.listener); }); console.log('All visibilitychange listeners removed'); } // 延迟执行以确保目标脚本已加载 setTimeout(() => { removeMethods(); removeVisibilityChangeListeners(); }, 3000); })();