From 478b89a433fd8d179680aa81a2b8d28a7ac571c1 Mon Sep 17 00:00:00 2001 From: Pierre Dubouilh Date: Tue, 11 Dec 2018 19:08:35 +0100 Subject: [PATCH] theme --- Makefile | 1 + src/page.tmpl | 10 +++++++++- src/script.js | 17 +++++++++++------ src/style.css | 11 +++++++---- src/theme.css | 7 +++++++ 5 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 src/theme.css diff --git a/Makefile b/Makefile index e622282..7b18662 100755 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ embed: cp src/main.go gossa.go perl -pe 's/template_will_be_here/`cat src\/page.tmpl`/ge' -i gossa.go perl -pe 's/css_will_be_here/`cat src\/style.css`/ge' -i gossa.go + perl -pe 's/theme_will_be_here/`cat src\/theme.css`/ge' -i gossa.go perl -pe 's/js_will_be_here/`cat src\/script.js`/ge' -i gossa.go perl -pe 's/favicon_will_be_here/`base64 -w0 src\/favicon.png`/ge' -i gossa.go diff --git a/src/page.tmpl b/src/page.tmpl index 508a895..df2c0b2 100644 --- a/src/page.tmpl +++ b/src/page.tmpl @@ -5,8 +5,16 @@ {{.Title}} - + + + diff --git a/src/script.js b/src/script.js index 0e6febd..252e35e 100755 --- a/src/script.js +++ b/src/script.js @@ -163,6 +163,11 @@ const setBackgroundLinks = t => { t.style.backgroundColor = 'rgba(123, 123, 123, const getLink = e => e.target.parentElement.querySelectorAll('a.list-links')[0] +upGrid.ondragleave = e => { + cancelDefault(e) + upGrid.style.display = 'none' +} + document.ondragenter = e => { if (isPicMode()) { return } cancelDefault(e) @@ -181,10 +186,7 @@ document.ondragenter = e => { } } -upGrid.ondragleave = e => { - cancelDefault(e) - upGrid.style.display = 'none' -} +document.ondragend = e => resetBackgroundLinks() document.ondragover = e => { cancelDefault(e) @@ -402,7 +404,7 @@ document.body.addEventListener('keydown', e => { return prevent(e) || picsNav(false) || prevPage() case 'Escape': - return prevent(e) || picsOff() + return prevent(e) || resetBackgroundLinks() || picsOff() } // Ctrl keys @@ -426,11 +428,14 @@ document.body.addEventListener('keydown', e => { case 'KeyD': return prevent(e) || isPicMode() || window.mkdirBtn() + + case 'KeyB': + return prevent(e) || toggleTheme() } } // text search - if (e.code.includes('Key')) { + if (e.code.includes('Key') && !e.ctrlKey && !e.metaKey) { typedPath += e.code.replace('Key', '').toLocaleLowerCase() clearTimeout(typedToken) typedToken = setTimeout(() => { typedPath = '' }, 1000) diff --git a/src/style.css b/src/style.css index 5dbaa44..319ed0f 100755 --- a/src/style.css +++ b/src/style.css @@ -1,3 +1,9 @@ +a { + text-decoration: none; + background-color: transparent !important; + /* border-bottom: .01em solid #dfe6e9; */ +} + .icon { display: block; height: 16px; @@ -75,7 +81,6 @@ h1 { } #progress { - background-color: white; width: 99%; left: 0.5%; right: 0.5%; @@ -83,7 +88,6 @@ h1 { bottom: 0px; padding-bottom: 10px; max-height: 50%; - overflow-y: scroll; overflow-x: hidden; } @@ -118,10 +122,9 @@ h1 { text-align: center; font-size: 4em; font-family: Helvetica; - background-color: white; color: green; opacity: 0.8; - backdrop-filter: grayscale(100%); + background-color: rgba(123, 123, 123, 0.2) } #pics { diff --git a/src/theme.css b/src/theme.css new file mode 100644 index 0000000..b67272f --- /dev/null +++ b/src/theme.css @@ -0,0 +1,7 @@ +html, a { + background-color: #2d3436; color: #dfe6e9; +} + +.arrow, .icon-large-images { + filter: invert(100%) !important; +}