mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-03 17:54:54 +02:00
Fix:Library collapsed series to respect ignore prefixes setting #866
This commit is contained in:
parent
377ae7ab19
commit
06b8d1194c
6 changed files with 28 additions and 16 deletions
|
@ -135,4 +135,16 @@ module.exports.cleanStringForSearch = (str) => {
|
|||
if (!str) return ''
|
||||
// Remove ' . ` " ,
|
||||
return str.toLowerCase().replace(/[\'\.\`\",]/g, '').trim()
|
||||
}
|
||||
|
||||
module.exports.getTitleIgnorePrefix = (title) => {
|
||||
if (!title) return ''
|
||||
var prefixesToIgnore = global.ServerSettings.sortingPrefixes || []
|
||||
for (const prefix of prefixesToIgnore) {
|
||||
// e.g. for prefix "the". If title is "The Book" return "Book, The"
|
||||
if (title.toLowerCase().startsWith(`${prefix} `)) {
|
||||
return title.substr(prefix.length + 1) + `, ${prefix.substr(0, 1).toUpperCase() + prefix.substr(1)}`
|
||||
}
|
||||
}
|
||||
return title
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue