mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 21:52:32 -06:00
@@ -164,7 +164,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
LocalPreferences.set("properties_height_rel", properties_height_rel);
|
||||
};
|
||||
|
||||
window.addEvent("resize", () => {
|
||||
window.addEventListener("resize", () => {
|
||||
// only save sizes if the columns are visible
|
||||
if (!$("mainColumn").hasClass("invisible"))
|
||||
saveColumnSizes.delay(200); // Resizing might takes some time.
|
||||
@@ -1000,7 +1000,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
};
|
||||
|
||||
$("alternativeSpeedLimits").addEvent("click", () => {
|
||||
$("alternativeSpeedLimits").addEventListener("click", () => {
|
||||
// Change icon immediately to give some feedback
|
||||
updateAltSpeedIcon(!alternativeSpeedLimits);
|
||||
|
||||
@@ -1018,10 +1018,10 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
}).send();
|
||||
});
|
||||
|
||||
$("DlInfos").addEvent("click", globalDownloadLimitFN);
|
||||
$("UpInfos").addEvent("click", globalUploadLimitFN);
|
||||
$("DlInfos").addEventListener("click", globalDownloadLimitFN);
|
||||
$("UpInfos").addEventListener("click", globalUploadLimitFN);
|
||||
|
||||
$("showTopToolbarLink").addEvent("click", (e) => {
|
||||
$("showTopToolbarLink").addEventListener("click", (e) => {
|
||||
showTopToolbar = !showTopToolbar;
|
||||
LocalPreferences.set("show_top_toolbar", showTopToolbar.toString());
|
||||
if (showTopToolbar) {
|
||||
@@ -1035,7 +1035,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
MochaUI.Desktop.setDesktopSize();
|
||||
});
|
||||
|
||||
$("showStatusBarLink").addEvent("click", (e) => {
|
||||
$("showStatusBarLink").addEventListener("click", (e) => {
|
||||
showStatusBar = !showStatusBar;
|
||||
LocalPreferences.set("show_status_bar", showStatusBar.toString());
|
||||
if (showStatusBar) {
|
||||
@@ -1069,11 +1069,11 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
navigator.registerProtocolHandler("magnet", templateUrl,
|
||||
"qBittorrent WebUI magnet handler");
|
||||
};
|
||||
$("registerMagnetHandlerLink").addEvent("click", (e) => {
|
||||
$("registerMagnetHandlerLink").addEventListener("click", (e) => {
|
||||
registerMagnetHandler();
|
||||
});
|
||||
|
||||
$("showFiltersSidebarLink").addEvent("click", (e) => {
|
||||
$("showFiltersSidebarLink").addEventListener("click", (e) => {
|
||||
showFiltersSidebar = !showFiltersSidebar;
|
||||
LocalPreferences.set("show_filters_sidebar", showFiltersSidebar.toString());
|
||||
if (showFiltersSidebar) {
|
||||
@@ -1089,7 +1089,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
MochaUI.Desktop.setDesktopSize();
|
||||
});
|
||||
|
||||
$("speedInBrowserTitleBarLink").addEvent("click", (e) => {
|
||||
$("speedInBrowserTitleBarLink").addEventListener("click", (e) => {
|
||||
speedInTitle = !speedInTitle;
|
||||
LocalPreferences.set("speed_in_browser_title_bar", speedInTitle.toString());
|
||||
if (speedInTitle)
|
||||
@@ -1099,19 +1099,19 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
processServerState();
|
||||
});
|
||||
|
||||
$("showSearchEngineLink").addEvent("click", (e) => {
|
||||
$("showSearchEngineLink").addEventListener("click", (e) => {
|
||||
window.qBittorrent.Client.showSearchEngine(!window.qBittorrent.Client.isShowSearchEngine());
|
||||
LocalPreferences.set("show_search_engine", window.qBittorrent.Client.isShowSearchEngine().toString());
|
||||
updateTabDisplay();
|
||||
});
|
||||
|
||||
$("showRssReaderLink").addEvent("click", (e) => {
|
||||
$("showRssReaderLink").addEventListener("click", (e) => {
|
||||
window.qBittorrent.Client.showRssReader(!window.qBittorrent.Client.isShowRssReader());
|
||||
LocalPreferences.set("show_rss_reader", window.qBittorrent.Client.isShowRssReader().toString());
|
||||
updateTabDisplay();
|
||||
});
|
||||
|
||||
$("showLogViewerLink").addEvent("click", (e) => {
|
||||
$("showLogViewerLink").addEventListener("click", (e) => {
|
||||
window.qBittorrent.Client.showLogViewer(!window.qBittorrent.Client.isShowLogViewer());
|
||||
LocalPreferences.set("show_log_viewer", window.qBittorrent.Client.isShowLogViewer().toString());
|
||||
updateTabDisplay();
|
||||
@@ -1165,7 +1165,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
$("mainWindowTabs").addClass("invisible");
|
||||
};
|
||||
|
||||
$("StatisticsLink").addEvent("click", StatisticsLinkFN);
|
||||
$("StatisticsLink").addEventListener("click", StatisticsLinkFN);
|
||||
|
||||
// main window tabs
|
||||
|
||||
@@ -1364,11 +1364,11 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
tabsOnload: function() {
|
||||
MochaUI.initializeTabs("panelTabs");
|
||||
|
||||
$("logMessageLink").addEvent("click", (e) => {
|
||||
$("logMessageLink").addEventListener("click", (e) => {
|
||||
window.qBittorrent.Log.setCurrentTab("main");
|
||||
});
|
||||
|
||||
$("logPeerLink").addEvent("click", (e) => {
|
||||
$("logPeerLink").addEventListener("click", (e) => {
|
||||
window.qBittorrent.Log.setCurrentTab("peer");
|
||||
});
|
||||
},
|
||||
@@ -1458,7 +1458,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
}
|
||||
};
|
||||
|
||||
$("PropGeneralLink").addEvent("click", function(e) {
|
||||
$("PropGeneralLink").addEventListener("click", function(e) {
|
||||
$$(".propertiesTabContent").addClass("invisible");
|
||||
$("prop_general").removeClass("invisible");
|
||||
hideFilesFilter();
|
||||
@@ -1466,7 +1466,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
LocalPreferences.set("selected_tab", this.id);
|
||||
});
|
||||
|
||||
$("PropTrackersLink").addEvent("click", function(e) {
|
||||
$("PropTrackersLink").addEventListener("click", function(e) {
|
||||
$$(".propertiesTabContent").addClass("invisible");
|
||||
$("prop_trackers").removeClass("invisible");
|
||||
hideFilesFilter();
|
||||
@@ -1474,7 +1474,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
LocalPreferences.set("selected_tab", this.id);
|
||||
});
|
||||
|
||||
$("PropPeersLink").addEvent("click", function(e) {
|
||||
$("PropPeersLink").addEventListener("click", function(e) {
|
||||
$$(".propertiesTabContent").addClass("invisible");
|
||||
$("prop_peers").removeClass("invisible");
|
||||
hideFilesFilter();
|
||||
@@ -1482,7 +1482,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
LocalPreferences.set("selected_tab", this.id);
|
||||
});
|
||||
|
||||
$("PropWebSeedsLink").addEvent("click", function(e) {
|
||||
$("PropWebSeedsLink").addEventListener("click", function(e) {
|
||||
$$(".propertiesTabContent").addClass("invisible");
|
||||
$("prop_webseeds").removeClass("invisible");
|
||||
hideFilesFilter();
|
||||
@@ -1490,7 +1490,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
LocalPreferences.set("selected_tab", this.id);
|
||||
});
|
||||
|
||||
$("PropFilesLink").addEvent("click", function(e) {
|
||||
$("PropFilesLink").addEventListener("click", function(e) {
|
||||
$$(".propertiesTabContent").addClass("invisible");
|
||||
$("prop_files").removeClass("invisible");
|
||||
showFilesFilter();
|
||||
@@ -1498,7 +1498,7 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
LocalPreferences.set("selected_tab", this.id);
|
||||
});
|
||||
|
||||
$("propertiesPanel_collapseToggle").addEvent("click", (e) => {
|
||||
$("propertiesPanel_collapseToggle").addEventListener("click", (e) => {
|
||||
updatePropertiesPanel();
|
||||
});
|
||||
},
|
||||
@@ -1516,21 +1516,21 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
// listen for changes to torrentsFilterInput
|
||||
let torrentsFilterInputTimer = -1;
|
||||
$("torrentsFilterInput").addEvent("input", () => {
|
||||
$("torrentsFilterInput").addEventListener("input", () => {
|
||||
clearTimeout(torrentsFilterInputTimer);
|
||||
torrentsFilterInputTimer = setTimeout(() => {
|
||||
torrentsFilterInputTimer = -1;
|
||||
torrentsTable.updateTable();
|
||||
}, window.qBittorrent.Misc.FILTER_INPUT_DELAY);
|
||||
});
|
||||
$("torrentsFilterRegexBox").addEvent("change", () => {
|
||||
$("torrentsFilterRegexBox").addEventListener("change", () => {
|
||||
torrentsTable.updateTable();
|
||||
});
|
||||
|
||||
$("transfersTabLink").addEvent("click", showTransfersTab);
|
||||
$("searchTabLink").addEvent("click", showSearchTab);
|
||||
$("rssTabLink").addEvent("click", showRssTab);
|
||||
$("logTabLink").addEvent("click", showLogTab);
|
||||
$("transfersTabLink").addEventListener("click", showTransfersTab);
|
||||
$("searchTabLink").addEventListener("click", showSearchTab);
|
||||
$("rssTabLink").addEventListener("click", showRssTab);
|
||||
$("logTabLink").addEventListener("click", showLogTab);
|
||||
updateTabDisplay();
|
||||
|
||||
const registerDragAndDrop = () => {
|
||||
|
||||
@@ -112,8 +112,8 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
});
|
||||
|
||||
// position the menu
|
||||
let xPosMenu = e.page.x + this.options.offsets.x;
|
||||
let yPosMenu = e.page.y + this.options.offsets.y;
|
||||
let xPosMenu = e.pageX + this.options.offsets.x;
|
||||
let yPosMenu = e.pageY + this.options.offsets.y;
|
||||
if ((xPosMenu + this.menu.offsetWidth) > document.documentElement.clientWidth)
|
||||
xPosMenu -= this.menu.offsetWidth;
|
||||
if ((yPosMenu + this.menu.offsetHeight) > document.documentElement.clientHeight)
|
||||
@@ -156,19 +156,19 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
},
|
||||
|
||||
setupEventListeners: function(elem) {
|
||||
elem.addEvent("contextmenu", (e) => {
|
||||
elem.addEventListener("contextmenu", (e) => {
|
||||
this.triggerMenu(e, elem);
|
||||
});
|
||||
elem.addEvent("click", (e) => {
|
||||
elem.addEventListener("click", (e) => {
|
||||
this.hide();
|
||||
});
|
||||
|
||||
elem.addEvent("touchstart", (e) => {
|
||||
elem.addEventListener("touchstart", (e) => {
|
||||
this.hide();
|
||||
this.touchStartAt = performance.now();
|
||||
this.touchStartEvent = e;
|
||||
});
|
||||
elem.addEvent("touchend", (e) => {
|
||||
elem.addEventListener("touchend", (e) => {
|
||||
const now = performance.now();
|
||||
const touchStartAt = this.touchStartAt;
|
||||
const touchStartEvent = this.touchStartEvent;
|
||||
@@ -196,8 +196,10 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
return;
|
||||
|
||||
// prevent default, if told to
|
||||
if (this.options.stopEvent)
|
||||
e.stop();
|
||||
if (this.options.stopEvent) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
// record this as the trigger
|
||||
this.options.element = $(el);
|
||||
this.adjustMenuPosition(e);
|
||||
@@ -214,7 +216,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
|
||||
/* menu items */
|
||||
this.menu.getElements("a").each(function(item) {
|
||||
item.addEvent("click", (e) => {
|
||||
item.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
if (!item.hasClass("disabled")) {
|
||||
this.execute(item.href.split("#")[1], $(this.options.element));
|
||||
@@ -224,7 +226,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
}, this);
|
||||
|
||||
// hide on body click
|
||||
$(document.body).addEvent("click", () => {
|
||||
$(document.body).addEventListener("click", () => {
|
||||
this.hide();
|
||||
});
|
||||
},
|
||||
@@ -647,8 +649,8 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
top: "-999em"
|
||||
});
|
||||
// position the menu
|
||||
let xPosMenu = e.page.x + this.options.offsets.x - $("rssdownloaderpage").offsetLeft;
|
||||
let yPosMenu = e.page.y + this.options.offsets.y - $("rssdownloaderpage").offsetTop;
|
||||
let xPosMenu = e.pageX + this.options.offsets.x - $("rssdownloaderpage").offsetLeft;
|
||||
let yPosMenu = e.pageY + this.options.offsets.y - $("rssdownloaderpage").offsetTop;
|
||||
if ((xPosMenu + this.menu.offsetWidth) > document.documentElement.clientWidth)
|
||||
xPosMenu -= this.menu.offsetWidth;
|
||||
if ((yPosMenu + this.menu.offsetHeight) > document.documentElement.clientHeight)
|
||||
|
||||
@@ -151,7 +151,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
|
||||
const mouseMoveFn = function(e) {
|
||||
const brect = e.target.getBoundingClientRect();
|
||||
const mouseXRelative = e.event.clientX - brect.left;
|
||||
const mouseXRelative = e.clientX - brect.left;
|
||||
if (this.currentHeaderAction === "") {
|
||||
if ((brect.width - mouseXRelative) < 5) {
|
||||
this.resizeTh = e.target;
|
||||
@@ -201,7 +201,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
});
|
||||
}
|
||||
this.lastHoverTh = e.target;
|
||||
this.lastClientX = e.event.clientX;
|
||||
this.lastClientX = e.clientX;
|
||||
}.bind(this);
|
||||
|
||||
const mouseOutFn = function(e) {
|
||||
@@ -280,9 +280,9 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
|
||||
for (let i = 0; i < ths.length; ++i) {
|
||||
const th = ths[i];
|
||||
th.addEvent("mousemove", mouseMoveFn);
|
||||
th.addEvent("mouseout", mouseOutFn);
|
||||
th.addEvent("touchend", onTouch);
|
||||
th.addEventListener("mousemove", mouseMoveFn);
|
||||
th.addEventListener("mouseout", mouseOutFn);
|
||||
th.addEventListener("touchend", onTouch);
|
||||
th.makeResizable({
|
||||
modifiers: {
|
||||
x: "",
|
||||
@@ -728,15 +728,17 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
tr["rowId"] = rowId;
|
||||
|
||||
tr._this = this;
|
||||
tr.addEvent("contextmenu", function(e) {
|
||||
tr.addEventListener("contextmenu", function(e) {
|
||||
if (!this._this.isRowSelected(this.rowId)) {
|
||||
this._this.deselectAll();
|
||||
this._this.selectRow(this.rowId);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
tr.addEvent("click", function(e) {
|
||||
e.stop();
|
||||
tr.addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (e.control || e.meta) {
|
||||
// CTRL/CMD ⌘ key was pressed
|
||||
if (this._this.isRowSelected(this.rowId))
|
||||
@@ -755,13 +757,13 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
tr.addEvent("touchstart", function(e) {
|
||||
tr.addEventListener("touchstart", function(e) {
|
||||
if (!this._this.isRowSelected(this.rowId)) {
|
||||
this._this.deselectAll();
|
||||
this._this.selectRow(this.rowId);
|
||||
}
|
||||
});
|
||||
tr.addEvent("keydown", function(event) {
|
||||
tr.addEventListener("keydown", function(event) {
|
||||
switch (event.key) {
|
||||
case "up":
|
||||
this._this.selectPreviousRow();
|
||||
@@ -1523,8 +1525,10 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
},
|
||||
|
||||
setupTr: function(tr) {
|
||||
tr.addEvent("dblclick", function(e) {
|
||||
e.stop();
|
||||
tr.addEventListener("dblclick", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this._this.deselectAll();
|
||||
this._this.selectRow(this.rowId);
|
||||
const row = this._this.rows.get(this.rowId);
|
||||
@@ -2030,7 +2034,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
checkbox.id = "cbRename" + id;
|
||||
checkbox.setAttribute("data-id", id);
|
||||
checkbox.className = "RenamingCB";
|
||||
checkbox.addEvent("click", (e) => {
|
||||
checkbox.addEventListener("click", (e) => {
|
||||
const node = that.getNode(id);
|
||||
node.checked = e.target.checked ? 0 : 1;
|
||||
node.full_data.checked = node.checked;
|
||||
@@ -2248,7 +2252,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
},
|
||||
|
||||
setupTr: function(tr) {
|
||||
tr.addEvent("keydown", function(event) {
|
||||
tr.addEventListener("keydown", function(event) {
|
||||
switch (event.key) {
|
||||
case "left":
|
||||
qBittorrent.PropFiles.collapseFolder(this._this.getSelectedRowId());
|
||||
@@ -2578,7 +2582,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
},
|
||||
|
||||
setupTr: function(tr) {
|
||||
tr.addEvent("keydown", function(event) {
|
||||
tr.addEventListener("keydown", function(event) {
|
||||
switch (event.key) {
|
||||
case "left":
|
||||
qBittorrent.PropFiles.collapseFolder(this._this.getSelectedRowId());
|
||||
@@ -2630,7 +2634,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
window.qBittorrent.Rss.showRssFeed(path);
|
||||
},
|
||||
setupTr: function(tr) {
|
||||
tr.addEvent("dblclick", function(e) {
|
||||
tr.addEventListener("dblclick", function(e) {
|
||||
if (this.rowId !== 0) {
|
||||
window.qBittorrent.Rss.moveItem(this._this.rows.get(this.rowId).full_data.dataPath);
|
||||
return true;
|
||||
@@ -2738,7 +2742,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
$(this.dynamicTableFixedHeaderDivId).getElements("table")[0].style.left = -$(this.dynamicTableDivId).scrollLeft + "px";
|
||||
}.bind(this);
|
||||
|
||||
$(this.dynamicTableDivId).addEvent("scroll", scrollFn);
|
||||
$(this.dynamicTableDivId).addEventListener("scroll", scrollFn);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2771,7 +2775,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
window.qBittorrent.Rss.showDetails(feedUid, articleId);
|
||||
},
|
||||
setupTr: function(tr) {
|
||||
tr.addEvent("dblclick", function(e) {
|
||||
tr.addEventListener("dblclick", function(e) {
|
||||
showDownloadPage([this._this.rows.get(this.rowId).full_data.torrentURL]);
|
||||
return true;
|
||||
});
|
||||
@@ -2833,7 +2837,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
$(this.dynamicTableFixedHeaderDivId).getElements("table")[0].style.left = -$(this.dynamicTableDivId).scrollLeft + "px";
|
||||
}.bind(this);
|
||||
|
||||
$(this.dynamicTableDivId).addEvent("scroll", scrollFn);
|
||||
$(this.dynamicTableDivId).addEventListener("scroll", scrollFn);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2850,7 +2854,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
checkbox.id = "cbRssDlRule" + row.rowId;
|
||||
checkbox.checked = row.full_data.checked;
|
||||
|
||||
checkbox.addEvent("click", function(e) {
|
||||
checkbox.addEventListener("click", function(e) {
|
||||
window.qBittorrent.RssDownloader.rssDownloaderRulesTable.updateRowData({
|
||||
rowId: row.rowId,
|
||||
checked: this.checked
|
||||
@@ -2872,7 +2876,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
return this.rows.getValues();
|
||||
},
|
||||
setupTr: function(tr) {
|
||||
tr.addEvent("dblclick", function(e) {
|
||||
tr.addEventListener("dblclick", function(e) {
|
||||
window.qBittorrent.RssDownloader.renameRule(this._this.rows.get(this.rowId).full_data.name);
|
||||
return true;
|
||||
});
|
||||
@@ -2943,7 +2947,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
||||
checkbox.id = "cbRssDlFeed" + row.rowId;
|
||||
checkbox.checked = row.full_data.checked;
|
||||
|
||||
checkbox.addEvent("click", function(e) {
|
||||
checkbox.addEventListener("click", function(e) {
|
||||
window.qBittorrent.RssDownloader.rssDownloaderFeedSelectionTable.updateRowData({
|
||||
rowId: row.rowId,
|
||||
checked: this.checked
|
||||
|
||||
@@ -111,12 +111,13 @@ const initializeWindows = function() {
|
||||
function addClickEvent(el, fn) {
|
||||
["Link", "Button"].each((item) => {
|
||||
if ($(el + item))
|
||||
$(el + item).addEvent("click", fn);
|
||||
$(el + item).addEventListener("click", fn);
|
||||
});
|
||||
}
|
||||
|
||||
addClickEvent("download", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
showDownloadPage();
|
||||
});
|
||||
|
||||
@@ -148,7 +149,9 @@ const initializeWindows = function() {
|
||||
};
|
||||
|
||||
addClickEvent("preferences", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const id = "preferencesPage";
|
||||
new MochaUI.Window({
|
||||
id: id,
|
||||
@@ -173,7 +176,9 @@ const initializeWindows = function() {
|
||||
});
|
||||
|
||||
addClickEvent("upload", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const id = "uploadPage";
|
||||
new MochaUI.Window({
|
||||
id: id,
|
||||
@@ -399,7 +404,8 @@ const initializeWindows = function() {
|
||||
};
|
||||
|
||||
addClickEvent("delete", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
deleteFN();
|
||||
});
|
||||
|
||||
@@ -1070,7 +1076,8 @@ const initializeWindows = function() {
|
||||
};
|
||||
|
||||
addClickEvent("stopAll", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (confirm("QBT_TR(Would you like to stop all torrents?)QBT_TR[CONTEXT=MainWindow]")) {
|
||||
new Request({
|
||||
@@ -1085,7 +1092,8 @@ const initializeWindows = function() {
|
||||
});
|
||||
|
||||
addClickEvent("startAll", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (confirm("QBT_TR(Would you like to start all torrents?)QBT_TR[CONTEXT=MainWindow]")) {
|
||||
new Request({
|
||||
@@ -1101,7 +1109,9 @@ const initializeWindows = function() {
|
||||
|
||||
["stop", "start", "recheck"].each((item) => {
|
||||
addClickEvent(item, (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const hashes = torrentsTable.selectedRowsIds();
|
||||
if (hashes.length) {
|
||||
hashes.each((hash, index) => {
|
||||
@@ -1120,7 +1130,8 @@ const initializeWindows = function() {
|
||||
|
||||
["decreasePrio", "increasePrio", "topPrio", "bottomPrio"].each((item) => {
|
||||
addClickEvent(item, (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setQueuePositionFN(item);
|
||||
});
|
||||
});
|
||||
@@ -1140,7 +1151,9 @@ const initializeWindows = function() {
|
||||
};
|
||||
|
||||
addClickEvent("about", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const id = "aboutpage";
|
||||
new MochaUI.Window({
|
||||
id: id,
|
||||
@@ -1162,7 +1175,9 @@ const initializeWindows = function() {
|
||||
});
|
||||
|
||||
addClickEvent("logout", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
new Request({
|
||||
url: "api/v2/auth/logout",
|
||||
method: "post",
|
||||
@@ -1173,7 +1188,9 @@ const initializeWindows = function() {
|
||||
});
|
||||
|
||||
addClickEvent("shutdown", (e) => {
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
if (confirm("QBT_TR(Are you sure you want to quit qBittorrent?)QBT_TR[CONTEXT=MainWindow]")) {
|
||||
new Request({
|
||||
url: "api/v2/app/shutdown",
|
||||
@@ -1191,8 +1208,9 @@ const initializeWindows = function() {
|
||||
|
||||
// Deactivate menu header links
|
||||
$$("a.returnFalse").each((el) => {
|
||||
el.addEvent("click", (e) => {
|
||||
new Event(e).stop();
|
||||
el.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -136,7 +136,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||
checkbox.setAttribute("data-id", id);
|
||||
checkbox.setAttribute("data-file-id", fileId);
|
||||
checkbox.className = "DownloadedCB";
|
||||
checkbox.addEvent("click", fileCheckboxClicked);
|
||||
checkbox.addEventListener("click", fileCheckboxClicked);
|
||||
|
||||
updateCheckbox(checkbox, checked);
|
||||
return checkbox;
|
||||
@@ -180,7 +180,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||
select.setAttribute("data-id", id);
|
||||
select.setAttribute("data-file-id", fileId);
|
||||
select.addClass("combo_priority");
|
||||
select.addEvent("change", fileComboboxChanged);
|
||||
select.addEventListener("change", fileComboboxChanged);
|
||||
|
||||
createPriorityOptionElement(FilePriority.Ignored, (FilePriority.Ignored === selectedPriority), "QBT_TR(Do not download)QBT_TR[CONTEXT=PropListDelegate]").injectInside(select);
|
||||
createPriorityOptionElement(FilePriority.Normal, (FilePriority.Normal === selectedPriority), "QBT_TR(Normal)QBT_TR[CONTEXT=PropListDelegate]").injectInside(select);
|
||||
@@ -625,7 +625,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||
const checkbox = new Element("input");
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.id = "tristate_cb";
|
||||
checkbox.addEvent("click", switchCheckboxState);
|
||||
checkbox.addEventListener("click", switchCheckboxState);
|
||||
|
||||
const checkboxTH = tableHeaders[0];
|
||||
checkbox.injectInside(checkboxTH);
|
||||
@@ -637,7 +637,7 @@ window.qBittorrent.PropFiles ??= (() => {
|
||||
|
||||
// listen for changes to torrentFilesFilterInput
|
||||
let torrentFilesFilterInputTimer = -1;
|
||||
$("torrentFilesFilterInput").addEvent("input", () => {
|
||||
$("torrentFilesFilterInput").addEventListener("input", () => {
|
||||
clearTimeout(torrentFilesFilterInputTimer);
|
||||
|
||||
const value = $("torrentFilesFilterInput").value;
|
||||
|
||||
@@ -107,7 +107,7 @@ window.qBittorrent.Search ??= (() => {
|
||||
|
||||
// listen for changes to searchInNameFilter
|
||||
let searchInNameFilterTimer = -1;
|
||||
$("searchInNameFilter").addEvent("input", () => {
|
||||
$("searchInNameFilter").addEventListener("input", () => {
|
||||
clearTimeout(searchInNameFilterTimer);
|
||||
searchInNameFilterTimer = setTimeout(() => {
|
||||
searchInNameFilterTimer = -1;
|
||||
@@ -123,7 +123,8 @@ window.qBittorrent.Search ??= (() => {
|
||||
events: {
|
||||
"Enter": function(e) {
|
||||
// accept enter key as a click
|
||||
new Event(e).stop();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
const elem = e.event.srcElement;
|
||||
if (elem.className.contains("searchInputField")) {
|
||||
@@ -159,6 +160,7 @@ window.qBittorrent.Search ??= (() => {
|
||||
const tabElem = new Element("a", {
|
||||
text: pattern,
|
||||
});
|
||||
|
||||
const closeTabElem = new Element("img", {
|
||||
alt: "QBT_TR(Close tab)QBT_TR[CONTEXT=SearchWidget]",
|
||||
title: "QBT_TR(Close tab)QBT_TR[CONTEXT=SearchWidget]",
|
||||
@@ -166,15 +168,22 @@ window.qBittorrent.Search ??= (() => {
|
||||
width: "8",
|
||||
height: "8",
|
||||
style: "padding-right: 7px; margin-bottom: -1px; margin-left: -5px",
|
||||
onclick: "qBittorrent.Search.closeSearchTab(this)",
|
||||
onclick: "qBittorrent.Search.closeSearchTab(event, this);",
|
||||
});
|
||||
closeTabElem.inject(tabElem, "top");
|
||||
|
||||
tabElem.appendChild(getStatusIconElement("QBT_TR(Searching...)QBT_TR[CONTEXT=SearchJobWidget]", "images/queued.svg"));
|
||||
$("searchTabs").appendChild(new Element("li", {
|
||||
|
||||
const liElement = new Element("li", {
|
||||
id: newTabId,
|
||||
class: "selected",
|
||||
html: tabElem.outerHTML,
|
||||
}));
|
||||
});
|
||||
liElement.addEventListener("click", (e) => {
|
||||
setActiveTab(liElement);
|
||||
$("startSearchButton").textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
|
||||
});
|
||||
$("searchTabs").appendChild(liElement);
|
||||
|
||||
// unhide the results elements
|
||||
if (numSearchTabs() >= 1) {
|
||||
@@ -184,15 +193,8 @@ window.qBittorrent.Search ??= (() => {
|
||||
$("searchTabsToolbar").style.display = "block";
|
||||
}
|
||||
|
||||
// reinitialize tabs
|
||||
$("searchTabs").getElements("li").removeEvents("click");
|
||||
$("searchTabs").getElements("li").addEvent("click", function(e) {
|
||||
$("startSearchButton").textContent = "QBT_TR(Search)QBT_TR[CONTEXT=SearchEngineWidget]";
|
||||
setActiveTab(this);
|
||||
});
|
||||
|
||||
// select new tab
|
||||
setActiveTab($(newTabId));
|
||||
setActiveTab(liElement);
|
||||
|
||||
searchResultsTable.clear();
|
||||
resetFilters();
|
||||
@@ -213,11 +215,13 @@ window.qBittorrent.Search ??= (() => {
|
||||
updateSearchResultsData(searchId);
|
||||
};
|
||||
|
||||
const closeSearchTab = function(el) {
|
||||
const closeSearchTab = function(e, el) {
|
||||
e.stopPropagation();
|
||||
|
||||
const tab = el.parentElement.parentElement;
|
||||
const searchId = getSearchIdFromTab(tab);
|
||||
const isTabSelected = tab.hasClass("selected");
|
||||
const newTabToSelect = isTabSelected ? tab.nextSibling || tab.previousSibling : null;
|
||||
const newTabToSelect = isTabSelected ? (tab.nextSibling || tab.previousSibling) : null;
|
||||
|
||||
const currentSearchId = getSelectedSearchId();
|
||||
const state = searchState.get(currentSearchId);
|
||||
@@ -388,7 +392,7 @@ window.qBittorrent.Search ??= (() => {
|
||||
category: category,
|
||||
plugins: plugins
|
||||
},
|
||||
onSuccess: function(response) {
|
||||
onSuccess: (response) => {
|
||||
$("startSearchButton").textContent = "QBT_TR(Stop)QBT_TR[CONTEXT=SearchEngineWidget]";
|
||||
const searchId = response.id;
|
||||
createSearchTab(searchId, pattern);
|
||||
|
||||
Reference in New Issue
Block a user