WebUI: use native functions for event handling

PR #21147.
This commit is contained in:
Chocobo1
2024-08-07 22:00:54 +08:00
committed by GitHub
parent 989b1d176d
commit 2d9e3b3330
30 changed files with 261 additions and 196 deletions

View File

@@ -10,16 +10,19 @@
<script>
"use strict";
window.addEvent("domready", () => {
window.addEventListener("DOMContentLoaded", () => {
const rules = new URI().getData("rules").split("|");
$("cancelBtn").focus();
$("cancelBtn").addEvent("click", (e) => {
new Event(e).stop();
$("cancelBtn").addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
window.parent.MochaUI.closeWindow(window.parent.$("clearRulesPage"));
});
$("confirmBtn").addEvent("click", (e) => {
new Event(e).stop();
$("confirmBtn").addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
let completionCount = 0;
rules.forEach((rule) => {
window.parent.qBittorrent.RssDownloader.modifyRuleState(decodeURIComponent(rule), "previouslyMatchedEpisodes", [], () => {