diff --git a/public/js/sort-items.js b/public/js/sort-items.js index 600f204..6b7e70c 100644 --- a/public/js/sort-items.js +++ b/public/js/sort-items.js @@ -1,6 +1,10 @@ $(() => { + const titleID = $('.data').attr('data-title-id') || 'library'; + const sortItems = () => { const sort = $('#sort-select').find(':selected').attr('id'); + localStorage.setItem(`sort-${titleID}`, sort); + const ary = sort.split('-'); const by = ary[0]; const dir = ary[1]; @@ -115,7 +119,10 @@ $(() => { sortItems(); }); - if ($('option#auto-up').length > 0) + const sortID = localStorage.getItem(`sort-${titleID}`); + if (sortID) + $(`option#${sortID}`).attr('selected', ''); + else if ($('option#auto-up').length > 0) $('option#auto-up').attr('selected', ''); else $('option#name-up').attr('selected', ''); diff --git a/src/views/title.html.ecr b/src/views/title.html.ecr index b926a5a..45cee1f 100644 --- a/src/views/title.html.ecr +++ b/src/views/title.html.ecr @@ -1,3 +1,4 @@ +

<%= title.display_name %>