Update share-button.blade.php

This commit is contained in:
Julian Prieber 2023-12-15 16:34:57 +01:00
parent e686ba4421
commit ad97e74e46
1 changed files with 5 additions and 6 deletions

View File

@ -3,20 +3,19 @@
@php @php
$ShowShrBtn = config('advanced-config.display_share_button'); $ShowShrBtn = config('advanced-config.display_share_button');
if ($ShowShrBtn === '') { if ($ShowShrBtn === 'false') {
$ShowShrBtn = 'true';
} elseif ($ShowShrBtn === 'false') {
$ShowShrBtn = 'false'; $ShowShrBtn = 'false';
} elseif ($ShowShrBtn === 'user') { } elseif ($ShowShrBtn === 'user') {
$ShowShrBtn = Auth::user()->littlelink_name ? 'true' : 'false'; $ShowShrBtn = Auth::user()->littlelink_name ? 'true' : 'false';
} elseif (UserData::getData($userinfo->id, 'disable-sharebtn') == "true") {
$ShowShrBtn = 'false';
} else { } else {
$ShowShrBtn = 'true'; $ShowShrBtn = 'true';
} }
$DisplayShowShrBtn = $ShowShrBtn === 'true' && UserData::getData($userinfo->id, 'disable-sharebtn') !== "true";
@endphp @endphp
<div align="right" @if($DisplayShowShrBtn == 'false') style="visibility:hidden" @endif class="sharediv"> <div align="right" @if($ShowShrBtn == 'false') style="visibility:hidden" @endif class="sharediv">
<div> <div>
<span class="sharebutton button-hover icon-hover share-button" data-share="{{url()->current()}}" tabindex="0" role="button" aria-label="{{__('messages.Share this page')}}"> <span class="sharebutton button-hover icon-hover share-button" data-share="{{url()->current()}}" tabindex="0" role="button" aria-label="{{__('messages.Share this page')}}">
<i style="color: black;" class="fa-solid fa-share sharebutton-img share-icon hvr-icon"></i> <i style="color: black;" class="fa-solid fa-share sharebutton-img share-icon hvr-icon"></i>
@ -26,6 +25,6 @@
</div> </div>
<span class="copy-icon" tabindex="0" role="button" aria-label="{{__('messages.Copy URL to clipboard')}}"></span> <span class="copy-icon" tabindex="0" role="button" aria-label="{{__('messages.Copy URL to clipboard')}}"></span>
@if($DisplayShowShrBtn == true) @if($ShowShrBtn == 'true')
<script>const shareButtons=document.querySelectorAll(".share-button");shareButtons.forEach((e=>{e.addEventListener("click",(()=>{const r=e.dataset.share;navigator.share?navigator.share({title:"{{__('messages.Share this page')}}",url:r}).catch((e=>console.error("Error:",e))):navigator.clipboard.writeText(r).then((()=>{alert("{{__('messages.URL has been copied to your clipboard!')}}")})).catch((e=>{alert("Error",e)}))}))}));</script> <script>const shareButtons=document.querySelectorAll(".share-button");shareButtons.forEach((e=>{e.addEventListener("click",(()=>{const r=e.dataset.share;navigator.share?navigator.share({title:"{{__('messages.Share this page')}}",url:r}).catch((e=>console.error("Error:",e))):navigator.clipboard.writeText(r).then((()=>{alert("{{__('messages.URL has been copied to your clipboard!')}}")})).catch((e=>{alert("Error",e)}))}))}));</script>
@endif @endif