mirror of
https://github.com/captn3m0/news.git
synced 2024-09-20 00:57:02 +00:00
9 lines
384 B
JavaScript
9 lines
384 B
JavaScript
let x = localStorage.getItem('hiddenTopics');
|
|
let hiddenTopics = x ? JSON.parse(x) : [];
|
|
// Create a new style element that hides all
|
|
// elements with the data-topic=$topic attribute
|
|
innerStyle = "";
|
|
for (let topic of hiddenTopics) {
|
|
innerStyle += `.topic-${topic} {display:none} `;
|
|
}
|
|
document.head.insertAdjacentHTML("beforeend", `<style id="hidden-style">${innerStyle}</style>`) |