commit
3dd4dce0d3
@ -70,7 +70,7 @@ SQL
|
||||
->select('ejaculations.*')
|
||||
->with('user', 'tags')
|
||||
->withLikes()
|
||||
->take(10)
|
||||
->take(21)
|
||||
->get();
|
||||
|
||||
return view('home')->with(compact('informations', 'categories', 'globalEjaculationCounts', 'publicLinkedEjaculations'));
|
||||
|
@ -27,7 +27,7 @@ class MetadataResolver implements Resolver
|
||||
'~www\.patreon\.com/~' => PatreonResolver::class,
|
||||
'~www\.deviantart\.com/.*/art/.*~' => DeviantArtResolver::class,
|
||||
'~\.syosetu\.com/n\d+[a-z]{2,}~' => NarouResolver::class,
|
||||
'~ci-en\.jp/creator/\d+/article/\d+~' => CienResolver::class,
|
||||
'~ci-en\.(jp|net|dlsite\.com)/creator/\d+/article/\d+~' => CienResolver::class,
|
||||
'~www\.plurk\.com\/p\/.*~' => PlurkResolver::class,
|
||||
'~(adult\.)?contents\.fc2\.com\/article_search\.php\?id=\d+~' => FC2ContentsResolver::class,
|
||||
'~store\.steampowered\.com/app/\d+~' => SteamResolver::class,
|
||||
|
@ -75,4 +75,21 @@ class Formatter
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* imgタグのsrcsetで使用できる形式で、プロフィール画像URLを生成します。
|
||||
* @param object $user Userなど、getProfileImageUrl()が実装されているオブジェクト
|
||||
* @param int $baseSize 1x解像度における画像サイズ
|
||||
* @param int $maxDensity 最高密度
|
||||
* @return string srcset用の文字列
|
||||
*/
|
||||
public function profileImageSrcSet($user, int $baseSize, int $maxDensity = 3)
|
||||
{
|
||||
$srcset = [];
|
||||
for ($i = 1; $i <= $maxDensity; $i++) {
|
||||
$srcset[] = $user->getProfileImageUrl($baseSize * $i) . " {$i}x";
|
||||
}
|
||||
|
||||
return implode(',', $srcset);
|
||||
}
|
||||
}
|
||||
|
5
dist/bin/php-debug.sh
vendored
Executable file
5
dist/bin/php-debug.sh
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
export APP_DEBUG=true
|
||||
exec tissue-entrypoint.sh php "$@"
|
@ -41,7 +41,7 @@
|
||||
case 'Enter':
|
||||
case ' ':
|
||||
if ((event as any).isComposing !== true) {
|
||||
this.tags.push(this.buffer);
|
||||
this.tags.push(this.buffer.trim());
|
||||
this.buffer = "";
|
||||
}
|
||||
event.preventDefault();
|
||||
@ -49,7 +49,7 @@
|
||||
case 'Unidentified':
|
||||
// 実際にテキストボックスに入力されている文字を見に行く (フォールバック処理)
|
||||
if (event.srcElement && (event.srcElement as HTMLInputElement).value.slice(-1) == ' ') {
|
||||
this.tags.push(this.buffer);
|
||||
this.tags.push(this.buffer.trim());
|
||||
this.buffer = "";
|
||||
event.preventDefault();
|
||||
}
|
||||
|
8
resources/assets/js/user/stats.js
vendored
8
resources/assets/js/user/stats.js
vendored
@ -32,6 +32,10 @@ function createLineGraph(id, labels, data) {
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -60,6 +64,10 @@ function createBarGraph(id, labels, data) {
|
||||
beginAtZero: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
tooltips: {
|
||||
mode: 'index',
|
||||
intersect: false,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!-- span -->
|
||||
<div>
|
||||
<h5>
|
||||
<a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> <bdi>{{ $ejaculation->user->display_name }}</bdi></a>
|
||||
<a href="{{ route('user.profile', ['id' => $ejaculation->user->name]) }}" class="text-dark"><img src="{{ $ejaculation->user->getProfileImageUrl(30) }}" srcset="{{ Formatter::profileImageSrcSet($ejaculation->user, 30) }}" width="30" height="30" class="rounded d-inline-block align-bottom"> <bdi>{{ $ejaculation->user->display_name }}</bdi></a>
|
||||
<a href="{{ route('checkin.show', ['id' => $ejaculation->id]) }}" class="text-muted"><small>{{ $ejaculation->ejaculated_date->format('Y/m/d H:i') }}</small></a>
|
||||
</h5>
|
||||
</div>
|
||||
@ -39,7 +39,7 @@
|
||||
<div class="like-users flex-grow-1 overflow-hidden">
|
||||
@foreach ($ejaculation->likes as $like)
|
||||
@if ($like->user !== null)
|
||||
<a href="{{ route('user.profile', ['name' => $like->user->name]) }}"><img src="{{ $like->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded" data-toggle="tooltip" data-placement="bottom" title="{{ $like->user->display_name }}"></a>
|
||||
<a href="{{ route('user.profile', ['name' => $like->user->name]) }}"><img src="{{ $like->user->getProfileImageUrl(30) }}" srcset="{{ Formatter::profileImageSrcSet($like->user, 30) }}" width="30" height="30" class="rounded" data-toggle="tooltip" data-placement="bottom" title="{{ $like->user->display_name }}"></a>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<img src="{{ $user->getProfileImageUrl(128) }}" class="rounded mb-1">
|
||||
<img src="{{ $user->getProfileImageUrl(128) }}" srcset="{{ Formatter::profileImageSrcSet($user, 128) }}" class="rounded mb-1">
|
||||
<h4 class="card-title">
|
||||
<a class="text-dark" href="{{ route('user.profile', ['name' => $user->name]) }}">{{ $user->display_name }}</a>
|
||||
</h4>
|
||||
|
@ -67,7 +67,7 @@
|
||||
<div class="like-users-tall flex-grow-1 overflow-hidden">
|
||||
@foreach ($ejaculation->likes as $like)
|
||||
@if ($like->user !== null)
|
||||
<a href="{{ route('user.profile', ['name' => $like->user->name]) }}"><img src="{{ $like->user->getProfileImageUrl(36) }}" width="36" height="36" class="rounded" data-toggle="tooltip" data-placement="bottom" title="{{ $like->user->display_name }}"></a>
|
||||
<a href="{{ route('user.profile', ['name' => $like->user->name]) }}"><img src="{{ $like->user->getProfileImageUrl(36) }}" srcset="{{ Formatter::profileImageSrcSet($like->user, 36) }}" width="36" height="36" class="rounded" data-toggle="tooltip" data-placement="bottom" title="{{ $like->user->display_name }}"></a>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-row align-items-end mb-4">
|
||||
<img src="{{ Auth::user()->getProfileImageUrl(48) }}" class="rounded mr-2">
|
||||
<img src="{{ Auth::user()->getProfileImageUrl(48) }}" srcset="{{ Formatter::profileImageSrcSet(Auth::user(), 48) }}" class="rounded mr-2">
|
||||
<div class="d-flex flex-column overflow-hidden">
|
||||
<h5 class="card-title text-truncate">
|
||||
<a class="text-dark" href="{{ route('user.profile', ['name' => Auth::user()->name]) }}">{{ Auth::user()->display_name }}</a>
|
||||
@ -60,7 +60,7 @@
|
||||
</li>
|
||||
@endforeach
|
||||
<li class="list-group-item no-side-border text-right">
|
||||
<a href="{{ route('timeline.public') }}" class="stretched-link">もっと見る »</a>
|
||||
<a href="{{ route('timeline.public', ['page' => 2]) }}" class="stretched-link">もっと見る »</a>
|
||||
</li>
|
||||
</ul>
|
||||
@endif
|
||||
|
@ -40,7 +40,7 @@
|
||||
<div class="d-lg-none navbar-nav">
|
||||
<div class="nav-item dropdown">
|
||||
<a href="#" class="nav-link dropdown-toggle p-2" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<img src="{{ Auth::user()->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-top">
|
||||
<img src="{{ Auth::user()->getProfileImageUrl(30) }}" srcset="{{ Formatter::profileImageSrcSet(Auth::user(), 30) }}" width="30" height="30" class="rounded d-inline-block align-top">
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right position-absolute" aria-labelledby="navbarDropdownMenuLink" id="navbarAccountDropdownSp">
|
||||
<a href="{{ route('user.profile', ['name' => Auth::user()->name]) }}" class="dropdown-item text-truncate">
|
||||
@ -103,7 +103,7 @@
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item dropdown">
|
||||
<a href="#" class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<img src="{{ Auth::user()->getProfileImageUrl(30) }}" width="30" height="30" class="rounded d-inline-block align-top">
|
||||
<img src="{{ Auth::user()->getProfileImageUrl(30) }}" srcset="{{ Formatter::profileImageSrcSet(Auth::user(), 30) }}" width="30" height="30" class="rounded d-inline-block align-top">
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a href="{{ route('user.profile', ['name' => Auth::user()->name]) }}" class="dropdown-item">
|
||||
|
@ -9,7 +9,7 @@
|
||||
{{ csrf_field() }}
|
||||
<div class="from-group">
|
||||
<label for="name">アイコン</label>
|
||||
<img src="{{ Auth::user()->getProfileImageUrl(128) }}" class="rounded d-block">
|
||||
<img src="{{ Auth::user()->getProfileImageUrl(128) }}" srcset="{{ Formatter::profileImageSrcSet(Auth::user(), 128) }}" class="rounded d-block">
|
||||
<small class="form-text text-muted">変更は<a href="https://gravatar.com/" target="_blank">Gravatar</a>から行えます。</small>
|
||||
</div>
|
||||
<div class="from-group mt-3">
|
||||
|
@ -73,7 +73,7 @@
|
||||
<div class="like-users flex-grow-1 overflow-hidden">
|
||||
@foreach ($ejaculation->likes as $like)
|
||||
@if ($like->user !== null)
|
||||
<a href="{{ route('user.profile', ['name' => $like->user->name]) }}"><img src="{{ $like->user->getProfileImageUrl(30) }}" width="30" height="30" class="rounded" data-toggle="tooltip" data-placement="bottom" title="{{ $like->user->display_name }}"></a>
|
||||
<a href="{{ route('user.profile', ['name' => $like->user->name]) }}"><img src="{{ $like->user->getProfileImageUrl(30) }}" srcset="{{ Formatter::profileImageSrcSet($like->user, 30) }}" width="30" height="30" class="rounded" data-toggle="tooltip" data-placement="bottom" title="{{ $like->user->display_name }}"></a>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
@ -54,4 +54,20 @@ class FormatterTest extends TestCase
|
||||
$url = 'http://example.com/path/to?foo=bar&hoge=fuga#';
|
||||
$this->assertEquals('http://example.com/path/to?foo=bar&hoge=fuga', $formatter->normalizeUrl($url));
|
||||
}
|
||||
|
||||
public function testProfileImageSrcSet()
|
||||
{
|
||||
$formatter = new Formatter();
|
||||
$profileImageProvider = new class() {
|
||||
public function getProfileImageUrl(int $size)
|
||||
{
|
||||
return "https://example.com/$size.png";
|
||||
}
|
||||
};
|
||||
|
||||
$this->assertSame(
|
||||
'https://example.com/128.png 1x,https://example.com/256.png 2x',
|
||||
$formatter->profileImageSrcSet($profileImageProvider, 128, 2)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user