From 425de4235d4ac56040cf0b695697501f00e67a5f Mon Sep 17 00:00:00 2001 From: daudix Date: Fri, 19 Jul 2024 21:54:07 +0300 Subject: [PATCH] Allow reloading comments (fixes #32) --- i18n/ar.toml | 11 ++++++----- i18n/en.toml | 19 ++++++++++--------- i18n/ru.toml | 25 +++++++++++++------------ templates/partials/comments.html | 9 ++++++--- templates/partials/nav.html | 2 +- 5 files changed, 36 insertions(+), 30 deletions(-) diff --git a/i18n/ar.toml b/i18n/ar.toml index 2ded107..267fede 100644 --- a/i18n/ar.toml +++ b/i18n/ar.toml @@ -18,6 +18,7 @@ archived = "الأرشيف" author = "الكاتب" blog_post_author = "كاتب منشور المدونة" boosts_from = "التعزيزات من" +caution = "احذر" comments = "التعليقات" comments_description = "يمكنك التعليق على منشور المدونة هذا عن طريق الرد علنًا على هذا المنشور باستخدام حساب Mastodon أو حساب آخر على ActivityPub/Fediverse. يتم عرض الردود المعروفة غير الخاصة أدناه." comments_noscript = "تحميل التعليقات يعتمد على JavaScript. حاول تمكين JavaScript وإعادة التحميل، أو قم بزيارة المنشور الأصلي على Mastodon." @@ -31,30 +32,30 @@ feed = "موجز" file_an_issue = "ملف مشكلة" filter_by_tag = "تصفية حسب العلامة" go_to_top = "الانتقال إلى الأعلى" +important = "مهم" language = "اللغة" load_comments = "تحميل التعليقات" loading = "التحميل" newest_to_oldest = "من الأحدث إلى الأقدم" next = "التالي" +note = "ملاحظة" open_post = "افتح المنشور" posts = "الوظائف في المجموع" posts_with_tag = "المنشورات ذات العلامة" powered_by = "مدعوم من" powered_by_and = "و" previous = "السابق" +reload = "إعادة التحميل" search = "بحث" -search_for = "ابحث عن…" +search_for = "ابحث عن" skip_to_content = "تخطي إلى المحتوى الرئيسي" source = "مصدر الموقع الإلكتروني" table_of_contents = "جدول المحتويات" tags = "العلامات" tags_title = "العلامات" +tip = "نصيحة" trigger_warning = "تحذير الزناد" updated = "آخر تحديث في" view_comment = "عرض التعليق على" view_profile = "عرض الملف الشخصي على" -note = "ملاحظة" -tip = "نصيحة" -important = "مهم" warning = "تحذير" -caution = "احذر" diff --git a/i18n/en.toml b/i18n/en.toml index c981015..7a390f7 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -18,6 +18,7 @@ archived = "Archived" author = "Author" blog_post_author = "Blog post author" boosts_from = "Boosts from" +caution = "Caution" comments = "Comments" comments_description = "You can comment on this blog post by publicly replying to this post using a Mastodon or other ActivityPub/Fediverse account. Known non-private replies are displayed below." comments_noscript = "Loading comments relies on JavaScript. Try enabling JavaScript and reloading, or visit the original post on Mastodon." @@ -31,34 +32,34 @@ feed = "Feed" file_an_issue = "File an Issue" filter_by_tag = "Filter by tag" go_to_top = "Go to Top" +important = "Important" language = "Language" load_comments = "Load Comments" loading = "Loading" +many_posts = "$NUMBER posts in total" +many_tags = "$NUMBER tags in total" newest_to_oldest = "From newest to oldest" next = "Next" +note = "Note" +one_posts = "$NUMBER post in total" +one_tags = "$NUMBER tag in total" open_post = "Open Post" posts = "$NUMBER posts in total" -one_posts = "$NUMBER post in total" -many_posts = "$NUMBER posts in total" posts_with_tag = "Posts with tag" powered_by = "Powered by" powered_by_and = "and" previous = "Previous" +reload = "Reload" search = "Search" -search_for = "Search for…" +search_for = "Search for" skip_to_content = "Skip to main content" source = "Website source" table_of_contents = "Table of Contents" tags = "tags" -one_tags = "$NUMBER tag in total" -many_tags = "$NUMBER tags in total" tags_title = "Tags" +tip = "Tip" trigger_warning = "Trigger Warning" updated = "Last updated on" view_comment = "View comment at" view_profile = "View profile at" -note = "Note" -tip = "Tip" -important = "Important" warning = "Warning" -caution = "Caution" diff --git a/i18n/ru.toml b/i18n/ru.toml index 3ac3129..5b5c498 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -22,6 +22,7 @@ archived = "Архив" author = "Автор" blog_post_author = "Автор блог-поста" boosts_from = "Продвижения с" +caution = "Осторожно" comments = "Комментарии" comments_description = "Вы можете оставить комментарий к этому блог-посту, публично ответив на него с помощью аккаунта Mastodon или другого аккаунта ActivityPub/Fediverse. Известные неприватные ответы отображены ниже." comments_noscript = "Загрузка комментариев зависит от JavaScript. Попробуйте включить JavaScript и перезагрузить, или посетите оригинальный пост на Mastodon." @@ -32,39 +33,39 @@ drafted = "Черновик" faves_from = "Избранное с" featured = "Подборка" feed = "Лента" +few_posts = "Всего $NUMBER поста" +few_tags = "Всего $NUMBER тега" file_an_issue = "Отправить Отчет об Ошибке" filter_by_tag = "Фильтр по тегам" go_to_top = "Перейти в Начало" +important = "Важно" language = "Язык" load_comments = "Загрузить Комментарии" -loading = "Загрузка…" +loading = "Загрузка" +many_posts = "Всего $NUMBER постов" +many_tags = "Всего $NUMBER тегов" newest_to_oldest = "От новейшего к старейшему" next = "Следующий" +note = "Заметьте" +one_posts = "Всего $NUMBER пост" +one_tags = "Всего $NUMBER тег" open_post = "Открыть Пост" posts = "$NUMBER постов" -one_posts = "Всего $NUMBER пост" -few_posts = "Всего $NUMBER поста" -many_posts = "Всего $NUMBER постов" posts_with_tag = "Посты с тегом" powered_by = "Работает на базе" powered_by_and = "и" previous = "Предыдущий" +reload = "Перезагрузить" search = "Поиск" -search_for = "Искать…" +search_for = "Искать" skip_to_content = "Перейти к основному содержанию" source = "Исходный код веб-сайта" table_of_contents = "Оглавление" tags = "$NUMBER тегов" -one_tags = "Всего $NUMBER тег" -few_tags = "Всего $NUMBER тега" -many_tags = "Всего $NUMBER тегов" tags_title = "Теги" +tip = "Совет" trigger_warning = "Предупреждение о Тревоге" updated = "Последний раз обновлено" view_comment = "Показать комментарий на" view_profile = "Показать профиль на" -note = "Заметьте" -tip = "Совет" -important = "Важно" warning = "Внимание" -caution = "Осторожно" diff --git a/templates/partials/comments.html b/templates/partials/comments.html index 7f5a103..760f5e7 100644 --- a/templates/partials/comments.html +++ b/templates/partials/comments.html @@ -70,7 +70,11 @@ function loadComments() { let commentsWrapper = document.getElementById("comments-wrapper"); - document.getElementById("load-comments").innerHTML = "{{ macros_translate::translate(key='loading', default='Loading', language_strings=language_strings) }}…"; + commentsWrapper.innerHTML = ""; + + let loadCommentsButton = document.getElementById("load-comments"); + loadCommentsButton.innerHTML = "{{ macros_translate::translate(key='loading', default='Loading', language_strings=language_strings) }}…"; + fetch("https://{{ host }}/api/v1/statuses/{{ id }}/context") .then(function (response) { return response.json(); @@ -244,8 +248,7 @@ commentsWrapper.innerHTML += comment.outerHTML; }); } - let loadCommentsButton = document.getElementById("load-comments"); - loadCommentsButton.remove(); + loadCommentsButton.innerHTML = "{{ macros_translate::translate(key='reload', default='Reload', language_strings=language_strings) }}"; }); } diff --git a/templates/partials/nav.html b/templates/partials/nav.html index 02ce3d7..61df406 100644 --- a/templates/partials/nav.html +++ b/templates/partials/nav.html @@ -62,7 +62,7 @@ - +