Implement backward navigation for splited files

This commit is contained in:
KnugiHK
2025-02-09 14:47:05 +08:00
parent 0b2dfa9aba
commit dd75ec4b87
4 changed files with 24 additions and 11 deletions

View File

@@ -817,9 +817,10 @@ def create_html(
render_box,
contact,
w3css,
f"{safe_file_name}-{current_page + 1}.html",
chat,
headline
headline,
next=f"{safe_file_name}-{current_page + 1}.html",
previous=f"{safe_file_name}-{current_page - 1}.html" if current_page > 1 else False
)
render_box = [message]
current_size = 0
@@ -838,9 +839,10 @@ def create_html(
render_box,
contact,
w3css,
False,
chat,
headline
headline,
False,
previous=f"{safe_file_name}-{current_page - 1}.html"
)
else:
output_file_name = f"{output_folder}/{safe_file_name}.html"
@@ -851,9 +853,9 @@ def create_html(
chat.get_messages(),
contact,
w3css,
False,
chat,
headline
headline,
False
)
if current % 10 == 0:
print(f"Generating chats...({current}/{total_row_number})", end="\r")

View File

@@ -132,9 +132,10 @@ def rendering(
msgs,
contact,
w3css,
next,
chat,
headline
headline,
next=False,
previous=False
):
if chat.their_avatar_thumb is None and chat.their_avatar is not None:
their_avatar_thumb = chat.their_avatar
@@ -153,6 +154,7 @@ def rendering(
their_avatar_thumb=their_avatar_thumb,
w3css=w3css,
next=next,
previous=previous,
status=chat.status,
media_base=chat.media_base,
headline=headline

View File

@@ -271,6 +271,10 @@
</div>
</article>
<footer class="w3-center">
<h2>
{% if previous %}
<a href="./{{ previous }}" target="_self">Previous</a>
{% endif %}
<h2>
{% if next %}
<a href="./{{ next }}" target="_self">Next</a>

View File

@@ -166,6 +166,13 @@
<!-- <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-[#aebac1]" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
</svg> -->
{% if previous %}
<a href="./{{ previous }}" target="_self">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-[#aebac1]" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 5l-7 7 7 7" />
</svg>
</a>
{% endif %}
{% if next %}
<a href="./{{ next }}" target="_self">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-[#aebac1]" fill="none" viewBox="0 0 24 24" stroke="currentColor">
@@ -334,9 +341,7 @@
</div>
<footer>
<h2 class="text-center">
{% if next %}
<a href="./{{ next }}" target="_self">Next</a>
{% else %}
{% if not next %}
End of History
{% endif %}
</h2>