()
| 2752 | bar.setAttribute("aria-valuemax", String(total)); |
| 2753 | bar.setAttribute("aria-valuetext", label); |
| 2754 | } |
| 2755 | |
| 2756 | // -------------------------------------------------------------------------- |
| 2757 | // Persisted view preferences. Only the locale and report annotations used to |
| 2758 | // survive a reload, so the active view, date, day span and untriaged-only |
| 2759 | // toggle were all reset every time the page was refreshed. |
| 2760 | // -------------------------------------------------------------------------- |
| 2761 | |
| 2762 | function persistUiPrefs() { |
| 2763 | try { |
| 2764 | window.localStorage.setItem(UI_PREFS_KEY, JSON.stringify({ |
| 2765 | view: state.currentView || "papers", |
| 2766 | hideTriaged: Boolean(state.hideTriaged), |
| 2767 | paperDate: $("paperDate")?.value || "", |
| 2768 | days: $("daysInput")?.value || "", |
| 2769 | wikiView: state.wikiView || "graph", |
| 2770 | })); |
| 2771 | } catch (error) { |
| 2772 | // Private browsing or a full quota; preferences are a convenience only. |
| 2773 | } |
| 2774 | } |
| 2775 | |
| 2776 | function readUiPrefs() { |
| 2777 | try { |
| 2778 | const parsed = JSON.parse(window.localStorage.getItem(UI_PREFS_KEY) || "{}"); |
| 2779 | return parsed && typeof parsed === "object" ? parsed : {}; |
| 2780 | } catch (error) { |
| 2781 | return {}; |
| 2782 | } |
no test coverage detected