diff --git a/client/components/Search/BaseList.js b/client/components/Search/BaseList.js
index ddc7b9d..ba734a6 100644
--- a/client/components/Search/BaseList.js
+++ b/client/components/Search/BaseList.js
@@ -450,6 +450,13 @@ export default class BaseList {
librateFound = searchLibrate.has(book.librate);
}
+ //ext
+ let extFound = !s.ext;
+ if (!extFound) {
+ const searchExt = new Set(s.ext.split('|'));
+ extFound = searchExt.has(book.ext.toLowerCase() || emptyFieldValue);
+ }
+
return (this.showDeleted || !book.del)
&& authorFound
&& filterBySearch(book.series, s.series)
@@ -458,6 +465,7 @@ export default class BaseList {
&& langFound
&& dateFound
&& librateFound
+ && extFound
;
});
}
diff --git a/client/components/Search/Search.vue b/client/components/Search/Search.vue
index b91d940..585e79f 100644
--- a/client/components/Search/Search.vue
+++ b/client/components/Search/Search.vue
@@ -725,6 +725,7 @@ class Search {
result.push(s.genre ? 'Жанр' : '');
result.push(s.date ? 'Дата поступления' : '');
result.push(s.librate ? 'Оценка' : '');
+ result.push(s.ext ? 'Тип файла' : '');
return result.filter(s => s).join(', ');
}
@@ -1104,6 +1105,7 @@ class Search {
lang: (typeof(query.lang) == 'string' ? query.lang : this.langDefault),
date: query.date,
librate: query.librate,
+ ext: query.ext,
page: parseInt(query.page, 10),
limit: parseInt(query.limit, 10) || this.search.limit,
diff --git a/client/components/Search/SelectExtDialog/SelectExtDialog.vue b/client/components/Search/SelectExtDialog/SelectExtDialog.vue
index 5622105..60c3c14 100644
--- a/client/components/Search/SelectExtDialog/SelectExtDialog.vue
+++ b/client/components/Search/SelectExtDialog/SelectExtDialog.vue
@@ -16,7 +16,13 @@
:options="optionsPre"
type="checkbox"
inline
- />
+ >
+
+
+ {{ opt.label }}
+
+
+
@@ -57,12 +63,12 @@ const componentOptions = {
dialogVisible(newValue) {
this.$emit('update:modelValue', newValue);
},
- lang() {
+ ext() {
this.updateTicked();
},
ticked() {
this.checkAllTicked();
- this.updateLang();
+ this.updateExt();
},
}
};
@@ -95,7 +101,13 @@ class SelectExtDialog {
const result = [];
for (const ext of this.extList) {
- result.push({label: ext, value: ext});
+ if (ext.length <= 4)
+ result.push({label: ext, value: ext});
+ }
+
+ for (const ext of this.extList) {
+ if (ext.length > 4)
+ result.push({label: ext, value: ext});
}
return result;
@@ -104,7 +116,7 @@ class SelectExtDialog {
get optionsPre() {
const result = [];
- for (const ext of ['fb2', 'pdf']) {
+ for (const ext of ['fb2', 'epub', 'mobi', 'pdf', 'djvu', 'doc', 'docx', 'rtf', 'xml', 'html', 'txt', 'zip']) {
if (this.extList.includes(ext)) {
result.push({label: ext, value: ext});
}
@@ -145,11 +157,11 @@ class SelectExtDialog {
}
updateTicked() {
- this.ticked = this.ext.split(',').filter(s => s);
+ this.ticked = this.ext.split('|').filter(s => s);
}
- updateLang() {
- this.$emit('update:ext', this.ticked.join(','));
+ updateExt() {
+ this.$emit('update:ext', this.ticked.join('|'));
}
okClick() {
diff --git a/server/core/DbSearcher.js b/server/core/DbSearcher.js
index 8bd36e8..7ba8970 100644
--- a/server/core/DbSearcher.js
+++ b/server/core/DbSearcher.js
@@ -298,7 +298,7 @@ class DbSearcher {
table: 'ext',
rawResult: true,
where: `
- const exts = ${db.esc(query.ext.split(','))};
+ const exts = ${db.esc(query.ext.split('|'))};
const ids = new Set();
for (const l of exts) {