longer scroll timer

This commit is contained in:
Q
2023-09-28 08:50:04 +03:00
parent eb698f244f
commit 3f69c63638
4 changed files with 17 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
__version__ = "20230407.0" __version__ = "20230928.0"
def get_version(): def get_version():

View File

@@ -14,7 +14,6 @@ from tqdm import tqdm
class Mirva: class Mirva:
def __init__(self): def __init__(self):
self.resource_src = os.path.join( self.resource_src = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "resources" os.path.dirname(os.path.abspath(__file__)), "resources"
) )
@@ -52,7 +51,6 @@ class Mirva:
self.file_list = self.get_files() self.file_list = self.get_files()
if self.run_commands["config"]: if self.run_commands["config"]:
self.write_resources() self.write_resources()
updated = self.create_config() updated = self.create_config()
if updated: if updated:
@@ -70,7 +68,6 @@ class Mirva:
print("Gallery written.") print("Gallery written.")
def create_config(self): def create_config(self):
self.config = configparser.RawConfigParser() self.config = configparser.RawConfigParser()
self.config.read(self.config_file) self.config.read(self.config_file)
config_changed = False config_changed = False
@@ -119,7 +116,6 @@ class Mirva:
return config_changed return config_changed
def create_posts(self): def create_posts(self):
self.posts = [] self.posts = []
for c in self.config: for c in self.config:
if c in self.file_list: if c in self.file_list:
@@ -219,7 +215,6 @@ class Mirva:
} }
def get_index(self, posts): def get_index(self, posts):
return """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> return """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Design by TEMPLATED Design by TEMPLATED
@@ -314,7 +309,6 @@ Released : 20110306
) )
def is_created_with_mirva(self): def is_created_with_mirva(self):
with open("index.html", "rt") as fp: with open("index.html", "rt") as fp:
for line in fp.readlines(): for line in fp.readlines():
if line.strip() == '<meta name="generator" content="Mirva" />': if line.strip() == '<meta name="generator" content="Mirva" />':
@@ -322,7 +316,6 @@ Released : 20110306
return False return False
def write_index(self): def write_index(self):
if os.path.exists("index.html"): if os.path.exists("index.html"):
if not self.is_created_with_mirva(): if not self.is_created_with_mirva():
print( print(
@@ -334,7 +327,6 @@ Released : 20110306
fp.write(self.get_index(self.posts)) fp.write(self.get_index(self.posts))
def write_resources(self): def write_resources(self):
try: try:
os.makedirs(self.resource_dir) os.makedirs(self.resource_dir)
except Exception: except Exception:
@@ -383,7 +375,6 @@ Released : 20110306
) )
def write_mediums(self): def write_mediums(self):
try: try:
os.makedirs(self.medium_dir) os.makedirs(self.medium_dir)
except Exception: except Exception:

View File

@@ -59,16 +59,16 @@ function is_visible(el, type) {
function get_position() { function get_position() {
let intro = document.getElementsByClassName("intro"); let intro = document.getElementsByClassName("intro");
for (let i = 0; i < intro.length; i++) { for (let i = 0; i < intro.length; i++) {
if (is_visible(intro[i], "fully")) { if (is_visible(intro[i], "fully")) {
return { return {
"current": -1, "current": -1,
"next": 0, "next": 0,
"previous": -1, "previous": -1,
"type": "top" "type": "top"
}
} }
} }
}
let posts = document.getElementsByClassName("image_wrapper"); let posts = document.getElementsByClassName("image_wrapper");
for (let i = 0; i < posts.length; i++) { for (let i = 0; i < posts.length; i++) {
if (is_visible(posts[i], "fully")) { if (is_visible(posts[i], "fully")) {
@@ -134,8 +134,11 @@ function keyboard_entry(ev) {
return return
} }
if (current == -1) { if (current == -1) {
window.scrollTo({ top: 0, behavior: defaultScroll }); window.scrollTo({
return top: 0,
behavior: defaultScroll
});
return
} }
current = Math.max(0, current); current = Math.max(0, current);
current = Math.min(posts.length - 1, current); current = Math.min(posts.length - 1, current);
@@ -153,6 +156,6 @@ function keyboard_entry(ev) {
scrollTimer = setTimeout(function() { scrollTimer = setTimeout(function() {
scrollTimer = null; scrollTimer = null;
}, },
200 1200
); );
} }

View File

@@ -4,7 +4,7 @@ version = attr: mirva.__version__
license = MIT license = MIT
description = A tool to create a web gallery from a folder of images. description = A tool to create a web gallery from a folder of images.
author = Ville Rantanen author = Ville Rantanen
author_email = ville.q.rantanen@gmail.com author_email = q@six9.net
url = https://bitbucket.org/MoonQ/mirva url = https://bitbucket.org/MoonQ/mirva
download_url = https://bitbucket.org/MoonQ/mirva/get/master.zip download_url = https://bitbucket.org/MoonQ/mirva/get/master.zip
keywords = album, generator, javascript keywords = album, generator, javascript