diff --git a/bin/build-index.py b/bin/build-index.py index 340b2be81b6..7404dfacea2 100644 --- a/bin/build-index.py +++ b/bin/build-index.py @@ -644,6 +644,7 @@ def escape_html(text): }); function sortRecent() { + window.localStorage.setItem('index-sort', 'recent'); specList.querySelectorAll('.group-header').forEach(function(h) { h.remove(); }); specs.sort(function(a, b) { return parseInt(b.dataset.ts) - parseInt(a.dataset.ts); @@ -657,6 +658,7 @@ def escape_html(text): } function sortGrouped() { + window.localStorage.setItem('index-sort', 'grouped'); specList.querySelectorAll('.group-header').forEach(function(h) { h.remove(); }); specs.sort(function(a, b) { var c = a.dataset.shortname.localeCompare(b.dataset.shortname); @@ -685,6 +687,9 @@ def escape_html(text): btnRecent.addEventListener('click', sortRecent); btnGrouped.addEventListener('click', sortGrouped); + if (window.localStorage.getItem('index-sort') === 'grouped') { + sortGrouped(); + } // Mobile: tap spec header to expand/collapse (accordion) specs.forEach(function(el) {