fixed history filter restoration
This commit is contained in:
parent
9a37e8552f
commit
4e4f726cbd
|
@ -589,7 +589,6 @@ var Radiostasis = /** @class */ (function () {
|
|||
function Radiostasis() {
|
||||
var _this = this;
|
||||
var _a;
|
||||
this.lastSearch = null;
|
||||
this.debouncer = null;
|
||||
this.playlist = new Playlist(function () { return _this.player; });
|
||||
this.player = new Player(this.playlist);
|
||||
|
@ -620,7 +619,7 @@ var Radiostasis = /** @class */ (function () {
|
|||
};
|
||||
Radiostasis.prototype.wireLoadedFragment = function () {
|
||||
var _this = this;
|
||||
var _a, _b, _c, _d, _e;
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
// save a list of all episodes for the series play/queue buttons
|
||||
var seriesEpisodes = [];
|
||||
// episode play and queue buttons
|
||||
|
@ -702,17 +701,14 @@ var Radiostasis = /** @class */ (function () {
|
|||
// series filter input
|
||||
var filter = (this.main.getElementsByClassName('filter').item(0));
|
||||
if (filter) {
|
||||
if (this.lastSearch) {
|
||||
filter.value = this.lastSearch;
|
||||
this.lastSearch = null;
|
||||
}
|
||||
filter.value = (_f = filter.dataset.search) !== null && _f !== void 0 ? _f : '';
|
||||
var allSeries_1 = this.main.getElementsByTagName('section');
|
||||
filter.addEventListener('input', function () {
|
||||
filter.dataset.search = filter.value;
|
||||
if (_this.debouncer)
|
||||
clearTimeout(_this.debouncer);
|
||||
_this.debouncer = setTimeout(function () {
|
||||
_this.lastSearch = filter.value.toLowerCase();
|
||||
var terms = _this.lastSearch.split(' ');
|
||||
var terms = filter.value.toLowerCase().split(' ');
|
||||
for (var i = 0; i < allSeries_1.length; i++) {
|
||||
var series_1 = allSeries_1.item(i);
|
||||
if (!series_1 || !series_1.dataset.filter)
|
||||
|
|
|
@ -6,7 +6,6 @@ class Radiostasis {
|
|||
// ui element
|
||||
private readonly main: HTMLElement;
|
||||
|
||||
private lastSearch: string | null = null;
|
||||
private debouncer: number | null = null;
|
||||
|
||||
constructor() {
|
||||
|
@ -136,17 +135,13 @@ class Radiostasis {
|
|||
);
|
||||
|
||||
if (filter) {
|
||||
if (this.lastSearch) {
|
||||
filter.value = this.lastSearch;
|
||||
this.lastSearch = null;
|
||||
}
|
||||
|
||||
filter.value = filter.dataset.search ?? '';
|
||||
const allSeries = this.main.getElementsByTagName('section');
|
||||
filter.addEventListener('input', () => {
|
||||
filter.dataset.search = filter.value;
|
||||
if (this.debouncer) clearTimeout(this.debouncer);
|
||||
this.debouncer = setTimeout(() => {
|
||||
this.lastSearch = filter.value.toLowerCase();
|
||||
const terms = this.lastSearch.split(' ');
|
||||
const terms = filter.value.toLowerCase().split(' ');
|
||||
for (let i = 0; i < allSeries.length; i++) {
|
||||
const series = allSeries.item(i);
|
||||
if (!series || !series.dataset.filter) continue;
|
||||
|
|
Loading…
Reference in New Issue