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