Add Trianglify (#1158)

This commit is contained in:
ullbergm 2023-05-26 04:23:06 -04:00 committed by GitHub
parent 60faccad27
commit 6e954a355d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 119 additions and 1 deletions

View file

@ -73,7 +73,12 @@ class AppServiceProvider extends ServiceProvider
} }
$alt_bg = ''; $alt_bg = '';
if ($bg_image = Setting::fetch('background_image')) { $trianglify = 'false';
$trianglify_seed = null;
if (Setting::fetch('trianglify')) {
$trianglify = 'true';
$trianglify_seed = Setting::fetch('trianglify_seed');
} elseif ($bg_image = Setting::fetch('background_image')) {
$alt_bg = ' style="background-image: url(storage/'.$bg_image.')"'; $alt_bg = ' style="background-image: url(storage/'.$bg_image.')"';
} }
@ -81,6 +86,8 @@ class AppServiceProvider extends ServiceProvider
$current_user = User::currentUser(); $current_user = User::currentUser();
$view->with('alt_bg', $alt_bg); $view->with('alt_bg', $alt_bg);
$view->with('trianglify', $trianglify);
$view->with('trianglify_seed', $trianglify_seed);
$view->with('allusers', $allusers); $view->with('allusers', $allusers);
$view->with('current_user', $current_user); $view->with('current_user', $current_user);
}); });

View file

