2021-04-01 16:08:50 +00:00
|
|
|
function showRecentBoards() {
|
2021-04-01 18:40:55 +00:00
|
|
|
var parent = document.getElementById("recent-boards");
|
|
|
|
var ul = document.querySelector("#recent-boards ul");
|
2021-04-01 16:08:50 +00:00
|
|
|
ul && parent.removeChild(ul);
|
|
|
|
parent.classList.add("hidden");
|
|
|
|
|
2021-04-01 18:40:55 +00:00
|
|
|
var recentBoards = JSON.parse(localStorage.getItem("recent-boards")) || [];
|
2021-04-01 16:08:50 +00:00
|
|
|
if (recentBoards.length === 0) return;
|
|
|
|
|
2021-04-01 18:40:55 +00:00
|
|
|
var list = document.createElement("ul");
|
2021-04-01 16:08:50 +00:00
|
|
|
|
2023-11-25 00:37:05 +00:00
|
|
|
recentBoards.forEach(function (name) {
|
2021-04-01 18:40:55 +00:00
|
|
|
var listItem = document.createElement("li");
|
|
|
|
var link = document.createElement("a");
|
|
|
|
link.setAttribute("href", `/boards/${encodeURIComponent(name)}`);
|
2021-04-01 16:08:50 +00:00
|
|
|
link.textContent = name;
|
|
|
|
listItem.appendChild(link);
|
|
|
|
list.appendChild(listItem);
|
|
|
|
});
|
|
|
|
|
|
|
|
parent.appendChild(list);
|
|
|
|
parent.classList.remove("hidden");
|
|
|
|
}
|
2021-04-01 18:40:55 +00:00
|
|
|
|
2023-11-25 00:37:05 +00:00
|
|
|
window.addEventListener("pageshow", showRecentBoards);
|