aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2025-06-04 14:34:44 +0000
committerMario <mario@mariovavti.com>2025-06-04 14:34:44 +0000
commit6649eca2bf4eba2bea36c41b64f3a749b003ab71 (patch)
treedb126447a836fbdccbc3aad3d27b45ddcaa93904
parent64ae1eb5e87446d0cdad8c674c8adb8ea7b254cd (diff)
downloadvolse-hubzilla-6649eca2bf4eba2bea36c41b64f3a749b003ab71.tar.gz
volse-hubzilla-6649eca2bf4eba2bea36c41b64f3a749b003ab71.tar.bz2
volse-hubzilla-6649eca2bf4eba2bea36c41b64f3a749b003ab71.zip
move expand to item menu to get rid of the single click lag
-rw-r--r--Zotlabs/Lib/ThreadItem.php10
-rw-r--r--boot.php2
-rw-r--r--view/js/main.js61
-rw-r--r--view/tpl/conv_item.tpl3
4 files changed, 53 insertions, 23 deletions
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index b373f6c52..dee64caac 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -328,8 +328,8 @@ class ThreadItem {
$viewthread = z_root() . '/channel/' . $owner_address . '?f=&mid=' . urlencode(gen_link_id($item['mid']));
$comment_count_txt = ['label' => sprintf(tt('%d comment', '%d comments', $total_children), $total_children), 'count' => $total_children];
- $list_unseen_txt = $unseen_comments ? ['label' => sprintf(t('%d unseen'), $unseen_comments), 'count' => $unseen_comments] : [];
+ $list_unseen_txt = $unseen_comments ? ['label' => sprintf(t('%d unseen'), $unseen_comments), 'count' => $unseen_comments] : [];
$has_tags = (($body['tags'] || $body['categories'] || $body['mentions'] || $body['attachments'] || $body['folders']) ? true : false);
@@ -363,6 +363,11 @@ class ThreadItem {
$comments_total_percent = round(100 * 3 / $conv->comments_total);
}
+ $expand = '';
+ if ($this->threaded && !empty($item['comment_count'] && !$this->is_toplevel())) {
+ $expand = t('Expand Replies');
+ }
+
$tmp_item = array(
'template' => $this->get_template(),
'mode' => $mode,
@@ -492,7 +497,8 @@ class ThreadItem {
'load_more' => $load_more,
'load_more_title' => $load_more_title,
'comments_total' => $conv->comments_total,
- 'comments_total_percent' => $comments_total_percent
+ 'comments_total_percent' => $comments_total_percent,
+ 'expand' => $expand
);
$arr = array('item' => $item, 'output' => $tmp_item);
diff --git a/boot.php b/boot.php
index a549308cb..82cbc78aa 100644
--- a/boot.php
+++ b/boot.php
@@ -70,7 +70,7 @@ require_once('include/security.php');
define('PLATFORM_NAME', 'hubzilla');
-define('STD_VERSION', '10.3.47');
+define('STD_VERSION', '10.3.48');
define('ZOT_REVISION', '6.0');
define('DB_UPDATE_VERSION', 1263);
diff --git a/view/js/main.js b/view/js/main.js
index 1ace4b56b..6365b5d4d 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -28,9 +28,6 @@ var expanded_items = [];
var updateTimeout = [];
const singlethread_modules = ['display', 'hq'];
const redirect_modules = ['display', 'notify'];
-
-let clickTimer = null;
-const clickTimerDelay = 300; // Adjust as needed
let b64mids = [];
@@ -96,21 +93,43 @@ $(document).ready(function() {
const targetElement = event.target.closest('.wall-item-reaction');
if (!targetElement) return;
- let userClick = event.isTrusted;
-
- clearTimeout(clickTimer);
- clickTimer = setTimeout(() => {
- const id = targetElement.dataset.itemId;
- const mid = targetElement.dataset.itemMid;
- const parent = targetElement.dataset.itemParent;
- const uuid = targetElement.dataset.itemUuid;
- const verb = targetElement.dataset.itemVerb;
+ const userClick = event.isTrusted;
+ const id = targetElement.dataset.itemId;
+ const mid = targetElement.dataset.itemMid;
+ const parent = targetElement.dataset.itemParent;
+ const uuid = targetElement.dataset.itemUuid;
+ const verb = targetElement.dataset.itemVerb;
- request(id, mid, verb, parent, uuid, userClick);
+ request(id, mid, verb, parent, uuid, userClick);
- }, clickTimerDelay);
});
+ document.addEventListener('click', function(event) {
+ event.preventDefault();
+
+ const targetElement = event.target.closest('.dropdown-item-expand');
+ if (!targetElement) return;
+
+ const id = targetElement.dataset.itemId;
+ const uuid = targetElement.dataset.itemUuid;
+
+ const loading = document.getElementById('like-rotator-' + id);
+ loading.style.display = 'block';
+
+ document.querySelectorAll('.thread-wrapper.item-highlight').forEach(el => {
+ el.classList.remove('item-highlight');
+ el.style.boxShadow = '';
+ });
+
+ const wrapper = document.getElementById('thread-wrapper-' + id);
+ if (!wrapper.classList.contains('toplevel_item')) {
+ wrapper.classList.add('item-highlight');
+ document.documentElement.style.setProperty('--hz-item-highlight', stringToHlsColor(uuid));
+ }
+
+ autoExpand(id);
+ });
+/*
document.addEventListener('dblclick', function(event) {
const targetElement = event.target.closest('.wall-item-reaction.wall-item-comment');
if (!targetElement) return;
@@ -136,7 +155,7 @@ $(document).ready(function() {
autoExpand(id);
});
-
+*/
// @hilmar |->
if ( typeof(window.tao) == 'undefined' ) {
window.tao = {};
@@ -1511,7 +1530,7 @@ function injectWithAnimation(containerId, parsedDoc, overwrite = false) {
const autoExpand = (function () {
const clickedElements = new Set(); // Stores clicked button references
- function waitForElement(selector, timeout = 3000) {
+ function waitForElement(selector, timeout = 5000) {
return new Promise((resolve, reject) => {
// Check if the element already exists
const element = document.querySelector(selector);
@@ -1547,6 +1566,8 @@ const autoExpand = (function () {
async function autoExpand(id) {
+ const loading = document.getElementById('like-rotator-' + id);
+
try {
// Step 1: Ensure initial button is clicked
const initBtnSelector = '#wall-item-comment-' + id;
@@ -1569,7 +1590,7 @@ const autoExpand = (function () {
await waitForElement(commentSelector);
document.querySelectorAll(subs).forEach(el => {
- el.classList.add('ms-3');
+ el.classList.add('ms-2');
el.classList.add('border-start');
});
@@ -1580,7 +1601,7 @@ const autoExpand = (function () {
if (!clickedElements.has(btn)) {
// Wait between iterations to allow UI to update
- await new Promise(res0 => setTimeout(res0, 500));
+ // await new Promise(res0 => setTimeout(res0, 500));
btn.click();
clickedElements.add(btn);
@@ -1591,20 +1612,20 @@ const autoExpand = (function () {
// Wait between iterations to allow UI to update
if (newButtonsFound) {
- await new Promise(res1 => setTimeout(res1, 500));
+ await new Promise(res => setTimeout(res, 1000));
}
} while (newButtonsFound);
console.log('All replies loaded!');
- const loading = document.getElementById('like-rotator-' + id);
loading.style.display = 'none';
document.dispatchEvent(new CustomEvent('hz:sse_setNotificationsStatus', { detail: b64mids }));
document.dispatchEvent(new Event('hz:sse_bs_counts'));
} catch (error) {
+ loading.style.display = 'none';
console.error("autoExpand failed:", error.message);
}
}
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index 007f48241..39634f429 100644
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -191,6 +191,9 @@
{{if $item.star}}
<a class="dropdown-item" href="#" onclick="dostar({{$item.id}}); return false;"><i id="starred-{{$item.id}}" class="generic-icons-nav bi{{if $item.star.isstarred}} starred bi-star-fill{{else}} unstarred bi-star{{/if}}" title="{{$item.star.toggle}}"></i>{{$item.star.toggle}}</a>
{{/if}}
+ {{if $item.expand}}
+ <a class="dropdown-item dropdown-item-expand" href="#" data-item-id="{{$item.id}}" data-item-uuid="{{$item.mid}}"><i id="expand-{{$item.id}}" class="generic-icons-nav bi bi-arrows-angle-expand" title="{{$item.expand}}"></i>{{$item.expand}}</a>
+ {{/if}}
{{if $item.thread_action_menu}}
{{foreach $item.thread_action_menu as $mitem}}
<a class="dropdown-item" {{if $mitem.href}}href="{{$mitem.href}}"{{/if}} {{if $mitem.action}}onclick="{{$mitem.action}}"{{/if}} {{if $mitem.title}}title="{{$mitem.title}}"{{/if}} ><i class="generic-icons-nav bi bi-{{$mitem.icon}}"></i>{{$mitem.title}}</a>