]> git.mxchange.org Git - friendica.git/commitdiff
[frio] Add a conditional browser share button
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 9 Jan 2022 15:15:04 +0000 (10:15 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 9 Jan 2022 17:31:54 +0000 (12:31 -0500)
src/Object/Post.php
view/theme/frio/js/theme.js
view/theme/frio/templates/search_item.tpl
view/theme/frio/templates/wall_thread.tpl

index 4c6de164a00562c4fb2c6e3bfd20f21c4227be95..0561f5506c7a2680b245a34ede7bdd0e65e7a15e 100644 (file)
@@ -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,
index 18215d5d5e190b8fd6ca3de35f1124f99a6dd633..6fdcd3d241307277260d906aaf7ad74778665c8c 100644 (file)
@@ -459,6 +459,10 @@ $(document).ready(function () {
                                $pokeSubmit.button("reset");
                        });
        });
+
+       if (!navigator.canShare || !navigator.canShare()) {
+               $('.button-browser-share').hide();
+       }
 });
 
 function openClose(theID) {
index 9b1d2e739731c41b212edf44792669f2e8975f56..2fbff14d781c76e836cdce64c5fc8d73554e01cc 100644 (file)
                                                {{/if}}
                                        {{/if}}
 
+                {{if !$item.lock && !$item.connector}}
+                                       <span role="presentation" class="separator button-browser-share"></span>
+                                       <button type="button" class="btn-link button-browser-share" onclick="navigator.share({url: '{{$item.plink.orig}}'})"><i class="fa fa-share-alt"></i> {{$item.browsershare}}</button>
+                {{/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)}}
index 3cce85cdef4860c77cb13c9b524d2d5dde7954d3..8f03cb5c9da3c08d78e28f49692439b75597036f 100644 (file)
@@ -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}}
+                               <span role="presentation" class="separator button-browser-share"></span>
+                               <button type="button" class="btn-link button-browser-share" onclick="navigator.share({url: '{{$item.plink.orig}}'})"><i class="fa fa-share-alt"></i> {{$item.browsershare}}</button>
+                       {{/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)}}
                                <span role="presentation" class="separator"></span>
@@ -481,6 +486,10 @@ as the value of $top_child_total (this is done at the end of this file)
                                </div>
                        {{/if}}
 
+                       {{if !$item.lock && !$item.connector}}
+                               <button type="button" class="btn btn-sm button-browser-share" onclick="navigator.share({url: '{{$item.plink.orig}}'})" title="{{$item.browsershare}}"><i class="fa fa-share-alt"></i></button>
+                       {{/if}}
+
                        {{* Put additional actions in a dropdown menu *}}
                                <div class="btn-group" role="group">
                                        <img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />