X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/e711290d8b1ce06b38e0560248806e8de2077870..e2409a5fab3e38e1753adb51ff432b6104c7572b:/resources/js/components/shelf-sort.js diff --git a/resources/js/components/shelf-sort.js b/resources/js/components/shelf-sort.js index 303ad8df2..01ca11a33 100644 --- a/resources/js/components/shelf-sort.js +++ b/resources/js/components/shelf-sort.js @@ -5,13 +5,13 @@ import {Component} from './component'; * @type {Object} */ const itemActions = { - move_up(item, shelfBooksList, allBooksList) { + move_up(item) { const list = item.parentNode; const index = Array.from(list.children).indexOf(item); const newIndex = Math.max(index - 1, 0); list.insertBefore(item, list.children[newIndex] || null); }, - move_down(item, shelfBooksList, allBooksList) { + move_down(item) { const list = item.parentNode; const index = Array.from(list.children).indexOf(item); const newIndex = Math.min(index + 2, list.children.length); @@ -20,7 +20,7 @@ const itemActions = { remove(item, shelfBooksList, allBooksList) { allBooksList.appendChild(item); }, - add(item, shelfBooksList, allBooksList) { + add(item, shelfBooksList) { shelfBooksList.appendChild(item); }, }; @@ -62,7 +62,7 @@ export class ShelfSort extends Component { } }); - this.bookSearchInput.addEventListener('input', event => { + this.bookSearchInput.addEventListener('input', () => { this.filterBooksByName(this.bookSearchInput.value); }); @@ -121,10 +121,10 @@ export class ShelfSort extends Component { const bProp = bookB.dataset[sortProperty].toLowerCase(); if (reverse) { - return aProp < bProp ? (aProp === bProp ? 0 : 1) : -1; + return bProp.localeCompare(aProp); } - return aProp < bProp ? (aProp === bProp ? 0 : -1) : 1; + return aProp.localeCompare(bProp); }); for (const book of books) {