Skip to content

Commit

Permalink
Fix a couple UI bugs
Browse files Browse the repository at this point in the history
* Ensure '\' and '|' shortcuts always truncate to a second/tenth, which
  was failing when we wanted to round up and go over the media length
* Add the right bulk action separator in the season view after
  changing/reapplying a filter
* Prevent endless filter icons from being prepended to the selected
  season row after applying a new filter when viewing episodes
  • Loading branch information
danrahn committed Feb 27, 2023
1 parent 09e62a7 commit 1cefff2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Client/Script/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ const adjustKeys = {
']' : () => 1000,
'{' : () => -100,
'}' : () => 100,
'\\' : (c) => -(c % 1000) + (c % 1000 < 500 ? 0 : 1000), // Truncate to nearest second
'|' : (c) => -(c % 100) + (c % 100 < 50 ? 0 : 100), // Truncate to nearest tenth
'\\' : (c, m) => -(c % 1000) + ((m - c < 1000 - (c % 1000)) || (c % 1000 < 500) ? 0 : 1000), // Truncate to nearest second
'|' : (c, m) => -(c % 100) + ((m - c < 100 - (c % 100)) || (c % 100 < 50) ? 0 : 100), // Truncate to nearest tenth
};
/* eslint-enable */

Expand All @@ -573,7 +573,7 @@ function timeInputShortcutHandler(e, maxDuration=NaN) {
return; // Don't try to do anything with invalid input
}

const timeDiff = adjustKeys[e.key](currentValueMs) * (e.altKey ? 5 : 1);
const timeDiff = adjustKeys[e.key](currentValueMs, max) * (e.altKey ? 5 : 1);
const newTime = Math.min(max, Math.max(0, currentValueMs + timeDiff));
const newValue = needsHms ? msToHms(newTime) : newTime;

Expand Down
3 changes: 2 additions & 1 deletion Client/Script/ResultRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ class ShowResultRow extends ResultRow {
addRow(this.#sectionTitle.html());
addRow(this.#showTitle.html());
addRow(new BulkActionResultRow(this.show()).buildRow()); // TODO: Make this a class var too?
addRow(buildNode('hr', { style : 'margin-top: 0' }));
const seasons = Object.values(this.#seasons).sort((a, b) => a.season().index - b.season().index);
this.#seasonsFiltered = 0;
let anyShowing = false;
Expand Down Expand Up @@ -954,7 +955,7 @@ class SeasonResultRow extends ResultRow {
return;
}

if ((seasonName.childNodes[0].tagName == 'IMG') == this.#episodesFiltered) {
if ((seasonName.childNodes[0].tagName == 'IMG') == !!this.#episodesFiltered) {
return;
}

Expand Down

0 comments on commit 1cefff2

Please sign in to comment.