Skip to content

Commit d018bec

Browse files
committed
libdoc: store keyword-wall state to localstorage
1 parent ac97527 commit d018bec

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/robot/htmldata/libdoc/libdoc.html

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ <h1>Opening library documentation failed</h1>
6565
}
6666
scrollToHash();
6767
setTimeout(function() {
68-
document.getElementById("keyword-statistics-header").innerText = '' + libdoc.keywords.length;
68+
document.getElementById("keyword-statistics-header").innerText = '' + libdoc.keywords.length;
69+
if (storage.get('keyword-wall') === 'open') {
70+
openKeywordWall();
71+
}
6972
}, 0);
7073
});
7174

@@ -196,12 +199,26 @@ <h1>Opening library documentation failed</h1>
196199
function toggleShortcuts() {
197200
const shortcuts = document.getElementsByClassName("shortcuts")[0];
198201
if (shortcuts.classList.contains("keyword-wall")) {
199-
shortcuts.classList.remove("keyword-wall");
202+
closeKeywordWall();
200203
} else {
201-
shortcuts.classList.add("keyword-wall");
204+
openKeywordWall();
202205
}
206+
}
207+
208+
function openKeywordWall() {
209+
const shortcuts = document.getElementsByClassName("shortcuts")[0];
210+
shortcuts.classList.add("keyword-wall");
211+
storage.set("keyword-wall", 'open');
212+
const button = document.getElementById("toggle-keyword-shortcuts")
213+
button.innerText = '-';
214+
}
215+
216+
function closeKeywordWall() {
217+
const shortcuts = document.getElementsByClassName("shortcuts")[0];
218+
shortcuts.classList.remove("keyword-wall");
219+
storage.set("keyword-wall", 'close');
203220
const button = document.getElementById("toggle-keyword-shortcuts")
204-
button.innerText = button.innerText === '+' ? '-' : '+';
221+
button.innerText = '+';
205222
}
206223

207224
function resetKeywords() {

0 commit comments

Comments
 (0)