From 4a6ff9cbe2f13c356e6a633231a93ba172000866 Mon Sep 17 00:00:00 2001 From: Q Date: Sun, 14 Nov 2021 11:24:28 +0200 Subject: [PATCH 1/2] okay, lets add a little js arrow keys interaction --- mirva/__init__.py | 2 +- mirva/mirva.py | 39 ++----------------------- mirva/resources/mirva.js | 61 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 38 deletions(-) create mode 100644 mirva/resources/mirva.js diff --git a/mirva/__init__.py b/mirva/__init__.py index 1b2a501..3dff957 100644 --- a/mirva/__init__.py +++ b/mirva/__init__.py @@ -1,4 +1,4 @@ -__version__ = "20210920.1" +__version__ = "20211114.0" def get_version(): diff --git a/mirva/mirva.py b/mirva/mirva.py index dd5fb88..f9a102e 100755 --- a/mirva/mirva.py +++ b/mirva/mirva.py @@ -158,43 +158,7 @@ Released : 20110306 {page_title} - +
@@ -303,6 +267,7 @@ function create_button(direction, to) {{ "arrow_down.png", "banner.jpg", "mirva.ico", + "mirva.js", ): if os.path.exists(os.path.join(self.resource_dir, f)): continue diff --git a/mirva/resources/mirva.js b/mirva/resources/mirva.js new file mode 100644 index 0000000..7c418a5 --- /dev/null +++ b/mirva/resources/mirva.js @@ -0,0 +1,61 @@ +let current=0; +function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()} +r(function(){ + create_nav(); + document.onkeydown = keyboard_entry; + +}); +function create_nav() { + let navis = document.getElementsByClassName("navigation"); + for (let i = 0; i Date: Sun, 14 Nov 2021 15:44:52 +0200 Subject: [PATCH 2/2] discard other keypresses --- README.md | 54 +++++++++++++++++++++------------------- mirva/resources/mirva.js | 45 ++++++++++++++++++++++++--------- 2 files changed, 61 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 752f093..401c3a8 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,28 @@ -# Mirva - -A tool to create a web gallery from a single folder of images. -Also .mp4 files are included in the gallery - -## Installation - -Usage requires ImageMagick binaries! Make sure you have `convert` in PATH. - -Use pip or similar to install from source. - -ex. - -`pip3 install --user --upgrade https://bitbucket.org/MoonQ/mirva/get/master.zip` - -or `pipx install https://bitbucket.org/MoonQ/mirva/get/master.zip` - -## Usage - -Use the command line tool `mirva` to render web sites. - - -## Acknowledgements - -Thank you Mirva for being a lustrous source of inspiration - May you stay -full of joy and love! +# Mirva + +A tool to create a web gallery from a single folder of images. +Also .mp4 files are included in the gallery + +## Installation + +Usage requires ImageMagick binaries! Make sure you have `convert` in PATH. + +Use pip or similar to install from source. + +ex. + +`pip3 install --user --upgrade https://bitbucket.org/MoonQ/mirva/get/master.zip` + +or `pipx install https://bitbucket.org/MoonQ/mirva/get/master.zip` + +## Usage + +Use the command line tool `mirva` to render web sites. + +note: Arrow keys left/right on web page move between images. + + +## Acknowledgements + +Thank you Mirva for being a lustrous source of inspiration - May you stay +full of joy and love! diff --git a/mirva/resources/mirva.js b/mirva/resources/mirva.js index 7c418a5..9f09d31 100644 --- a/mirva/resources/mirva.js +++ b/mirva/resources/mirva.js @@ -1,8 +1,9 @@ -let current=0; +let current=-1; function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()} r(function(){ create_nav(); document.onkeydown = keyboard_entry; + document.onwheel = scroll_event; }); function create_nav() { @@ -35,25 +36,45 @@ function create_button(direction, to, next) { container.appendChild(button); return container } +function is_visible(el) { + let rect = el.getBoundingClientRect(); + return rect.top < window.innerHeight && rect.bottom >= 0; +} +function scroll_event(ev) { + let navis = document.getElementsByClassName("navigation"); + for (let i = 0; i