8/7/2025, 9:20:32 AM
// ==UserScript==
// @name OpenMediaVault close modal on Esc
// @namespace Violentmonkey Scripts
// @match *://omv.*/*
// @license MIT
// @version 1.0
// @author RDD
// @description 8/7/2025, 9:20:32 AM
// ==/UserScript==
window.addEventListener('load', (event) => window.addEventListener('keydown', OnKeyPressed), true);
const EscapePressed = () => {
const closeSpan = Array.from(document.querySelectorAll('span.mat-button-wrapper')).find(span => span.textContent.trim() === 'Close');
if (closeSpan) {
const button = closeSpan.closest('button');
if (button) {
button.click();
}
}
};
// Event listener function for the Escape key.
const OnKeyPressed = (event) => {
event.key === 'Escape' && EscapePressed();
};
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址