Добавлено отображение количества найденных значений

This commit is contained in:
Book Pauk
2022-12-02 18:00:09 +07:00
parent 772ea3ca0c
commit 33aea2a194
4 changed files with 46 additions and 24 deletions

View File

@@ -163,13 +163,20 @@ class AuthorPage extends BasePage {
const queryRes = await this.opdsQuery('author', query, '[Остальные авторы]'); const queryRes = await this.opdsQuery('author', query, '[Остальные авторы]');
for (const rec of queryRes) { for (const rec of queryRes) {
entry.push( const e = {
this.makeEntry({
id: rec.id, id: rec.id,
title: this.bookAuthor(rec.title), title: this.bookAuthor(rec.title),
link: this.navLink({href: `/${this.id}?author=${rec.q}&genre=${encodeURIComponent(query.genre)}`}), link: this.navLink({href: `/${this.id}?author=${rec.q}&genre=${encodeURIComponent(query.genre)}`}),
}) };
);
if (rec.count) {
e.content = {
'*ATTRS': {type: 'text'},
'*TEXT': `${rec.count} авторов`,
};
}
entry.push(this.makeEntry(e));
} }
} }

View File

@@ -177,6 +177,7 @@ class BasePage {
id: row.id, id: row.id,
title: `${value.toUpperCase().replace(/ /g, spaceChar)}~`, title: `${value.toUpperCase().replace(/ /g, spaceChar)}~`,
q: encodeURIComponent(value), q: encodeURIComponent(value),
count: row.count,
}; };
} }
if (query.depth > 1 || enru.has(value[0])) { if (query.depth > 1 || enru.has(value[0])) {

View File

@@ -96,13 +96,20 @@ class SeriesPage extends BasePage {
const queryRes = await this.opdsQuery('series', query, '[Остальные серии]'); const queryRes = await this.opdsQuery('series', query, '[Остальные серии]');
for (const rec of queryRes) { for (const rec of queryRes) {
entry.push( const e = {
this.makeEntry({
id: rec.id, id: rec.id,
title: rec.title, title: (rec.count ? rec.title : `Серия: ${rec.title}`),
link: this.navLink({href: `/${this.id}?series=${rec.q}&genre=${encodeURIComponent(query.genre)}`}), link: this.navLink({href: `/${this.id}?series=${rec.q}&genre=${encodeURIComponent(query.genre)}`}),
}) };
);
if (rec.count) {
e.content = {
'*ATTRS': {type: 'text'},
'*TEXT': `${rec.count} серий`,
};
}
entry.push(this.makeEntry(e));
} }
} }

View File

@@ -66,13 +66,20 @@ class TitlePage extends BasePage {
const queryRes = await this.opdsQuery('title', query, '[Остальные названия]'); const queryRes = await this.opdsQuery('title', query, '[Остальные названия]');
for (const rec of queryRes) { for (const rec of queryRes) {
entry.push( const e = {
this.makeEntry({
id: rec.id, id: rec.id,
title: rec.title, title: rec.title,
link: this.navLink({href: `/${this.id}?title=${rec.q}&genre=${encodeURIComponent(query.genre)}`}), link: this.navLink({href: `/${this.id}?title=${rec.q}&genre=${encodeURIComponent(query.genre)}`}),
}) };
);
if (rec.count) {
e.content = {
'*ATTRS': {type: 'text'},
'*TEXT': `${rec.count} названий`,
};
}
entry.push(this.makeEntry(e));
} }
} }