67
67
<el-option :label =" $t('m.artistDescend')" value =" artistDescend" ></el-option >
68
68
<el-option :label =" $t('m.titleAscend')" value =" titleAscend" ></el-option >
69
69
<el-option :label =" $t('m.titleDescend')" value =" titleDescend" ></el-option >
70
+ <el-option :label =" $t('m.pageAscend')" value =" pageAscend" ></el-option >
71
+ <el-option :label =" $t('m.pageDescend')" value =" pageDescend" ></el-option >
70
72
</el-option-group >
71
73
</el-select >
72
74
</el-col >
131
133
@contextmenu =" onBookContextMenu($event, book)"
132
134
/>
133
135
<el-tag class =" book-card-language" size =" small"
134
- :effect =" isChineseTranslatedManga(book) ? 'dark' : 'light'"
135
136
:type =" isChineseTranslatedManga(book) ? 'danger' : 'info'"
136
137
@click =" handleSearchString(`:count=${book.readCount}`)"
137
138
>{{book.readCount}}</el-tag >
175
176
<p class =" book-title" :title =" book.title" >{{book.title}}</p >
176
177
<img class =" book-cover" :src =" book.coverPath" @click =" openCollection(book)" />
177
178
<el-tag class =" book-card-language" size =" small"
178
- :effect =" isChineseTranslatedManga(book) ? 'dark' : 'light'"
179
179
:type =" isChineseTranslatedManga(book) ? 'danger' : 'info'"
180
180
@click =" handleSearchString(`:count=${book.readCount}`)"
181
181
>{{book.readCount}}</el-tag >
360
360
@contextmenu =" onBookContextMenu($event, book)"
361
361
/>
362
362
<el-tag class =" book-card-language" size =" small"
363
- :effect =" isChineseTranslatedManga(book) ? 'dark' : 'light'"
364
363
:type =" isChineseTranslatedManga(book) ? 'danger' : 'info'"
365
364
@click =" handleSearchString(`:count=${book.readCount}`)"
366
365
>{{book.readCount}}</el-tag >
594
593
:setting =" setting"
595
594
@message =" printMessage"
596
595
@resolve-search-result =" resolveSearchResult"
596
+ @service-available =" setServiceAvailable"
597
597
></SearchDialog >
598
598
<Setting
599
599
ref =" SettingRef"
@@ -1309,12 +1309,15 @@ export default defineComponent({
1309
1309
if (type === ' hentag' ) {
1310
1310
book .url = url
1311
1311
this .getBookInfoFromHentag (book)
1312
- } else {
1312
+ } else if (type === ' e-hentai ' ) {
1313
1313
book .url = url
1314
1314
this .getBookInfoFromEh (book)
1315
1315
}
1316
1316
this .$refs .SearchDialogRef .dialogVisibleEhSearch = false
1317
1317
},
1318
+ setServiceAvailable (value ) {
1319
+ this .serviceAvailable = value
1320
+ },
1318
1321
async getBookInfoFromHentag (book ) {
1319
1322
const data = await fetch (` https://hentag.com/public/api/vault/${ book .url .slice (25 )} ` ).then (res => res .json ())
1320
1323
const tags = {}
@@ -1412,21 +1415,21 @@ export default defineComponent({
1412
1415
},
1413
1416
async resetMetadata (book ) {
1414
1417
book .title = this .returnFileName (book)
1415
- book .title_jpn = ' '
1416
- book .posted = 0
1417
- book .filecount = 0
1418
- book .rating = 0
1419
- book .filesize = 0
1420
- book .category = ' '
1418
+ book .title_jpn = null
1419
+ book .posted = null
1420
+ book .filecount = null
1421
+ book .rating = null
1422
+ book .filesize = null
1423
+ book .category = null
1421
1424
book .tags = {}
1422
1425
book .status = ' non-tag'
1423
- book .url = ' '
1426
+ book .url = null
1424
1427
await this .saveBook (book)
1425
1428
},
1426
1429
getBookInfo (book ) {
1427
1430
if (book .url .startsWith (' https://hentag.com' )) {
1428
1431
this .getBookInfoFromHentag (book)
1429
- } else {
1432
+ } else if ( book . url . includes ( ' exhentai ' ) || book . url . includes ( ' e-hentai ' )) {
1430
1433
this .getBookInfoFromEh (book)
1431
1434
}
1432
1435
},
@@ -1572,6 +1575,14 @@ export default defineComponent({
1572
1575
this .displayBookList = bookList .toSorted ((a , b ) => this .getDisplayTitle (b).localeCompare (this .getDisplayTitle (a), undefined , {numeric: true , sensitivity: ' base' }))
1573
1576
this .chunkList ()
1574
1577
break
1578
+ case ' pageAscend' :
1579
+ this .displayBookList = bookList .toSorted (this .sortList (' pageCount' )).toReversed ()
1580
+ this .chunkList ()
1581
+ break
1582
+ case ' pageDescend' :
1583
+ this .displayBookList = bookList .toSorted (this .sortList (' pageCount' ))
1584
+ this .chunkList ()
1585
+ break
1575
1586
default :
1576
1587
this .displayBookList = this .bookList
1577
1588
this .chunkList ()
@@ -1586,7 +1597,7 @@ export default defineComponent({
1586
1597
if (queryString) {
1587
1598
const keywords = [... queryString .matchAll (/ \s + (?=(?:[^ \' "] * [\' "][^ \' "] * [\' "] )* [^ \' "] * $ )/ g )]
1588
1599
if (! _ .isEmpty (keywords)) {
1589
- const nextKeyword = queryString .replace (/ (~| -)? [\w\d 一-龟 ] + :"[- . _\w\d 一-龟 ] + "\$ / g , ' ' ).trim ()
1600
+ const nextKeyword = queryString .replace (/ (~| -)? [\w\d 一-龟 ] + :"[- . _\(\) \ w\d一-龟 ] + "\$ / g , ' ' ).trim ()
1590
1601
if (nextKeyword[0 ] === ' -' || nextKeyword[0 ] === ' ~' ) {
1591
1602
result = _ .filter (options, (str ) => {
1592
1603
return _ .includes (str .value .toLowerCase (), nextKeyword .slice (1 ).toLowerCase ())
@@ -1624,11 +1635,11 @@ export default defineComponent({
1624
1635
},
1625
1636
handleInput (val ) {
1626
1637
try {
1627
- if (/ ^ [\w\d 一-龟 ] + :"[- . _\w\d 一-龟 ] + "\$ $ / .test (val) && this .searchString .trim () !== val .trim ()) {
1638
+ if (/ ^ [\w\d 一-龟 ] + :"[- . _\(\) \ w\d一-龟 ] + "\$ $ / .test (val) && this .searchString .trim () !== val .trim ()) {
1628
1639
const keywords = [... this .searchString .trim ().matchAll (/ \s + (?=(?:[^ \' "] * [\' "][^ \' "] * [\' "] )* [^ \' "] * $ )/ g )]
1629
1640
if (! _ .isEmpty (keywords)) {
1630
- const keyword = this .searchString .replace (/ (~| -)? [\w\d 一-龟 ] + :"[- . _\w\d 一-龟 ] + "\$ / g , ' ' ).trim ()
1631
- const matches = this .searchString .match (/ (~| -)? [\w\d 一-龟 ] + :"[- . _\w\d 一-龟 ] + "\$ / g )
1641
+ const keyword = this .searchString .replace (/ (~| -)? [\w\d 一-龟 ] + :"[- . _\(\) \ w\d一-龟 ] + "\$ / g , ' ' ).trim ()
1642
+ const matches = this .searchString .match (/ (~| -)? [\w\d 一-龟 ] + :"[- . _\(\) \ w\d一-龟 ] + "\$ / g )
1632
1643
if (keyword[0 ] === ' -' ) {
1633
1644
this .searchString = matches .concat ([` -${ val} ` ]).join (' ' )
1634
1645
} else if (keyword[0 ] === ' ~' ) {
@@ -1828,8 +1839,12 @@ export default defineComponent({
1828
1839
this .folderTreeData = await ipcRenderer .invoke (' get-folder-tree' , bookList)
1829
1840
},
1830
1841
async selectFolderTreeNode (selectNode ) {
1831
- const clickLibraryPath = this .setting .library + this .pathSep + selectNode .folderPath
1832
- this .bookList .map (book => book .folderHide = ! book .filepath .startsWith (clickLibraryPath))
1842
+ if (selectNode .folderPath ) {
1843
+ const clickLibraryPath = this .setting .library + this .pathSep + selectNode .folderPath + this .pathSep
1844
+ this .bookList .map (book => book .folderHide = ! book .filepath .startsWith (clickLibraryPath))
1845
+ } else {
1846
+ this .bookList .map (book => book .folderHide = false )
1847
+ }
1833
1848
this .chunkList ()
1834
1849
},
1835
1850
handleNodeExpand (nodeObject ) {
@@ -1866,6 +1881,7 @@ export default defineComponent({
1866
1881
const mark = _ .some (collectBook, ' mark' )
1867
1882
const pageDiff = _ .some (collectBook, ' pageDiff' ) ? true : undefined
1868
1883
const readCount = _ .max (collectBook .map (book => book .readCount ))
1884
+ const pageCount = _ .sum (collectBook .map (book => book .pageCount ))
1869
1885
const tags = _ .mergeWith ({}, ... collectBook .map (book => book .tags ), (obj , src ) => {
1870
1886
if (_ .isArray (obj) && _ .isArray (src)) {
1871
1887
return [... new Set (obj .concat (src))]
@@ -1882,7 +1898,7 @@ export default defineComponent({
1882
1898
title: collection .title ,
1883
1899
id: collection .id ,
1884
1900
coverPath: collectBook? .[0 ]? .coverPath ,
1885
- date, posted, rating, mtime, mark, tags, title_jpn, category, status, pageDiff, readCount,
1901
+ date, posted, rating, mtime, mark, tags, title_jpn, category, status, pageDiff, readCount, pageCount,
1886
1902
list: collection .list ,
1887
1903
filepath,
1888
1904
isCollection: true ,
@@ -2090,7 +2106,7 @@ export default defineComponent({
2090
2106
resolveGroupTagSelected () {
2091
2107
const letter2cat = _ .invert (this .cat2letter )
2092
2108
let tags = this .groupTagSelected .map (tag => {
2093
- const match = / ([\w\d 一-龟 ] + ):"([- . _\w\d 一-龟 ] + )"\$ / .exec (tag)
2109
+ const match = / ([\w\d 一-龟 ] + ):"([- . _\(\) \ w\d一-龟 ] + )"\$ / .exec (tag)
2094
2110
if (match[1 ] && match[2 ]) {
2095
2111
return {
2096
2112
category: letter2cat[match[1 ]] ? letter2cat[match[1 ]] : match[1 ],
0 commit comments