From b2f6b65723d48aad25b10c3909694912b2fcebd9 Mon Sep 17 00:00:00 2001 From: 80B Date: Thu, 7 Jan 2021 22:30:58 +0000 Subject: [PATCH] +.css method to Ls & .hidden class --- index.html | 9 +++++---- style.css | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index f5cf995..c9e092c 100644 --- a/index.html +++ b/index.html @@ -28,13 +28,14 @@ const loadPage = file => { const L = (tag, props = {}, ...kids) => { const el = document.createElement(tag); el.append(...kids); - return Object.assign(el, props); + return Object.assign( el, + { css: (k, v) => el.classList[v ? 'add' : 'remove'](k) }, + props ); }; const filterPages = (allitems, value = search.value.toLowerCase()) => - [...pages.children].forEach(child => ( child.style.display = - allitems || child.innerText.toLowerCase().includes(value) ? 'list-item' - : 'none' )); + [...pages.children].forEach( child => child.css('hidden', + !allitems && !child.innerText.toLowerCase().includes(value) )); const keys = { "f": () => { diff --git a/style.css b/style.css index 612af12..a8e3120 100644 --- a/style.css +++ b/style.css @@ -119,3 +119,5 @@ aside section { 0 3px 1px -2px rgba(0,0,0,0.20), 0 1px 5px 0px rgba(0,0,0,0.12); } + +.hidden { display: none !important; } -- 2.54.0