Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to perspective-warp the input image before motion-detection #153

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
use left/right arrow keys to move between images in the webserver int…
…erface
  • Loading branch information
jeremybmerrill committed Nov 8, 2023
commit 2463295f1a3e93a4e73a74d3b019b7a0cb3bade4
23 changes: 23 additions & 0 deletions webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,29 @@ def list_directory(self, path):
tpath, cur_folder = os.path.split(self.path)
f.write(b"<html><title>%s %s</title>" % (WEB_PAGE_TITLE.encode('utf-8'), self.path.encode('utf-8')))
f.write(b"<body>")
f.write(b"""
<script>

document.onkeydown = checkKey;

function checkKey(e) {

e = e || window.event;

var indexOfCurrentImg = Math.max(0, Array.from(document.querySelectorAll('a[target="imgbox"')).map((a) => a.href).indexOf(document.getElementsByTagName("iframe")[0].contentDocument.URL ))
var nextA = Array.from(document.querySelectorAll('a[target="imgbox"'))[indexOfCurrentImg-1]
var prevA = Array.from(document.querySelectorAll('a[target="imgbox"'))[indexOfCurrentImg+1]

if (e.keyCode == '37') { // left arrow
prevA.click()
}
else if (e.keyCode == '39') { // right arrow
nextA.click()
}

}
</script>
""")
# Start Left iframe Image Panel
f.write(b'<iframe width="%s" height="%s" align="left"'
% (WEB_IFRAME_WIDTH_PERCENT.encode('utf-8'), WEB_IMAGE_HEIGHT.encode('utf-8')))
Expand Down