gdfgd
This commit is contained in:
+23
-12
@@ -1124,25 +1124,36 @@
|
||||
</div>
|
||||
<div class="filter-scroll-area">
|
||||
@js
|
||||
const _isScrollerAnon = !(typeof session !== 'undefined' && session && session.user && !session.is_anon);
|
||||
const _scrollerAllowedModes = (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_modes) || ['sfw', 'nsfw', 'untagged', 'all', 'nsfl'];
|
||||
const _scrollerShowSfw = !_isScrollerAnon || _scrollerAllowedModes.includes('sfw');
|
||||
const _scrollerShowNsfw = (typeof session !== 'undefined' && session && !session.is_anon) || (_isScrollerAnon && _scrollerAllowedModes.includes('nsfw'));
|
||||
const _scrollerShowNsfl = enable_nsfl && ((typeof session !== 'undefined' && session && !session.is_anon) || (_isScrollerAnon && _scrollerAllowedModes.includes('nsfl')));
|
||||
const _scrollerShowAll = (typeof session !== 'undefined' && session && !session.is_anon) || (_isScrollerAnon && _scrollerAllowedModes.includes('all'));
|
||||
const _scrollerShowUntagged = (typeof session !== 'undefined' && session && (session.admin || session.is_moderator)) || (_isScrollerAnon && _scrollerAllowedModes.includes('untagged'));
|
||||
const _scrollerActiveModes = [_scrollerShowSfw ? 'sfw' : null, _scrollerShowNsfw ? 'nsfw' : null, _scrollerShowNsfl ? 'nsfl' : null, _scrollerShowUntagged ? 'untagged' : null].filter(Boolean);
|
||||
const _scrollerIsSingleMode = _isScrollerAnon && _scrollerActiveModes.length === 1 && !_scrollerShowAll;
|
||||
const _scrollerSingleMode = _scrollerIsSingleMode ? _scrollerActiveModes[0] : null;
|
||||
const _isScrollerMember = typeof session !== 'undefined' && session && session.user && !session.is_anon;
|
||||
const _isScrollerAnon = typeof session !== 'undefined' && session && (session.is_anon || session.user === 'anonymous' || (typeof session.user === 'string' && session.user.startsWith('anon_')));
|
||||
const _isScrollerGuest = !_isScrollerMember && !_isScrollerAnon;
|
||||
const _isScrollerAnonUser = !_isScrollerMember;
|
||||
const _scrollerAllowedModes = _isScrollerGuest ? ['sfw'] : ((typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_modes) || ['sfw', 'nsfw', 'untagged', 'all', 'nsfl']);
|
||||
const _scrollerShowSfw = true;
|
||||
const _scrollerShowNsfw = _isScrollerGuest || (!_isScrollerAnonUser || _scrollerAllowedModes.includes('nsfw'));
|
||||
const _scrollerShowNsfl = enable_nsfl && (_isScrollerGuest || (!_isScrollerAnonUser || _scrollerAllowedModes.includes('nsfl')));
|
||||
const _scrollerShowAll = _isScrollerGuest || (!_isScrollerAnonUser || _scrollerAllowedModes.includes('all'));
|
||||
const _scrollerShowUntagged = _isScrollerGuest || (typeof session !== 'undefined' && session && (session.admin || session.is_moderator)) || (_isScrollerAnonUser && _scrollerAllowedModes.includes('untagged'));
|
||||
const _scrollerActiveModes = _isScrollerGuest ? ['sfw'] : [_scrollerShowSfw ? 'sfw' : null, _scrollerShowNsfw ? 'nsfw' : null, _scrollerShowNsfl ? 'nsfl' : null, _scrollerShowUntagged ? 'untagged' : null].filter(Boolean);
|
||||
const _scrollerIsSingleMode = _isScrollerGuest || (_isScrollerAnonUser && _scrollerActiveModes.length === 1 && !_scrollerShowAll);
|
||||
const _scrollerSingleMode = _isScrollerGuest ? 'sfw' : (_scrollerIsSingleMode ? _scrollerActiveModes[0] : null);
|
||||
|
||||
const _scrollerAllowedMimes = (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_mimes) || ['image', 'video', 'audio', 'flash', 'pdf'];
|
||||
const _scrollerIsSingleMime = _isScrollerAnon && _scrollerAllowedMimes.length === 1;
|
||||
const _scrollerIsSingleMime = _isScrollerAnonUser && _scrollerAllowedMimes.length === 1;
|
||||
const _scrollerSingleMime = _scrollerIsSingleMime ? _scrollerAllowedMimes[0] : null;
|
||||
@endjs
|
||||
<div class="filter-section">
|
||||
<div class="filter-section-label">{{ t('scroller.rating') }}</div>
|
||||
<div class="pill-group" id="mode-pills">
|
||||
@if(_scrollerIsSingleMode)
|
||||
@if(_isScrollerGuest)
|
||||
<button class="filter-pill active locked" data-mode="0" style="cursor: default;" title="SFW"><i class="fa-solid fa-shield-halved"></i>SFW<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||
<button class="filter-pill locked" data-mode="1" style="cursor: not-allowed; opacity: 0.45;" title="Only available for members" disabled><i class="fa-solid fa-fire"></i>NSFW<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||
@if(enable_nsfl)
|
||||
<button class="filter-pill locked" data-mode="4" style="cursor: not-allowed; opacity: 0.45;" title="Only available for members" disabled><i class="fa-solid fa-skull"></i>NSFL<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||
@endif
|
||||
<button class="filter-pill locked" data-mode="3" style="cursor: not-allowed; opacity: 0.45;" title="Only available for members" disabled>ALL<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||
<button class="filter-pill locked" data-mode="2" style="cursor: not-allowed; opacity: 0.45;" title="Only available for members" disabled>{{ t('scroller.untagged') }}<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||
@elseif(_scrollerIsSingleMode)
|
||||
<button class="filter-pill active locked" data-mode="{{ _scrollerSingleMode === 'sfw' ? 0 : (_scrollerSingleMode === 'nsfw' ? 1 : (_scrollerSingleMode === 'nsfl' ? 4 : 2)) }}" style="cursor: not-allowed; pointer-events: none;" title="Locked by site permissions"><i class="fa-solid fa-lock" style="margin-right: 4px;"></i>{{ _scrollerSingleMode.toUpperCase() }}</button>
|
||||
@else
|
||||
@if(_scrollerShowSfw)
|
||||
|
||||
Reference in New Issue
Block a user