Skip to content

Commit

Permalink
bw
Browse files Browse the repository at this point in the history
  • Loading branch information
pldubouilh committed Dec 11, 2018
1 parent 3ff1c03 commit c517f7b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
25 changes: 20 additions & 5 deletions src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -365,6 +367,16 @@ function onPaste () {
mvCall(root, dest + filename, onPaste)
}

// dark mode
const darkMode = 'html, a { background-color: #2d3436; color: #dfe6e9; } .arrow, .icon-large-images { filter: invert(100%) !important; }'
const extraCss = document.createElement('style')
document.body.appendChild(extraCss);

const currentMode = () => localStorage.getItem('colorMode')
const setMode = () => { extraCss.innerHTML = currentMode() === 'dark' ? darkMode : '' }
const toggleBWMode = () => localStorage.setItem('colorMode', currentMode() === 'dark' ? 'white' : 'dark') || setMode()
setMode()

// Kb handler
let typedPath = ''
let typedToken = null
Expand Down Expand Up @@ -402,7 +414,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
Expand All @@ -426,6 +438,9 @@ document.body.addEventListener('keydown', e => {

case 'KeyD':
return prevent(e) || isPicMode() || window.mkdirBtn()

case 'KeyB':
return prevent(e) || toggleBWMode()
}
}

Expand Down
11 changes: 7 additions & 4 deletions src/style.css

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

0 comments on commit c517f7b

Please sign in to comment.