From: Hypolite Petovan Date: Fri, 15 Feb 2019 03:24:34 +0000 (-0500) Subject: Improved comment hiding interaction X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d7dbc632f8dba9b9f4f3e5c8dbf54bd69e8e67ab;p=friendica.git Improved comment hiding interaction - Remove global window.showMore and window.showFewer - Improve global showHideComments function - Remove frio-specific showHideComments function --- diff --git a/src/App.php b/src/App.php index 8068a1530b..b9e22dd1b5 100644 --- a/src/App.php +++ b/src/App.php @@ -663,8 +663,6 @@ class App '$local_user' => local_user(), '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION, '$delitem' => Core\L10n::t('Delete this item?'), - '$showmore' => Core\L10n::t('show more'), - '$showfewer' => Core\L10n::t('show fewer'), '$update_interval' => $interval, '$shortcut_icon' => $shortcut_icon, '$touch_icon' => $touch_icon, diff --git a/src/Object/Post.php b/src/Object/Post.php index 9fa9fcb507..05ffeb52b2 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -415,6 +415,7 @@ class Post extends BaseObject 'dislike' => $responses['dislike']['output'], 'responses' => $responses, 'switchcomment' => L10n::t('Comment'), + 'reply_label' => L10n::t('Reply to %s', $name_e), 'comment' => $comment, 'previewing' => $conv->isPreview() ? ' preview ' : '', 'wait' => L10n::t('Please wait'), @@ -449,13 +450,13 @@ class Post extends BaseObject foreach ($children as $child) { $result['children'][] = $child->getTemplateData($conv_responses, $thread_level + 1); } + // Collapse if (($nb_children > 2) || ($thread_level > 1)) { $result['children'][0]['comment_firstcollapsed'] = true; $result['children'][0]['num_comments'] = L10n::tt('%d comment', '%d comments', $total_children); - $result['children'][0]['hidden_comments_num'] = $total_children; - $result['children'][0]['hidden_comments_text'] = L10n::tt('comment', 'comments', $total_children); - $result['children'][0]['hide_text'] = L10n::t('show more'); + $result['children'][0]['show_text'] = L10n::t('Show more'); + $result['children'][0]['hide_text'] = L10n::t('Show fewer'); if ($thread_level > 1) { $result['children'][$nb_children - 1]['comment_lastcollapsed'] = true; } else { diff --git a/view/js/main.js b/view/js/main.js index f81d7a4235..c3d9cbed5c 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -656,12 +656,14 @@ function preview_comment(id) { } function showHideComments(id) { - if ($("#collapsed-comments-" + id).is(":visible")) { - $("#collapsed-comments-" + id).hide(); - $("#hide-comments-" + id).html(window.showMore); + if ($('#collapsed-comments-' + id).is(':visible')) { + $('#collapsed-comments-' + id).slideUp(); + $('#hide-comments-' + id).hide(); + $('#hide-comments-total-' + id).show(); } else { - $("#collapsed-comments-" + id).show(); - $("#hide-comments-" + id).html(window.showFewer); + $('#collapsed-comments-' + id).slideDown(); + $('#hide-comments-' + id).show(); + $('#hide-comments-total-' + id).hide(); } } diff --git a/view/templates/head.tpl b/view/templates/head.tpl index fa0088b8b6..6f7ddffb27 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -146,9 +146,6 @@ $(obj).val(""); } - window.showMore = "{{$showmore}}"; - window.showFewer = "{{$showfewer}}"; - function showHideCommentBox(id) { if ($("#comment-edit-form-" + id).is(":visible")) { $("#comment-edit-form-" + id).hide(); diff --git a/view/templates/wall_thread.tpl b/view/templates/wall_thread.tpl index b3ed2af026..01cd7559f1 100644 --- a/view/templates/wall_thread.tpl +++ b/view/templates/wall_thread.tpl @@ -1,7 +1,12 @@ {{if $item.comment_firstcollapsed}} -
- {{$item.num_comments}} {{$item.hide_text}} +