1
0
mirror of https://github.com/Kovah/LinkAce.git synced 2025-01-16 20:58:22 +01:00

Open links in new tabs from lists and tags (#389)

This commit is contained in:
Kovah 2024-11-19 12:53:39 +01:00
parent fa8e9cb338
commit d55244f374
No known key found for this signature in database
GPG Key ID: AAAA031BA9830D7B
20 changed files with 52 additions and 19 deletions

View File

@ -41,6 +41,7 @@ return [
'external_link' => 'Externer Link',
'wayback' => 'Archiv @ Wayback Machine',
'open_in_tabs' => 'Links in Tabs öffnen',
'check_disable' => 'Prüfung deaktivieren',
'check_disabled' => 'Prüfung ist deaktiviert',

View File

@ -12,7 +12,7 @@ return [
'logout' => 'Abmelden',
'remember_me' => 'Angemeldet bleiben',
'go_to_dashboard' => 'Zur Übersicht gehen',
'dashboard' => '',
'dashboard' => 'Dashboard',
'system_logs' => 'System Logs',
'reset_password' => 'Passwort zurücksetzen',

View File

@ -41,6 +41,7 @@ return [
'external_link' => 'External Link',
'wayback' => 'Link archive @ Wayback Machine',
'open_in_tabs' => 'Open Links in Tabs',
'check_disable' => 'Disable Check',
'check_disabled' => 'Check is disabled',

View File

@ -7,6 +7,7 @@ import DatabaseSetup from './components/Setup';
import GenerateCronToken from './components/GenerateCronToken';
import Import from './components/Import';
import LoadingButton from './components/LoadingButton';
import OpenLinksInTabs from './components/OpenLinksInTabs';
import ShareToggleAll from './components/ShareToggleAll';
import SimpleSelect from './components/SimpleSelect';
import TagsSelect from './components/TagsSelect';
@ -25,6 +26,7 @@ function registerViews () {
register('.simple-select', SimpleSelect);
register('.tag-select', TagsSelect);
register('.update-check', UpdateCheck);
register('.open-in-tabs', OpenLinksInTabs);
register('button[type="submit"]', LoadingButton);
register('input[id="url"]', UrlField);
}

View File

@ -0,0 +1,20 @@
export default class OpenLinksInTabs {
constructor ($el) {
this.$toggle = $el;
this.state = false;
this.$toggle.addEventListener('click', this.onToggleClick.bind(this));
}
onToggleClick () {
const links = document.querySelectorAll('.link-wrapper .link-url');
links.forEach((link, index) => {
window.open(link.href);
});
const domain = window.location.protocol + "//" + window.location.host;
console.info(`If only one tab is opening, please allow popups for ${domain} in your browser.`);
}
}

View File

@ -1,7 +1,7 @@
@php
$currentSetting = auth()->check() ? usersettings('link_display_mode') : session('link_display_mode');
@endphp
<div {{ $attributes->merge(['class' => 'link-display-toggles']) }}>
<div {{ $attributes->merge(['class' => 'link-display-toggles flex-shrink-0']) }}>
<a href="{{ request()->fullUrlWithQuery(['link-display' => Link::DISPLAY_LIST_SIMPLE]) }}"
class="{{ $currentSetting === Link::DISPLAY_LIST_SIMPLE ? 'active' : ''}}"
data-bs-toggle="tooltip" data-bs-placement="bottom" title="@lang('settings.display_mode_list_simple')">

View File

@ -1,7 +1,7 @@
@props(['withoutWrapper' => false])
{!! $withoutWrapper ? '<!--' : '' !!}<div {{ $attributes->merge(['class' => 'link-order-dropdown dropdown']) }}>{!! $withoutWrapper ? '-->' : '' !!}
<button type="button" id="link-index-order-dd"
class="btn btn-sm btn-outline-primary dropdown-toggle dropdown-toggle-split"
class="btn btn-xs btn-outline-primary dropdown-toggle dropdown-toggle-split"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@lang('search.order_by')
<x-icon.caret-down class="ml-1"/>

View File

@ -0,0 +1,5 @@
<div {{ $attributes->merge(['class' => 'open-in-tabs']) }}>
<button class="btn btn-link btn-xs">
@lang('link.open_in_tabs') <x-icon.external-link/>
</button>
</div>

View File

@ -4,7 +4,7 @@
<div class="single-link link-card col-12 col-sm-6 col-md-4 mb-4">
<div class="h-100 card">
<div class="link-thumbnail-list-holder-detailed">
<a href="{{ $link->url }}" {!! linkTarget() !!} class="link-thumbnail-list-detailed"
<a href="{{ $link->url }}" {!! linkTarget() !!} class="link-url link-thumbnail-list-detailed"
@if($link->thumbnail)
style="background-image: url('{{ $link->thumbnail }}');"
@endif>

View File

@ -7,7 +7,7 @@
{!! $link->getIcon() !!}
</div>
<div class="min-w-0">
<a href="{{ $link->url }}" {!! linkTarget() !!} class="two-lines">{{ $link->title }}</a>
<a href="{{ $link->url }}" {!! linkTarget() !!} class="link-url two-lines">{{ $link->title }}</a>
<div class="mt-1 small text-pale w-100 one-line">
{{ $link->url }}
</div>

View File

@ -4,7 +4,7 @@
<li class="single-link link-simple list-group-item">
<div class="d-sm-flex align-items-center">
<div class="me-4 one-line-sm">
<a href="{{ $link->url }}" title="{{ $link->url }}" {!! linkTarget() !!}>
<a href="{{ $link->url }}" title="{{ $link->url }}" {!! linkTarget() !!} class="link-url">
{{ $link->title }}
</a>
</div>

View File

@ -26,8 +26,9 @@
<section class="list-links my-4">
@if($links->isNotEmpty())
<div class="d-flex align-items-center mb-4">
<x-models.link-display-toggles class="ms-auto"/>
<div class="d-flex align-items-center mb-2">
<x-models.open-all class="ms-auto"/>
<x-models.link-display-toggles class="ms-3"/>
<x-models.link-order-dropdown class="ms-3"/>
</div>
<div class="link-wrapper">

View File

@ -20,8 +20,9 @@
<section class="tag-links my-4">
@if($links->isNotEmpty())
<div class="d-flex align-items-center mb-4">
<x-models.link-display-toggles class="ms-auto"/>
<div class="d-flex align-items-center mb-2">
<x-models.open-all class="ms-auto"/>
<x-models.link-display-toggles class="ms-3"/>
<x-models.link-order-dropdown class="ms-3"/>
</div>
<div class="link-wrapper">

View File

@ -8,7 +8,7 @@
<button type="button" class="bulk-edit-select-all btn btn-outline-primary btn-xs">Select all</button>
</div>
</form>
<div class="link-list list-group mt-3">
<div class="link-list list-group mt-2">
@foreach($links as $link)
@include('models.links.partials.single-detailed')
@endforeach

View File

@ -8,7 +8,7 @@
<button type="button" class="bulk-edit-select-all btn btn-outline-primary btn-xs">Select all</button>
</div>
</form>
<ul class="link-list list-group mt-3">
<ul class="link-list list-group mt-2">
@foreach($links as $link)
@include('models.links.partials.single-simple')
@endforeach

View File

@ -4,7 +4,7 @@
<div class="single-link link-card col-12 col-md-6 col-lg-4">
<div class="h-100 card">
<div class="link-thumbnail-list-holder-detailed">
<a href="{{ $link->url }}" {!! linkTarget() !!} class="link-thumbnail-list-detailed">
<a href="{{ $link->url }}" {!! linkTarget() !!} class="link-url link-thumbnail-list-detailed">
@if($link->thumbnail)
<img src="{{ $link->thumbnail }}" alt="{{ $link->title }}" class="w-100 h-100 object-fit-cover" loading="lazy">
@endif

View File

@ -8,7 +8,7 @@
<x-models.visibility-badge :model="$link"/>
</div>
<div class="min-w-0">
<a href="{{ $link->url }}" {!! linkTarget() !!} class="title two-lines">{{ $link->title }}</a>
<a href="{{ $link->url }}" {!! linkTarget() !!} class="link-url title two-lines">{{ $link->title }}</a>
<div class="url mt-1 small text-pale w-100 one-line">
{{ $link->url }}
</div>

View File

@ -5,7 +5,7 @@
<div class="d-sm-flex align-items-center">
<div class="me-4 one-line-sm">
{!! $link->getIcon('me-1') !!}
<a href="{{ $link->url }}" title="{{ $link->url }}" {!! linkTarget() !!} class="title">
<a href="{{ $link->url }}" title="{{ $link->url }}" {!! linkTarget() !!} class="link-url title">
{{ $link->title }}
</a>
</div>

View File

@ -1,7 +1,8 @@
<section class="list-links my-4">
@if($links->isNotEmpty())
<div class="d-flex align-items-center mb-4">
<x-models.link-display-toggles class="ms-auto"/>
<div class="d-flex align-items-center">
<x-models.open-all class="ms-auto"/>
<x-models.link-display-toggles class="ms-3"/>
<x-models.link-order-dropdown class="ms-3"/>
</div>
<div class="link-wrapper">

View File

@ -1,7 +1,8 @@
<section class="tag-links my-4">
@if($links->isNotEmpty())
<div class="d-flex align-items-center mb-4">
<x-models.link-display-toggles class="ms-auto"/>
<div class="d-flex align-items-center">
<x-models.open-all class="ms-auto"/>
<x-models.link-display-toggles class="ms-3"/>
<x-models.link-order-dropdown class="ms-3"/>
</div>
<div class="link-wrapper">