Apply suggestions from code review

This commit is contained in:
skomerko 2024-12-09 12:00:16 +01:00
commit ec8a970716
3 changed files with 21 additions and 21 deletions

View file

@ -56,7 +56,7 @@
}); });
const checkboxTH = tableHeaders[0]; const checkboxTH = tableHeaders[0];
checkboxTH.appendChild(checkboxHeader); checkboxTH.append(checkboxHeader);
} }
// Register keyboard events to modal window // Register keyboard events to modal window

View file

@ -501,7 +501,7 @@ window.qBittorrent.DynamicTable ??= (() => {
ul.firstElementChild.classList.add("separator"); ul.firstElementChild.classList.add("separator");
ul.insertBefore(autoResizeAllElement, ul.firstElementChild); ul.insertBefore(autoResizeAllElement, ul.firstElementChild);
ul.insertBefore(autoResizeElement, ul.firstElementChild); ul.insertBefore(autoResizeElement, ul.firstElementChild);
document.body.appendChild(ul); document.body.append(ul);
this.headerContextMenu = new DynamicTableHeaderContextMenuClass({ this.headerContextMenu = new DynamicTableHeaderContextMenuClass({
targets: "#" + this.dynamicTableFixedHeaderDivId + " tr th", targets: "#" + this.dynamicTableFixedHeaderDivId + " tr th",
@ -551,8 +551,8 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns.push(column); this.columns.push(column);
this.columns[name] = column; this.columns[name] = column;
this.hiddenTableHeader.appendChild(document.createElement("th")); this.hiddenTableHeader.append(document.createElement("th"));
this.fixedTableHeader.appendChild(document.createElement("th")); this.fixedTableHeader.append(document.createElement("th"));
}, },
loadColumnsOrder: function() { loadColumnsOrder: function() {
@ -865,7 +865,7 @@ window.qBittorrent.DynamicTable ??= (() => {
const td = document.createElement("td"); const td = document.createElement("td");
if ((this.columns[k].visible === "0") || this.columns[k].force_hide) if ((this.columns[k].visible === "0") || this.columns[k].force_hide)
td.classList.add("invisible"); td.classList.add("invisible");
tr.appendChild(td); tr.append(td);
} }
// Insert // Insert
@ -1110,7 +1110,7 @@ window.qBittorrent.DynamicTable ??= (() => {
img.src = img_path; img.src = img_path;
img.className = "stateIcon"; img.className = "stateIcon";
img.title = state; img.title = state;
td.appendChild(img); td.append(img);
} }
}; };
@ -1239,7 +1239,7 @@ window.qBittorrent.DynamicTable ??= (() => {
else { else {
if (ProgressColumnWidth < 0) if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth; ProgressColumnWidth = td.offsetWidth;
td.appendChild(new window.qBittorrent.ProgressBar.ProgressBar(progressFormatted.toFloat(), { td.append(new window.qBittorrent.ProgressBar.ProgressBar(progressFormatted.toFloat(), {
"width": ProgressColumnWidth - 5 "width": ProgressColumnWidth - 5
})); }));
td.resized = false; td.resized = false;
@ -2604,7 +2604,7 @@ window.qBittorrent.DynamicTable ??= (() => {
const progressBar = $("pbf_" + id); const progressBar = $("pbf_" + id);
if (progressBar === null) { if (progressBar === null) {
td.appendChild(new window.qBittorrent.ProgressBar.ProgressBar(value.toFloat(), { td.append(new window.qBittorrent.ProgressBar.ProgressBar(value.toFloat(), {
id: "pbf_" + id, id: "pbf_" + id,
width: 80 width: 80
})); }));
@ -2623,7 +2623,7 @@ window.qBittorrent.DynamicTable ??= (() => {
if (window.qBittorrent.PropFiles.isPriorityComboExists(id)) if (window.qBittorrent.PropFiles.isPriorityComboExists(id))
window.qBittorrent.PropFiles.updatePriorityCombo(id, value); window.qBittorrent.PropFiles.updatePriorityCombo(id, value);
else else
td.appendChild(window.qBittorrent.PropFiles.createPriorityCombo(id, row.full_data.fileId, value)); td.append(window.qBittorrent.PropFiles.createPriorityCombo(id, row.full_data.fileId, value));
}; };
this.columns["priority"].staticWidth = 140; this.columns["priority"].staticWidth = 140;
@ -2875,7 +2875,7 @@ window.qBittorrent.DynamicTable ??= (() => {
img.className = "stateIcon"; img.className = "stateIcon";
img.width = "22"; img.width = "22";
img.height = "22"; img.height = "22";
td.appendChild(img); td.append(img);
} }
}; };
}, },
@ -2912,8 +2912,8 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns.push(column); this.columns.push(column);
this.columns[name] = column; this.columns[name] = column;
this.hiddenTableHeader.appendChild(document.createElement("th")); this.hiddenTableHeader.append(document.createElement("th"));
this.fixedTableHeader.appendChild(document.createElement("th")); this.fixedTableHeader.append(document.createElement("th"));
} }
}); });
@ -3000,8 +3000,8 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns.push(column); this.columns.push(column);
this.columns[name] = column; this.columns[name] = column;
this.hiddenTableHeader.appendChild(document.createElement("th")); this.hiddenTableHeader.append(document.createElement("th"));
this.fixedTableHeader.appendChild(document.createElement("th")); this.fixedTableHeader.append(document.createElement("th"));
} }
}); });
@ -3084,8 +3084,8 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns.push(column); this.columns.push(column);
this.columns[name] = column; this.columns[name] = column;
this.hiddenTableHeader.appendChild(document.createElement("th")); this.hiddenTableHeader.append(document.createElement("th"));
this.fixedTableHeader.appendChild(document.createElement("th")); this.fixedTableHeader.append(document.createElement("th"));
}, },
selectRow: function(rowId) { selectRow: function(rowId) {
this.selectedRows.push(rowId); this.selectedRows.push(rowId);
@ -3170,8 +3170,8 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns.push(column); this.columns.push(column);
this.columns[name] = column; this.columns[name] = column;
this.hiddenTableHeader.appendChild(document.createElement("th")); this.hiddenTableHeader.append(document.createElement("th"));
this.fixedTableHeader.appendChild(document.createElement("th")); this.fixedTableHeader.append(document.createElement("th"));
}, },
selectRow: () => {} selectRow: () => {}
}); });
@ -3219,8 +3219,8 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns.push(column); this.columns.push(column);
this.columns[name] = column; this.columns[name] = column;
this.hiddenTableHeader.appendChild(document.createElement("th")); this.hiddenTableHeader.append(document.createElement("th"));
this.fixedTableHeader.appendChild(document.createElement("th")); this.fixedTableHeader.append(document.createElement("th"));
}, },
selectRow: () => {}, selectRow: () => {},
updateRow: function(tr, fullUpdate) { updateRow: function(tr, fullUpdate) {

View file

@ -629,7 +629,7 @@ window.qBittorrent.PropFiles ??= (() => {
checkbox.addEventListener("click", switchCheckboxState); checkbox.addEventListener("click", switchCheckboxState);
const checkboxTH = tableHeaders[0]; const checkboxTH = tableHeaders[0];
checkboxTH.appendChild(checkbox); checkboxTH.append(checkbox);
} }
// default sort by name column // default sort by name column