@ -181,6 +181,33 @@ class SettingsSeeder extends Seeder
$setting->save(); $setting->save();
} }
if (! $setting = Setting::find(12)) {
$setting = new Setting;
$setting->id = 12;
$setting->group_id = 2;
$setting->key = 'trianglify';
$setting->type = 'boolean';
$setting->label = 'app.settings.trianglify';
$setting->save();
} else {
$setting->label = 'app.settings.trianglify';
$setting->save();
}
if (! $setting = Setting::find(13)) {
$setting = new Setting;
$setting->id = 13;
$setting->group_id = 2;
$setting->key = 'trianglify_seed';
$setting->type = 'text';
$setting->value = 'heimdall';
$setting->label = 'app.settings.trianglify_seed';
$setting->save();
} else {
$setting->label = 'app.settings.trianglify_seed';
$setting->save();
}
$window_target_options = json_encode([ $window_target_options = json_encode([
'current' => 'app.settings.window_target.current', 'current' => 'app.settings.window_target.current',
'heimdall' => 'app.settings.window_target.one', 'heimdall' => 'app.settings.window_target.one',

1
public/js/trianglify.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -205,6 +205,7 @@ If you would like to show your appreciation, feel free to use the link below.
- JavaScript - [jQuery](https://jquery.com/) - JavaScript - [jQuery](https://jquery.com/)
- Colour picker - [Huebee](http://huebee.buzz/) - Colour picker - [Huebee](http://huebee.buzz/)
- Background image - [pexels](https://www.pexels.com) - Background image - [pexels](https://www.pexels.com)
- Trianglify library - [Trianglify](https://github.com/qrohlf/trianglify)
- Everyone at Linuxserver.io that has helped with the app and let's not forget IronicBadger for the following question that started it all: - Everyone at Linuxserver.io that has helped with the app and let's not forget IronicBadger for the following question that started it all:
``` ```
you know, i would love something like this landing page for all my servers apps you know, i would love something like this landing page for all my servers apps

View file

@ -17,6 +17,8 @@ return [
'settings.version' => 'Versão', 'settings.version' => 'Versão',
'settings.background_image' => 'Imagem de fundo', 'settings.background_image' => 'Imagem de fundo',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link é aberto em', 'settings.window_target' => 'Link é aberto em',
'settings.window_target.current' => 'Abra nesta aba', 'settings.window_target.current' => 'Abra nesta aba',
'settings.window_target.one' => 'Abra na mesma aba', 'settings.window_target.one' => 'Abra na mesma aba',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Podpořte nás', 'settings.donate' => 'Podpořte nás',
'settings.version' => 'Verze', 'settings.version' => 'Verze',
'settings.background_image' => 'Obrázek pozadí', 'settings.background_image' => 'Obrázek pozadí',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Odkazy otevírat v', 'settings.window_target' => 'Odkazy otevírat v',
'settings.window_target.current' => 'Otevřít v této záložce', 'settings.window_target.current' => 'Otevřít v této záložce',
'settings.window_target.one' => 'Otevřít ve stejné záložce', 'settings.window_target.one' => 'Otevřít ve stejné záložce',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Doner', 'settings.donate' => 'Doner',
'settings.version' => 'Version', 'settings.version' => 'Version',
'settings.background_image' => 'Baggrundsbillede', 'settings.background_image' => 'Baggrundsbillede',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link opens in', 'settings.window_target' => 'Link opens in',
'settings.window_target.current' => 'Åbn i denne fane', 'settings.window_target.current' => 'Åbn i denne fane',
'settings.window_target.one' => 'Åbn i den samme fane', 'settings.window_target.one' => 'Åbn i den samme fane',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Spende', 'settings.donate' => 'Spende',
'settings.version' => 'Version', 'settings.version' => 'Version',
'settings.background_image' => 'Hintergrundbild', 'settings.background_image' => 'Hintergrundbild',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link öffnen in', 'settings.window_target' => 'Link öffnen in',
'settings.window_target.current' => 'In diesem Tab öffnen', 'settings.window_target.current' => 'In diesem Tab öffnen',
'settings.window_target.one' => 'Im selben Tab öffnen', 'settings.window_target.one' => 'Im selben Tab öffnen',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Δωρεά', 'settings.donate' => 'Δωρεά',
'settings.version' => 'Έκδοση', 'settings.version' => 'Έκδοση',
'settings.background_image' => 'Εικόνα Παρασκηνίου', 'settings.background_image' => 'Εικόνα Παρασκηνίου',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Ο Σύνδεσμος ανοίγει σε', 'settings.window_target' => 'Ο Σύνδεσμος ανοίγει σε',
'settings.window_target.current' => 'Άνοιγμα σε αυτή την καρτέλα', 'settings.window_target.current' => 'Άνοιγμα σε αυτή την καρτέλα',
'settings.window_target.one' => 'Άνοιγμα στην ίδια καρτέλα', 'settings.window_target.one' => 'Άνοιγμα στην ίδια καρτέλα',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Donate', 'settings.donate' => 'Donate',
'settings.version' => 'Version', 'settings.version' => 'Version',
'settings.background_image' => 'Background Image', 'settings.background_image' => 'Background Image',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link opens in', 'settings.window_target' => 'Link opens in',
'settings.window_target.current' => 'Open in this tab', 'settings.window_target.current' => 'Open in this tab',
'settings.window_target.one' => 'Open in the same tab', 'settings.window_target.one' => 'Open in the same tab',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Donar', 'settings.donate' => 'Donar',
'settings.version' => 'Versión', 'settings.version' => 'Versión',
'settings.background_image' => 'Imagen de Fondo', 'settings.background_image' => 'Imagen de Fondo',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Vínculo abre en', 'settings.window_target' => 'Vínculo abre en',
'settings.window_target.current' => 'Abrir en ésta pestaña', 'settings.window_target.current' => 'Abrir en ésta pestaña',
'settings.window_target.one' => 'Abrir en la misma pestaña', 'settings.window_target.one' => 'Abrir en la misma pestaña',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Lahjoita', 'settings.donate' => 'Lahjoita',
'settings.version' => 'Versio', 'settings.version' => 'Versio',
'settings.background_image' => 'Taustakuva', 'settings.background_image' => 'Taustakuva',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Linkit aukeaa', 'settings.window_target' => 'Linkit aukeaa',
'settings.window_target.current' => 'Avaa tässä välilehdessä', 'settings.window_target.current' => 'Avaa tässä välilehdessä',
'settings.window_target.one' => 'Avaa samassa välilehdessä', 'settings.window_target.one' => 'Avaa samassa välilehdessä',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Contribuer', 'settings.donate' => 'Contribuer',
'settings.version' => 'Version', 'settings.version' => 'Version',
'settings.background_image' => 'Image d\'arrière-plan', 'settings.background_image' => 'Image d\'arrière-plan',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Ouverture des liens', 'settings.window_target' => 'Ouverture des liens',
'settings.window_target.current' => 'Dans l\'onglet courant', 'settings.window_target.current' => 'Dans l\'onglet courant',
'settings.window_target.one' => 'Dans le même nouvel onglet', 'settings.window_target.one' => 'Dans le même nouvel onglet',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Adomány', 'settings.donate' => 'Adomány',
'settings.version' => 'Verzió', 'settings.version' => 'Verzió',
'settings.background_image' => 'Háttérkép', 'settings.background_image' => 'Háttérkép',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link megnyitása', 'settings.window_target' => 'Link megnyitása',
'settings.window_target.current' => 'Ezen a lapon', 'settings.window_target.current' => 'Ezen a lapon',
'settings.window_target.one' => 'Azonos lapon', 'settings.window_target.one' => 'Azonos lapon',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Dona', 'settings.donate' => 'Dona',
'settings.version' => 'Versione', 'settings.version' => 'Versione',
'settings.background_image' => 'Immagine di sfondo', 'settings.background_image' => 'Immagine di sfondo',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Apri link in', 'settings.window_target' => 'Apri link in',
'settings.window_target.current' => 'Apri in questa scheda', 'settings.window_target.current' => 'Apri in questa scheda',
'settings.window_target.one' => 'Apri nella stessa scheda', 'settings.window_target.one' => 'Apri nella stessa scheda',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => '寄付', 'settings.donate' => '寄付',
'settings.version' => 'バージョン', 'settings.version' => 'バージョン',
'settings.background_image' => '背景画像', 'settings.background_image' => '背景画像',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'リンクを開く', 'settings.window_target' => 'リンクを開く',
'settings.window_target.current' => 'このタブで開く', 'settings.window_target.current' => 'このタブで開く',
'settings.window_target.one' => '同じタブで開く', 'settings.window_target.one' => '同じタブで開く',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => '기부', 'settings.donate' => '기부',
'settings.version' => '버전', 'settings.version' => '버전',
'settings.background_image' => '배경 이미지', 'settings.background_image' => '배경 이미지',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => '다음에서 링크 열기', 'settings.window_target' => '다음에서 링크 열기',
'settings.window_target.current' => '현재 탭에서 열기', 'settings.window_target.current' => '현재 탭에서 열기',
'settings.window_target.one' => '같은 탭에서 열기', 'settings.window_target.one' => '같은 탭에서 열기',

View file

@ -30,6 +30,10 @@ return [
'settings.background_image' => 'Imagin dedree', 'settings.background_image' => 'Imagin dedree',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'I link se derven...', 'settings.window_target' => 'I link se derven...',
'settings.window_target.current' => 'In quella scheda chi', 'settings.window_target.current' => 'In quella scheda chi',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Doneren', 'settings.donate' => 'Doneren',
'settings.version' => 'Versie', 'settings.version' => 'Versie',
'settings.background_image' => 'Achtergrondafbeelding', 'settings.background_image' => 'Achtergrondafbeelding',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link opent in', 'settings.window_target' => 'Link opent in',
'settings.window_target.current' => 'In de huidige tab openen', 'settings.window_target.current' => 'In de huidige tab openen',
'settings.window_target.one' => 'In dezelfde tab openen', 'settings.window_target.one' => 'In dezelfde tab openen',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Donere', 'settings.donate' => 'Donere',
'settings.version' => 'Versjon', 'settings.version' => 'Versjon',
'settings.background_image' => 'Bakgrunnsbilde', 'settings.background_image' => 'Bakgrunnsbilde',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link åpnes inn', 'settings.window_target' => 'Link åpnes inn',
'settings.window_target.current' => 'Åpne i denne fanen', 'settings.window_target.current' => 'Åpne i denne fanen',
'settings.window_target.one' => 'Åpne i samme fane', 'settings.window_target.one' => 'Åpne i samme fane',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Podarować', 'settings.donate' => 'Podarować',
'settings.version' => 'Wersja', 'settings.version' => 'Wersja',
'settings.background_image' => 'Tapeta Pulpitu', 'settings.background_image' => 'Tapeta Pulpitu',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link otwiera się w', 'settings.window_target' => 'Link otwiera się w',
'settings.window_target.current' => 'Otwórz w tej zakładce', 'settings.window_target.current' => 'Otwórz w tej zakładce',
'settings.window_target.one' => 'Otwórz w tej samej zakładce', 'settings.window_target.one' => 'Otwórz w tej samej zakładce',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Doar', 'settings.donate' => 'Doar',
'settings.version' => 'Versão', 'settings.version' => 'Versão',
'settings.background_image' => 'Imagem de fundo', 'settings.background_image' => 'Imagem de fundo',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'O link abre em', 'settings.window_target' => 'O link abre em',
'settings.window_target.current' => 'Abrir neste separador', 'settings.window_target.current' => 'Abrir neste separador',
'settings.window_target.one' => 'Abrir no mesmo separador', 'settings.window_target.one' => 'Abrir no mesmo separador',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Пожертвования', 'settings.donate' => 'Пожертвования',
'settings.version' => 'Версия', 'settings.version' => 'Версия',
'settings.background_image' => 'Фоновое изображение', 'settings.background_image' => 'Фоновое изображение',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Открывать ссылки в', 'settings.window_target' => 'Открывать ссылки в',
'settings.window_target.current' => 'Открывать в этой же закладке', 'settings.window_target.current' => 'Открывать в этой же закладке',
'settings.window_target.one' => 'Открывать в той же закладке', 'settings.window_target.one' => 'Открывать в той же закладке',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Doniraj', 'settings.donate' => 'Doniraj',
'settings.version' => 'Verzija', 'settings.version' => 'Verzija',
'settings.background_image' => 'Slika za ozadje', 'settings.background_image' => 'Slika za ozadje',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Povezava se odpre v', 'settings.window_target' => 'Povezava se odpre v',
'settings.window_target.current' => 'Odpri v tem zavihku', 'settings.window_target.current' => 'Odpri v tem zavihku',
'settings.window_target.one' => 'Odpri v istem zavihku', 'settings.window_target.one' => 'Odpri v istem zavihku',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Donera', 'settings.donate' => 'Donera',
'settings.version' => 'Version', 'settings.version' => 'Version',
'settings.background_image' => 'Bakgrundsbild', 'settings.background_image' => 'Bakgrundsbild',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Länken öppnas i', 'settings.window_target' => 'Länken öppnas i',
'settings.window_target.current' => 'Öppna i denna flik', 'settings.window_target.current' => 'Öppna i denna flik',
'settings.window_target.one' => 'Öppna i samma flik', 'settings.window_target.one' => 'Öppna i samma flik',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Bağış yapmak', 'settings.donate' => 'Bağış yapmak',
'settings.version' => 'Versiyon', 'settings.version' => 'Versiyon',
'settings.background_image' => 'Arkaplan Resmi', 'settings.background_image' => 'Arkaplan Resmi',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Bağlantıılır', 'settings.window_target' => 'Bağlantıılır',
'settings.window_target.current' => 'Bu sekmede aç', 'settings.window_target.current' => 'Bu sekmede aç',
'settings.window_target.one' => 'Aynı sekmede aç', 'settings.window_target.one' => 'Aynı sekmede aç',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => 'Пожертви', 'settings.donate' => 'Пожертви',
'settings.version' => 'Версія', 'settings.version' => 'Версія',
'settings.background_image' => 'Фонове зображення', 'settings.background_image' => 'Фонове зображення',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Відкривати посилання в', 'settings.window_target' => 'Відкривати посилання в',
'settings.window_target.current' => 'Відкривати в цій вкладці', 'settings.window_target.current' => 'Відкривати в цій вкладці',
'settings.window_target.one' => 'Відкривати у тій самій вкладці', 'settings.window_target.one' => 'Відкривати у тій самій вкладці',

View file

@ -19,6 +19,8 @@ return [
'settings.version' => '版本', 'settings.version' => '版本',
'settings.background_image' => '背景图片', 'settings.background_image' => '背景图片',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => '链接打开方式', 'settings.window_target' => '链接打开方式',
'settings.window_target.current' => '在当前选项卡中打开', 'settings.window_target.current' => '在当前选项卡中打开',
'settings.window_target.one' => '在同一个选项卡中打开', 'settings.window_target.one' => '在同一个选项卡中打开',

View file

@ -9,6 +9,8 @@ return array (
'settings.donate' => '捐赠', 'settings.donate' => '捐赠',
'settings.version' => '版本', 'settings.version' => '版本',
'settings.background_image' => '背景图片', 'settings.background_image' => '背景图片',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => '链接打开方式', 'settings.window_target' => '链接打开方式',
'settings.window_target.current' => '在当前选项卡中打开', 'settings.window_target.current' => '在当前选项卡中打开',
'settings.window_target.one' => '在同一个选项卡中打开', 'settings.window_target.one' => '在同一个选项卡中打开',

View file

@ -116,6 +116,34 @@
</div> </div>
<script src="{{ asset('js/jquery.min.js') }}"></script> <script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset(mix('js/app.js')) }}"></script> <script src="{{ asset(mix('js/app.js')) }}"></script>
@if($trianglify == 'true')
<script src="{{ asset(mix('js/trianglify.js')) }}"></script>
<script>
function addTriangleTo(target) {
var dimensions = target.getClientRects()[0];
var pattern = Trianglify({
width: dimensions.width,
height: dimensions.height
@if($trianglify_seed <> '')
, seed: '{!! $trianglify_seed !!}'
@endif
});
target.style['background-image'] = 'url(' + pattern.png() + ')';
target.style['background-size'] = 'cover';
target.style['-webkit-background-size'] = 'cover';
target.style['-moz-background-size'] = 'cover';
target.style['-o-background-size'] = 'cover';
}
var resizeTimer;
$(window).on('resize', function(e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
addTriangleTo(app);
}, 400);
});
</script>
<script>addTriangleTo(app);</script>
@endif
@yield('scripts') @yield('scripts')
<script id="custom_js"> <script id="custom_js">

View file

@ -22,6 +22,8 @@ class SettingsTest extends TestCase
'Support', 'Support',
'Donate', 'Donate',
'Background Image', 'Background Image',
'Trianglify',
'Trianglify Random Seed',
'Homepage Search', 'Homepage Search',
'Default Search Provider', 'Default Search Provider',
'Link opens in', 'Link opens in',