|
@@ -68,10 +68,12 @@ class AuthorPage extends BasePage {
|
|
const query = {
|
|
const query = {
|
|
author: req.query.author || '',
|
|
author: req.query.author || '',
|
|
series: req.query.series || '',
|
|
series: req.query.series || '',
|
|
|
|
+ genre: req.query.genre || '',
|
|
|
|
+ del: 0,
|
|
|
|
+ limit: 100,
|
|
|
|
+
|
|
all: req.query.all || '',
|
|
all: req.query.all || '',
|
|
depth: 0,
|
|
depth: 0,
|
|
- del: 0,
|
|
|
|
- limit: 100
|
|
|
|
};
|
|
};
|
|
query.depth = query.author.length + 1;
|
|
query.depth = query.author.length + 1;
|
|
|
|
|
|
@@ -91,6 +93,18 @@ class AuthorPage extends BasePage {
|
|
const filtered = (query.all ? books : this.filterBooks(books, query));
|
|
const filtered = (query.all ? books : this.filterBooks(books, query));
|
|
const sorted = this.sortSeriesBooks(filtered);
|
|
const sorted = this.sortSeriesBooks(filtered);
|
|
|
|
|
|
|
|
+ if (books.length > filtered.length) {
|
|
|
|
+ entry.push(
|
|
|
|
+ this.makeEntry({
|
|
|
|
+ id: 'all_series_books',
|
|
|
|
+ title: '[Все книги серии]',
|
|
|
|
+ link: this.navLink({
|
|
|
|
+ href: `/${this.id}?author=${encodeURIComponent(query.author)}` +
|
|
|
|
+ `&series=${encodeURIComponent(query.series)}&all=1`}),
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
for (const book of sorted) {
|
|
for (const book of sorted) {
|
|
let title = `${book.serno ? `${book.serno}. `: ''}${book.title || 'Без названия'}`;
|
|
let title = `${book.serno ? `${book.serno}. `: ''}${book.title || 'Без названия'}`;
|
|
if (query.all) {
|
|
if (query.all) {
|
|
@@ -106,18 +120,6 @@ class AuthorPage extends BasePage {
|
|
})
|
|
})
|
|
);
|
|
);
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (books.length > filtered.length) {
|
|
|
|
- entry.push(
|
|
|
|
- this.makeEntry({
|
|
|
|
- id: 'all_series_books',
|
|
|
|
- title: 'Все книги серии',
|
|
|
|
- link: this.navLink({
|
|
|
|
- href: `/${this.id}?author=${encodeURIComponent(query.author)}` +
|
|
|
|
- `&series=${encodeURIComponent(query.series)}&all=1`}),
|
|
|
|
- })
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
} else if (query.author && query.author[0] == '=') {
|
|
} else if (query.author && query.author[0] == '=') {
|
|
//книги по автору
|
|
//книги по автору
|
|
@@ -135,7 +137,7 @@ class AuthorPage extends BasePage {
|
|
title: `Серия: ${b.book.series}`,
|
|
title: `Серия: ${b.book.series}`,
|
|
link: this.navLink({
|
|
link: this.navLink({
|
|
href: `/${this.id}?author=${encodeURIComponent(query.author)}` +
|
|
href: `/${this.id}?author=${encodeURIComponent(query.author)}` +
|
|
- `&series=${encodeURIComponent(b.book.series)}`}),
|
|
|
|
|
|
+ `&series=${encodeURIComponent(b.book.series)}&genre=${encodeURIComponent(query.genre)}`}),
|
|
})
|
|
})
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
@@ -151,15 +153,25 @@ class AuthorPage extends BasePage {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- //поиск по каталогу
|
|
|
|
- const queryRes = await this.opdsQuery('author', query, 'Остальные авторы');
|
|
|
|
|
|
+ if (query.depth == 1 && !query.genre && !query.others) {
|
|
|
|
+ entry.push(
|
|
|
|
+ this.makeEntry({
|
|
|
|
+ id: 'select_genre',
|
|
|
|
+ title: '[Выбрать жанр]',
|
|
|
|
+ link: this.navLink({href: `/genre?from=${this.id}`}),
|
|
|
|
+ })
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //навигация по каталогу
|
|
|
|
+ const queryRes = await this.opdsQuery('author', query, '[Остальные авторы]');
|
|
|
|
|
|
for (const rec of queryRes) {
|
|
for (const rec of queryRes) {
|
|
entry.push(
|
|
entry.push(
|
|
this.makeEntry({
|
|
this.makeEntry({
|
|
id: rec.id,
|
|
id: rec.id,
|
|
title: this.bookAuthor(rec.title),//${(query.depth > 1 && rec.count ? ` (${rec.count})` : '')}
|
|
title: this.bookAuthor(rec.title),//${(query.depth > 1 && rec.count ? ` (${rec.count})` : '')}
|
|
- link: this.navLink({href: `/${this.id}?author=${rec.q}`}),
|
|
|
|
|
|
+ link: this.navLink({href: `/${this.id}?author=${rec.q}&genre=${encodeURIComponent(query.genre)}`}),
|
|
})
|
|
})
|
|
);
|
|
);
|
|
}
|
|
}
|