Skip to content

Commit 64f6f08

Browse files
authored
Merge pull request #78 from kidneyhex/persist-show-all
index.js - persist showAll across refreshLibrary calls
2 parents 40bc711 + cc1d907 commit 64f6f08

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

js/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ let chips = Array.from(document.querySelectorAll('.filter-nav .chip')).map(chip
583583

584584

585585
let activeSort = '';
586-
586+
let libraryShowAll = false; // perist whether user chose to view all apps
587587
// Update the sort state to match the current sort value
588588
function refreshSort(){
589589
let sortContainer = document.querySelector("#librarycontainer .sort-nav");
@@ -596,6 +596,7 @@ function refreshLibrary(options) {
596596
options = options||{};
597597
// options.dontChangeSearchBox : bool -> don't update the value in the search box
598598
// options.showAll : bool -> don't restrict the numbers of apps that are shown
599+
if (options.showAll) libraryShowAll = true; // remember expansion choice
599600
let panelbody = document.querySelector("#librarycontainer .panel-body");
600601
// Work out what we should be filtering, based on the URL
601602
let searchType = ""; // possible values: hash, chip, full, id
@@ -717,7 +718,7 @@ function refreshLibrary(options) {
717718
}
718719

719720
let viewMoreText = "";
720-
if (!options.showAll && visibleApps.length > Const.MAX_APPS_SHOWN) {
721+
if (!libraryShowAll && visibleApps.length > Const.MAX_APPS_SHOWN) {
721722
viewMoreText = `<div class="tile column col-6 col-sm-12 col-xs-12 app-tile" onclick="javascript:refreshLibrary({dontChangeSearchBox:true,showAll:true})" style="cursor: pointer;">
722723
<div class="tile-icon">
723724
<figure class="avatar"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAACp0lEQVR4nO1Zu24TQRRd8Sig49Xw+AwQfAA/ABGg0CLSugNSk5A6CkaI8ANBoQBE6w4JaT2XGGfv7N67hU0oIA4tCc2g65CQrL141/sYW/hIR7J2R55z587jzlnHmWCCCTJjxZijdY+uKaRZpWkVkNeVph+g+ZdQfivNTXmnPHrkesFVY8wRxzY+E11SSAsKeQM0mzRUyF8A6claEFwsXbgKgnNK83OleSet8J5ANO8AUvWj550pRzyG00rTVlbhfdj5pOl2YcJd1z0OyC8KEG4Ok57VarVjOYv/ehKQ3hcvnv+sD3onfeY48uWJhwNB5JKJcqYN9ydSNaP48K418Xp/TdwaSrxsa4C8aT8A7rhan00dgOzzIyDe7K4HXkolXk7HPA6pHAPYBt+/kHz0kRZsi4ZezicSL0VWt06xL9hEsrAhRePAAKSqtC0W4uiHV5JMn1nrQnVMFnT4MEkAr20LhXi+GhyA5mbcH7jrvplbWjY37lfMzZmKmX+63H1WdDvYzwA1EgQQXypLB9en7x2iPCu6HewReTNJBmL3fxmpaIfyrOh2sJcB5O1MAUiaox1OzVQKbwfpAkg5haovC28HKafQPxexdCojN2hx5tkOUi7i1QTbmS2ujPVBBpofDAxATKcREGr6T6HwctJirm1bLPSQWondPHHM7AvmKOec/+ZCIxBHwLZw+MtFJy2azfZpQP4+AuI7Q/umdZ/v2A5AYTDlZIF4lWM1daKQe6iNS47S9DY3k1eMVvEqyxPPbz602yecPCGjUdLOtJi7vX4Q4lUWYTkqpG+ZF2yaLVbsvu4Bk1U80k8Z9UajdcopG3I6imM2XO1ELaX5cR3xvGMbUmSJ6SS+jVgfcvGQm52UI7ukLUBak3dSEktVORKfWSeYwBl//AaTJ2VUxIlIxgAAAABJRU5ErkJggg=="></figure>

0 commit comments

Comments
 (0)