From f2af985350b775a120f01cd620dfc6a17b2354b2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 9 Jan 2022 10:15:04 -0500 Subject: [PATCH] [frio] Add a conditional browser share button --- src/Object/Post.php | 3 +-- view/theme/frio/js/theme.js | 4 ++++ view/theme/frio/templates/search_item.tpl | 4 ++++ view/theme/frio/templates/wall_thread.tpl | 9 +++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Object/Post.php b/src/Object/Post.php index 4c6de164a0..0561f5506c 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -135,8 +135,6 @@ class Post */ public function getTemplateData(array $conv_responses, string $formSecurityToken, $thread_level = 1) { - $a = DI::app(); - $item = $this->getData(); $edited = false; // If the time between "created" and "edited" differs we add @@ -480,6 +478,7 @@ class Post 'owner_photo' => DI::baseUrl()->remove(Contact::getAvatarUrlForUrl($item['owner-link'], $item['uid'], Proxy::SIZE_THUMB)), 'owner_name' => $this->getOwnerName(), 'plink' => Item::getPlink($item), + 'browsershare' => DI::l10n()->t('Share'), 'edpost' => $edpost, 'ispinned' => $ispinned, 'pin' => $pin, diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 18215d5d5e..6fdcd3d241 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -459,6 +459,10 @@ $(document).ready(function () { $pokeSubmit.button("reset"); }); }); + + if (!navigator.canShare || !navigator.canShare()) { + $('.button-browser-share').hide(); + } }); function openClose(theID) { diff --git a/view/theme/frio/templates/search_item.tpl b/view/theme/frio/templates/search_item.tpl index 9b1d2e7397..2fbff14d78 100644 --- a/view/theme/frio/templates/search_item.tpl +++ b/view/theme/frio/templates/search_item.tpl @@ -177,6 +177,10 @@ {{/if}} {{/if}} + {{if !$item.lock && !$item.connector}} + + + {{/if}} {{* Put additional actions in a dropdown menu *}} {{if $item.menu && ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread || $item.ignore || $item.drop.dropping)}} diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index 3cce85cdef..8f03cb5c9d 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -330,6 +330,11 @@ as the value of $top_child_total (this is done at the end of this file) {{/if}} {{/if}} + {{if !$item.lock && !$item.connector}} + + + {{/if}} + {{* Put additional actions in a dropdown menu *}} {{if $item.menu && ($item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread || $item.ignore || $item.drop.dropping)}} @@ -481,6 +486,10 @@ as the value of $top_child_total (this is done at the end of this file) {{/if}} + {{if !$item.lock && !$item.connector}} + + {{/if}} + {{* Put additional actions in a dropdown menu *}}