libdoc: store keyword-wall state to localstorage
scrollToHash();
setTimeout(function() {
document.getElementById("keyword-statistics-header").innerText = '' + libdoc.keywords.length;
+ if (storage.get('keyword-wall') === 'open') {
+ openKeywordWall();
+ }
}, 0);
});
function toggleShortcuts() {
const shortcuts = document.getElementsByClassName("shortcuts")[0];
if (shortcuts.classList.contains("keyword-wall")) {
- shortcuts.classList.remove("keyword-wall");
+ closeKeywordWall();
} else {
+ openKeywordWall();
+ }
+ }
+
+ function openKeywordWall() {
+ const shortcuts = document.getElementsByClassName("shortcuts")[0];
shortcuts.classList.add("keyword-wall");
+ storage.set("keyword-wall", 'open');
+ const button = document.getElementById("toggle-keyword-shortcuts")
+ button.innerText = '-';
}
+
+ function closeKeywordWall() {
+ const shortcuts = document.getElementsByClassName("shortcuts")[0];
+ shortcuts.classList.remove("keyword-wall");
+ storage.set("keyword-wall", 'close');
const button = document.getElementById("toggle-keyword-shortcuts")
- button.innerText = button.innerText === '+' ? '-' : '+';
+ button.innerText = '+';
}
function resetKeywords() {
