From bbe57d6e94f49dcd325f395272a89bc7762246d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Sat, 29 Nov 2025 06:58:41 +0300 Subject: [PATCH] move over a bunch of ui functionality to bitty --- app/lib/babycode.py | 6 +- app/templates/common/macros.html | 38 +++--- data/static/js/babycode-editor.js | 149 ------------------------ data/static/js/bitties/pyrom-bitty.js | 161 +++++++++++++++++++++++++- data/static/js/thread.js | 8 -- data/static/js/ui.js | 69 ----------- 6 files changed, 182 insertions(+), 249 deletions(-) diff --git a/app/lib/babycode.py b/app/lib/babycode.py index 4c7ea7e..b622c79 100644 --- a/app/lib/babycode.py +++ b/app/lib/babycode.py @@ -6,7 +6,7 @@ from pygments.lexers import get_lexer_by_name from pygments.util import ClassNotFound as PygmentsClassNotFound import re -BABYCODE_VERSION = 4 +BABYCODE_VERSION = 5 NAMED_COLORS = [ 'black', 'silver', 'gray', 'white', 'maroon', 'red', @@ -61,7 +61,7 @@ def tag_code(children, attr, surrounding): return f"{children}" else: input_code = children.strip() - button = f"" + button = f"" unhighlighted = f"
code block{button}{input_code}
" if not attr: return unhighlighted @@ -94,7 +94,7 @@ def tag_color(children, attr, surrounding): def tag_spoiler(children, attr, surrounding): spoiler_name = attr if attr else "Spoiler" content = f"" - container = f"""""" + container = f"""""" return container def tag_image(children, attr, surrounding): diff --git a/app/templates/common/macros.html b/app/templates/common/macros.html index a627d19..6ad3a4c 100644 --- a/app/templates/common/macros.html +++ b/app/templates/common/macros.html @@ -79,26 +79,26 @@ {%- endmacro %} {% macro babycode_editor_component(ta_name, ta_placeholder="Post body", optional=False, prefill="", banned_tags=[]) %} -
+
- - + +
- - - - - - - - - - + + + + + + + + + + - + babycode guide {% if banned_tags %}
Forbidden tags:
@@ -111,7 +111,7 @@
{% endif %}
-
+
Type something!
@@ -207,7 +207,7 @@ {% if show_reply %} {% set qtext = "[url=%s]%s said:[/url]" | format(post_permalink, post['username']) %} {% set reply_text = "%s\n[quote]\n%s\n[/quote]\n" | format(qtext, post['original_markup']) %} - + {% endif %} {% set show_delete = false %} @@ -272,13 +272,13 @@
{% endmacro %} -{% macro accordion(hidden=false, style="", disabled=false) %} +{% macro accordion(hidden=false, disabled=false) %} {% if disabled %} {% set hidden = true %} {% endif %} -