// ==UserScript== // @name LMS Ultimate Focus Bypass // @description Vượt qua bộ kiểm tra chuyển tab, mất tập trung và thoát toàn màn hình của LMS // @version 2.0 // @match *://*/* // @match https://sinhvien.hvu.edu.vn/* // @run-at document-start // @grant none // ==/UserScript== (function() { 'use strict'; // 1. VÁ LỖ HỔNG KHÓA HÀM QUÉT: Ép trang web luôn tin là bạn đang bấm vào nó document.hasFocus = function() { return true; }; window.hasFocus = function() { return true; }; // 2. ÉP TRẠNG THÁI HIỂN THỊ (Sử dụng Getter an toàn hơn) Object.defineProperty(document, 'hidden', { get: () => false, configurable: true }); Object.defineProperty(document, 'visibilityState', { get: () => 'visible', configurable: true }); Object.defineProperty(document, 'webkitVisibilityState', { get: () => 'visible', configurable: true }); // 3. GIẢ LẬP TOÀN MÀN HÌNH (Ngăn web báo lỗi khi bạn vuốt Circle to Search) Object.defineProperty(document, 'fullscreenElement', { get: () => document.documentElement, configurable: true }); Object.defineProperty(document, 'webkitFullscreenElement', { get: () => document.documentElement, configurable: true }); Object.defineProperty(document, 'fullscreen', { get: () => true, configurable: true }); Object.defineProperty(document, 'webkitIsFullScreen', { get: () => true, configurable: true }); // 4. CHẶN TẬT GỐC SỰ KIỆN (Bắt cả ở Window và Document) const criticalEvents = [ 'visibilitychange', 'webkitvisibilitychange', 'blur', 'mouseleave', 'focusout', 'fullscreenchange', 'webkitfullscreenchange' ]; const interceptor = function(e) { // Chặn đứng sự kiện di chuyển ra ngoài hoặc mất tập trung, không cho truyền đến code của LMS e.stopImmediatePropagation(); e.stopPropagation(); }; criticalEvents.forEach(eventName => { // Thêm tham số `true` ở cuối để kích hoạt chế độ "Capture" (chặn trước khi sự kiện kịp chạm tới web) window.addEventListener(eventName, interceptor, true); document.addEventListener(eventName, interceptor, true); if (document.body) { document.body.addEventListener(eventName, interceptor, true); } }); // 5. ĐÁNH LỪA BỘ KHỞI TẠO (Nếu trang web kiểm tra body sau khi load xong) document.addEventListener('DOMContentLoaded', function() { criticalEvents.forEach(eventName => { if (document.body) document.body.addEventListener(eventName, interceptor, true); }); }); })();