update xd score scoring system

This commit is contained in:
2026-05-23 22:23:51 +02:00
parent 6137545cab
commit e61654c567
5 changed files with 37 additions and 31 deletions

View File

@@ -4618,11 +4618,11 @@ window.cancelAnimFrame = (function () {
]; ];
const getNavXdTier = (s) => { const getNavXdTier = (s) => {
s = +s; s = +s;
if (s <= 0) return 0; if (s < 5) return 0;
if (s < 5) return 1; if (s < 200) return 1;
if (s < 15) return 2; if (s < 1000) return 2;
if (s < 30) return 3; if (s < 100000) return 3;
if (s < 60) return 4; if (s < 200000000) return 4;
return 5; return 5;
}; };
const XD_TIER_COLORS = ['#888', '#5a9e5a', '#8ac449', '#d4a017', '#e07b2a', '#ff5500']; const XD_TIER_COLORS = ['#888', '#5a9e5a', '#8ac449', '#d4a017', '#e07b2a', '#ff5500'];
@@ -4770,19 +4770,19 @@ window.cancelAnimFrame = (function () {
// 2. Any grid thumbnail indicators for that item (on any page) // 2. Any grid thumbnail indicators for that item (on any page)
const XD_TIER_META = [ const XD_TIER_META = [
null, null,
{ cls: 'xd-tier-1', label: 'xD', min: 1 }, { cls: 'xd-tier-1', label: 'xD', min: 5 },
{ cls: 'xd-tier-2', label: 'xDD', min: 5 }, { cls: 'xd-tier-2', label: 'xDD', min: 200 },
{ cls: 'xd-tier-3', label: 'xDDD', min: 15 }, { cls: 'xd-tier-3', label: 'xDDD', min: 1000 },
{ cls: 'xd-tier-4', label: 'xDDDD', min: 30 }, { cls: 'xd-tier-4', label: 'xDDDD', min: 100000 },
{ cls: 'xd-tier-5', label: 'xDDDDD+', min: 60 }, { cls: 'xd-tier-5', label: 'xDDDDD+', min: 200000000 },
]; ];
const getXdTierFromScore = (score) => { const getXdTierFromScore = (score) => {
if (score <= 0) return 0; if (score < 5) return 0;
if (score < 5) return 1; if (score < 200) return 1;
if (score < 15) return 2; if (score < 1000) return 2;
if (score < 30) return 3; if (score < 100000) return 3;
if (score < 60) return 4; if (score < 200000000) return 4;
return 5; return 5;
}; };

View File

@@ -1332,11 +1332,11 @@
const getXdTier = (score) => { const getXdTier = (score) => {
score = +score; score = +score;
if (score <= 0) return 0; if (score < 5) return 0;
if (score < 5) return 1; if (score < 200) return 1;
if (score < 15) return 2; if (score < 1000) return 2;
if (score < 30) return 3; if (score < 100000) return 3;
if (score < 60) return 4; if (score < 200000000) return 4;
return 5; return 5;
}; };

View File

@@ -79,18 +79,18 @@ const computeXdScore = (comments) => {
for (const c of comments) { for (const c of comments) {
if (!c.content || c.is_deleted) continue; if (!c.content || c.is_deleted) continue;
for (const m of c.content.matchAll(xdRegex)) { for (const m of c.content.matchAll(xdRegex)) {
score += m[1].length; // 1pt per D: xD=1, xDD=2, xDDD=3, ... score += m[1].length;
} }
} }
return score; return score;
}; };
const xdScoreMeta = (score) => { const xdScoreMeta = (score) => {
if (score <= 0) return { tier: 0, label: '' }; if (score < 5) return { tier: 0, label: '' };
if (score < 5) return { tier: 1, label: 'xD' }; if (score < 200) return { tier: 1, label: 'xD' };
if (score < 15) return { tier: 2, label: 'xDD' }; if (score < 1000) return { tier: 2, label: 'xDD' };
if (score < 30) return { tier: 3, label: 'xDDD' }; if (score < 100000) return { tier: 3, label: 'xDDD' };
if (score < 60) return { tier: 4, label: 'xDDDD' }; if (score < 200000000) return { tier: 4, label: 'xDDDD' };
return { tier: 5, label: 'xDDDDD+' }; return { tier: 5, label: 'xDDDDD+' };
}; };
@@ -260,6 +260,12 @@ export default {
limit ${eps} limit ${eps}
`; `;
for (const row of rows) {
const meta = xdScoreMeta(row.xd_score);
row.xd_tier = meta.tier;
row.xd_label = meta.label;
}
// Dynamic thumb sizing: only on the unfiltered main feed. // Dynamic thumb sizing: only on the unfiltered main feed.
// Profile pages, tag searches, halls, favorites, mime filters all use tier 1 (1×1). // Profile pages, tag searches, halls, favorites, mime filters all use tier 1 (1×1).
const isMainFeed = cfg.websrv.enable_dynamic_thumbs const isMainFeed = cfg.websrv.enable_dynamic_thumbs

View File

@@ -11,8 +11,8 @@
@if(item.is_oc) @if(item.is_oc)
<span class="oc-indicator anim">OC</span> <span class="oc-indicator anim">OC</span>
@endif @endif
@if(enable_xd_score && item.xd_score > 0) @if(enable_xd_score && item.xd_tier > 0)
<span class="thumb-xd-indicator xd-tier-{{ item.xd_score >= 60 ? 5 : (item.xd_score >= 30 ? 4 : (item.xd_score >= 15 ? 3 : (item.xd_score >= 5 ? 2 : 1))) }}" title="xD Score: {{ item.xd_score }}">xD</span> <span class="thumb-xd-indicator xd-tier-{{ item.xd_tier }}" title="xD Score: {{ item.xd_score }}">xD</span>
@endif @endif
</div> </div>
<p></p> <p></p>

View File

@@ -7,8 +7,8 @@
@if(item.is_oc) @if(item.is_oc)
<span class="oc-indicator anim">OC</span> <span class="oc-indicator anim">OC</span>
@endif @endif
@if(enable_xd_score && item.xd_score > 0) @if(enable_xd_score && item.xd_tier > 0)
<span class="thumb-xd-indicator xd-tier-{{ item.xd_score >= 60 ? 5 : (item.xd_score >= 30 ? 4 : (item.xd_score >= 15 ? 3 : (item.xd_score >= 5 ? 2 : 1))) }}" title="xD Score: {{ item.xd_score }}">xD</span> <span class="thumb-xd-indicator xd-tier-{{ item.xd_tier }}" title="xD Score: {{ item.xd_score }}">xD</span>
@endif @endif
</div> </div>
<p></p> <p></p>