WebUI: unify comment format

This commit is contained in:
Chocobo1 2024-06-09 18:43:47 +08:00
parent bf4e0df386
commit 648dd9988d
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
7 changed files with 29 additions and 28 deletions

View File

@ -53,7 +53,8 @@ export default [
"allowTemplateLiterals": true "allowTemplateLiterals": true
} }
], ],
"Stylistic/semi": "error" "Stylistic/semi": "error",
"Stylistic/spaced-comment": ["error", "always", { "exceptions": ["*"] }]
} }
} }
]; ];

View File

@ -172,7 +172,7 @@ window.addEventListener("DOMContentLoaded", () => {
saveColumnSizes.delay(200); // Resizing might takes some time. saveColumnSizes.delay(200); // Resizing might takes some time.
}); });
/*MochaUI.Desktop = new MochaUI.Desktop(); /* MochaUI.Desktop = new MochaUI.Desktop();
MochaUI.Desktop.desktop.setStyles({ MochaUI.Desktop.desktop.setStyles({
'background': '#fff', 'background': '#fff',
'visibility': 'visible' 'visibility': 'visible'

View File

@ -47,10 +47,10 @@ window.qBittorrent.ContextMenu = (function() {
let lastShownContextMenu = null; let lastShownContextMenu = null;
const ContextMenu = new Class({ const ContextMenu = new Class({
//implements // implements
Implements: [Options, Events], Implements: [Options, Events],
//options // options
options: { options: {
actions: {}, actions: {},
menu: "menu_id", menu: "menu_id",
@ -67,16 +67,16 @@ window.qBittorrent.ContextMenu = (function() {
touchTimer: 600 touchTimer: 600
}, },
//initialization // initialization
initialize: function(options) { initialize: function(options) {
//set options // set options
this.setOptions(options); this.setOptions(options);
//option diffs menu // option diffs menu
this.menu = $(this.options.menu); this.menu = $(this.options.menu);
this.targets = $$(this.options.targets); this.targets = $$(this.options.targets);
//fx // fx
this.fx = new Fx.Tween(this.menu, { this.fx = new Fx.Tween(this.menu, {
property: "opacity", property: "opacity",
duration: this.options.fadeSpeed, duration: this.options.fadeSpeed,
@ -88,10 +88,10 @@ window.qBittorrent.ContextMenu = (function() {
}.bind(this.menu) }.bind(this.menu)
}); });
//hide and begin the listener // hide and begin the listener
this.hide().startListener(); this.hide().startListener();
//hide the menu // hide the menu
this.menu.setStyles({ this.menu.setStyles({
"position": "absolute", "position": "absolute",
"top": "-900000px", "top": "-900000px",
@ -197,17 +197,17 @@ window.qBittorrent.ContextMenu = (function() {
if (this.options.disabled) if (this.options.disabled)
return; return;
//prevent default, if told to // prevent default, if told to
if (this.options.stopEvent) if (this.options.stopEvent)
e.stop(); e.stop();
//record this as the trigger // record this as the trigger
this.options.element = $(el); this.options.element = $(el);
this.adjustMenuPosition(e); this.adjustMenuPosition(e);
//show the menu // show the menu
this.show(); this.show();
}, },
//get things started // get things started
startListener: function() { startListener: function() {
/* all elements */ /* all elements */
this.targets.each((el) => { this.targets.each((el) => {
@ -225,7 +225,7 @@ window.qBittorrent.ContextMenu = (function() {
}); });
}, this); }, this);
//hide on body click // hide on body click
$(document.body).addEvent("click", () => { $(document.body).addEvent("click", () => {
this.hide(); this.hide();
}); });
@ -233,7 +233,7 @@ window.qBittorrent.ContextMenu = (function() {
updateMenuItems: function() {}, updateMenuItems: function() {},
//show menu // show menu
show: function(trigger) { show: function(trigger) {
if (lastShownContextMenu && (lastShownContextMenu !== this)) if (lastShownContextMenu && (lastShownContextMenu !== this))
lastShownContextMenu.hide(); lastShownContextMenu.hide();
@ -243,11 +243,11 @@ window.qBittorrent.ContextMenu = (function() {
return this; return this;
}, },
//hide the menu // hide the menu
hide: function(trigger) { hide: function(trigger) {
if (lastShownContextMenu && (lastShownContextMenu.menu.style.visibility !== "hidden")) { if (lastShownContextMenu && (lastShownContextMenu.menu.style.visibility !== "hidden")) {
this.fx.start(0); this.fx.start(0);
//this.menu.fade('out'); // this.menu.fade('out');
this.fireEvent("hide"); this.fireEvent("hide");
} }
return this; return this;
@ -263,31 +263,31 @@ window.qBittorrent.ContextMenu = (function() {
return this.menu.getElement("a[href$=" + item + "]").firstChild.style.opacity !== "0"; return this.menu.getElement("a[href$=" + item + "]").firstChild.style.opacity !== "0";
}, },
//hide an item // hide an item
hideItem: function(item) { hideItem: function(item) {
this.menu.getElement("a[href$=" + item + "]").parentNode.addClass("invisible"); this.menu.getElement("a[href$=" + item + "]").parentNode.addClass("invisible");
return this; return this;
}, },
//show an item // show an item
showItem: function(item) { showItem: function(item) {
this.menu.getElement("a[href$=" + item + "]").parentNode.removeClass("invisible"); this.menu.getElement("a[href$=" + item + "]").parentNode.removeClass("invisible");
return this; return this;
}, },
//disable the entire menu // disable the entire menu
disable: function() { disable: function() {
this.options.disabled = true; this.options.disabled = true;
return this; return this;
}, },
//enable the entire menu // enable the entire menu
enable: function() { enable: function() {
this.options.disabled = false; this.options.disabled = false;
return this; return this;
}, },
//execute an action // execute an action
execute: function(action, element) { execute: function(action, element) {
if (this.options.actions[action]) if (this.options.actions[action])
this.options.actions[action](element, this, action); this.options.actions[action](element, this, action);

View File

@ -3126,7 +3126,7 @@ window.qBittorrent.DynamicTable = (function() {
}; };
this.columns["type"].updateTd = function(td, row) { this.columns["type"].updateTd = function(td, row) {
//Type of the message: Log::NORMAL: 1, Log::INFO: 2, Log::WARNING: 4, Log::CRITICAL: 8 // Type of the message: Log::NORMAL: 1, Log::INFO: 2, Log::WARNING: 4, Log::CRITICAL: 8
let logLevel, addClass; let logLevel, addClass;
switch (this.getRowValue(row).toInt()) { switch (this.getRowValue(row).toInt()) {
case 1: case 1:

View File

@ -76,7 +76,7 @@ window.qBittorrent.PropWebseeds = (function() {
this.updateRow(tableRow, row); this.updateRow(tableRow, row);
return; return;
} }
//this.removeRow(id); // this.removeRow(id);
const tr = new Element("tr"); const tr = new Element("tr");
this.rows.set(url, tr); this.rows.set(url, tr);
for (let i = 0; i < row.length; ++i) { for (let i = 0; i < row.length; ++i) {

View File

@ -376,7 +376,7 @@
})); }));
} }
} }
//filter read articles if "Unread" feed is selected // filter read articles if "Unread" feed is selected
if (path === "") if (path === "")
visibleArticles = visibleArticles.filter((a) => !a.isRead); visibleArticles = visibleArticles.filter((a) => !a.isRead);
@ -427,7 +427,7 @@
$("rssDetailsView").append(torrentDescription); $("rssDetailsView").append(torrentDescription);
document.getElementById("rssDescription").srcdoc = '<html><head><link rel="stylesheet" type="text/css" href="css/style.css" /></head><body>' + article.description + "</body></html>"; document.getElementById("rssDescription").srcdoc = '<html><head><link rel="stylesheet" type="text/css" href="css/style.css" /></head><body>' + article.description + "</body></html>";
//calculate height to fill screen // calculate height to fill screen
document.getElementById("rssDescription").style.height = document.getElementById("rssDescription").style.height =
"calc(100% - " + document.getElementById("rssTorrentDetailsName").offsetHeight + "px - " "calc(100% - " + document.getElementById("rssTorrentDetailsName").offsetHeight + "px - "
+ document.getElementById("rssTorrentDetailsDate").offsetHeight + "px - 5px)"; + document.getElementById("rssTorrentDetailsDate").offsetHeight + "px - 5px)";

View File

@ -28,7 +28,7 @@
}; };
}; };
//create a context menu // create a context menu
const contextMenu = new window.qBittorrent.ContextMenu.TorrentsTableContextMenu({ const contextMenu = new window.qBittorrent.ContextMenu.TorrentsTableContextMenu({
targets: ".torrentsTableContextMenuTarget", targets: ".torrentsTableContextMenuTarget",
menu: "torrentsTableMenu", menu: "torrentsTableMenu",