mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-02-24 19:22:35 +01:00
Implement target handling for external links (#97)
This commit is contained in:
parent
47a8c8b7a0
commit
c4f2df0745
@ -213,3 +213,13 @@ function alert(?string $message = null, ?string $style = 'info'): Alert
|
||||
|
||||
return $alert->flash($message, $style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return proper link attributes based on the links_new_tab user setting
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function linkTarget(): string
|
||||
{
|
||||
return usersettings('links_new_tab') ? 'target="_blank" rel="noopener noreferrer"' : '';
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ $link->url }}" target="_blank">
|
||||
<a href="{{ $link->url }}" {!! linkTarget() !!}>
|
||||
{{ $link->url }}
|
||||
</a>
|
||||
</td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
{{ $link->title }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ $link->url }}" target="_blank">
|
||||
<a href="{{ $link->url }}" {!! linkTarget() !!}>
|
||||
{{ $link->url }}
|
||||
</a>
|
||||
</td>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="mr-2">
|
||||
{!! $link->getIcon('mr-1') !!}
|
||||
<a href="{{ $link->url }}" target="_blank">{{ $link->title }}</a>
|
||||
<a href="{{ $link->url }}" {!! linkTarget() !!}>{{ $link->title }}</a>
|
||||
<small>({{ $link->url }})</small>
|
||||
</div>
|
||||
<div class="ml-auto text-right">
|
||||
|
@ -7,7 +7,7 @@
|
||||
<i class="fas fa-lock text-muted mr-1" title="@lang('link.private')"></i>
|
||||
@endif
|
||||
{!! $link->getIcon('mr-1') !!}
|
||||
<a href="{{ $link->url }}">{{ $link->title }}</a>
|
||||
<a href="{{ $link->url }}" {!! linkTarget() !!}>{{ $link->title }}</a>
|
||||
<br>
|
||||
<small class="text-muted">({{ $link->shortUrl() }})</small>
|
||||
</div>
|
||||
|
@ -8,7 +8,7 @@
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ $link->url }}" target="_blank">
|
||||
<a href="{{ $link->url }}" {!! linkTarget() !!}>
|
||||
{{ $link->shortUrl() }}
|
||||
</a>
|
||||
</td>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<i class="fas fa-lock text-muted mr-1" title="@lang('link.private')"></i>
|
||||
@endif
|
||||
{!! $link->getIcon('mr-1') !!}
|
||||
<a href="{{ $link->url }}">{{ $link->title }}</a>
|
||||
<a href="{{ $link->url }}" {!! linkTarget() !!}>{{ $link->title }}</a>
|
||||
<br>
|
||||
<small class="text-muted">({{ $link->shortUrl() }})</small>
|
||||
</div>
|
||||
|
@ -16,10 +16,10 @@
|
||||
<div class="card-body">
|
||||
|
||||
<h2>
|
||||
<a href="{{ $link->url }}">{{ $link->title }}</a>
|
||||
<a href="{{ $link->url }}" {!! linkTarget() !!}>{{ $link->title }}</a>
|
||||
</h2>
|
||||
<div class="text-muted small mt-1 mb-3">
|
||||
<a href="{{ $link->url }}">{{ $link->url }}</a>
|
||||
<a href="{{ $link->url }}" {!! linkTarget() !!}>{{ $link->url }}</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
Loading…
x
Reference in New Issue
Block a user