Skip to content

Commit

Permalink
Shave off ten bytes, because I can
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Sep 19, 2024
1 parent 5122e09 commit a7bebd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion feincms3_cookiecontrol/static/f3cc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 6 additions & 10 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const crel = (tagName, attributes = null, children = []) => {

const renderBanner = () => {
if (banner) {
show(banner)
display(banner)
return
}

Expand Down Expand Up @@ -72,7 +72,7 @@ const renderBanner = () => {

const renderModify = () => {
if (modify) {
show(modify)
display(modify)
return
}

Expand All @@ -96,7 +96,7 @@ const renderModify = () => {
[sTextContent]: settings.buttonModify,
onclick: (e) => {
e.preventDefault()
hide(modify)
display(modify, "none")
renderBanner()
},
})
Expand Down Expand Up @@ -131,18 +131,14 @@ const getConsentToAll = () => {
return getCookie() === sAll
}

const show = (el) => {
el.style.display = ""
}

const hide = (el) => {
if (el) el.style.display = "none"
const display = (el, display = "") => {
if (el) el.style.display = display
}

const onAccept = (accept) => (e) => {
e.preventDefault()
setCookie(accept ? sAll : sEssential)
hide(banner)
display(banner, "none")
renderModify()
renderAcceptedEmbeds()
injectAcceptedScripts()
Expand Down

0 comments on commit a7bebd1

Please sign in to comment.