浏览代码

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

Book Pauk 2 年之前
父节点
当前提交
33aea2a194
共有 4 个文件被更改,包括 46 次插入24 次删除
  1. 15 8
      server/core/opds/AuthorPage.js
  2. 1 0
      server/core/opds/BasePage.js
  3. 15 8
      server/core/opds/SeriesPage.js
  4. 15 8
      server/core/opds/TitlePage.js

+ 15 - 8
server/core/opds/AuthorPage.js

@@ -162,14 +162,21 @@ class AuthorPage extends BasePage {
             //навигация по каталогу
             const queryRes = await this.opdsQuery('author', query, '[Остальные авторы]');
 
-            for (const rec of queryRes) {                
-                entry.push(
-                    this.makeEntry({
-                        id: rec.id,
-                        title: this.bookAuthor(rec.title),
-                        link: this.navLink({href: `/${this.id}?author=${rec.q}&genre=${encodeURIComponent(query.genre)}`}),
-                    })
-                );
+            for (const rec of queryRes) {
+                const e = {
+                    id: rec.id,
+                    title: this.bookAuthor(rec.title),
+                    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));
             }
         }
 

+ 1 - 0
server/core/opds/BasePage.js

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

+ 15 - 8
server/core/opds/SeriesPage.js

@@ -95,14 +95,21 @@ class SeriesPage extends BasePage {
             //навигация по каталогу
             const queryRes = await this.opdsQuery('series', query, '[Остальные серии]');
 
-            for (const rec of queryRes) {                
-                entry.push(
-                    this.makeEntry({
-                        id: rec.id,
-                        title: rec.title,
-                        link: this.navLink({href: `/${this.id}?series=${rec.q}&genre=${encodeURIComponent(query.genre)}`}),
-                    })
-                );
+            for (const rec of queryRes) {
+                const e = {
+                    id: rec.id,
+                    title: (rec.count ? rec.title : `Серия: ${rec.title}`),
+                    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));
             }
         }
 

+ 15 - 8
server/core/opds/TitlePage.js

@@ -65,14 +65,21 @@ class TitlePage extends BasePage {
             //навигация по каталогу
             const queryRes = await this.opdsQuery('title', query, '[Остальные названия]');
 
-            for (const rec of queryRes) {                
-                entry.push(
-                    this.makeEntry({
-                        id: rec.id,
-                        title: rec.title,
-                        link: this.navLink({href: `/${this.id}?title=${rec.q}&genre=${encodeURIComponent(query.genre)}`}),
-                    })
-                );
+            for (const rec of queryRes) {
+                const e = {
+                    id: rec.id,
+                    title: rec.title,
+                    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));
             }
         }