update xd score scoring system
This commit is contained in:
@@ -4618,11 +4618,11 @@ window.cancelAnimFrame = (function () {
|
||||
];
|
||||
const getNavXdTier = (s) => {
|
||||
s = +s;
|
||||
if (s <= 0) return 0;
|
||||
if (s < 5) return 1;
|
||||
if (s < 15) return 2;
|
||||
if (s < 30) return 3;
|
||||
if (s < 60) return 4;
|
||||
if (s < 5) return 0;
|
||||
if (s < 200) return 1;
|
||||
if (s < 1000) return 2;
|
||||
if (s < 100000) return 3;
|
||||
if (s < 200000000) return 4;
|
||||
return 5;
|
||||
};
|
||||
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)
|
||||
const XD_TIER_META = [
|
||||
null,
|
||||
{ cls: 'xd-tier-1', label: 'xD', min: 1 },
|
||||
{ cls: 'xd-tier-2', label: 'xDD', min: 5 },
|
||||
{ cls: 'xd-tier-3', label: 'xDDD', min: 15 },
|
||||
{ cls: 'xd-tier-4', label: 'xDDDD', min: 30 },
|
||||
{ cls: 'xd-tier-5', label: 'xDDDDD+', min: 60 },
|
||||
{ cls: 'xd-tier-1', label: 'xD', min: 5 },
|
||||
{ cls: 'xd-tier-2', label: 'xDD', min: 200 },
|
||||
{ cls: 'xd-tier-3', label: 'xDDD', min: 1000 },
|
||||
{ cls: 'xd-tier-4', label: 'xDDDD', min: 100000 },
|
||||
{ cls: 'xd-tier-5', label: 'xDDDDD+', min: 200000000 },
|
||||
];
|
||||
|
||||
const getXdTierFromScore = (score) => {
|
||||
if (score <= 0) return 0;
|
||||
if (score < 5) return 1;
|
||||
if (score < 15) return 2;
|
||||
if (score < 30) return 3;
|
||||
if (score < 60) return 4;
|
||||
if (score < 5) return 0;
|
||||
if (score < 200) return 1;
|
||||
if (score < 1000) return 2;
|
||||
if (score < 100000) return 3;
|
||||
if (score < 200000000) return 4;
|
||||
return 5;
|
||||
};
|
||||
|
||||
|
||||
@@ -1332,11 +1332,11 @@
|
||||
|
||||
const getXdTier = (score) => {
|
||||
score = +score;
|
||||
if (score <= 0) return 0;
|
||||
if (score < 5) return 1;
|
||||
if (score < 15) return 2;
|
||||
if (score < 30) return 3;
|
||||
if (score < 60) return 4;
|
||||
if (score < 5) return 0;
|
||||
if (score < 200) return 1;
|
||||
if (score < 1000) return 2;
|
||||
if (score < 100000) return 3;
|
||||
if (score < 200000000) return 4;
|
||||
return 5;
|
||||
};
|
||||
|
||||
|
||||
@@ -79,19 +79,19 @@ const computeXdScore = (comments) => {
|
||||
for (const c of comments) {
|
||||
if (!c.content || c.is_deleted) continue;
|
||||
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;
|
||||
};
|
||||
|
||||
const xdScoreMeta = (score) => {
|
||||
if (score <= 0) return { tier: 0, label: '' };
|
||||
if (score < 5) return { tier: 1, label: 'xD' };
|
||||
if (score < 15) return { tier: 2, label: 'xDD' };
|
||||
if (score < 30) return { tier: 3, label: 'xDDD' };
|
||||
if (score < 60) return { tier: 4, label: 'xDDDD' };
|
||||
return { tier: 5, label: 'xDDDDD+' };
|
||||
if (score < 5) return { tier: 0, label: '' };
|
||||
if (score < 200) return { tier: 1, label: 'xD' };
|
||||
if (score < 1000) return { tier: 2, label: 'xDD' };
|
||||
if (score < 100000) return { tier: 3, label: 'xDDD' };
|
||||
if (score < 200000000) return { tier: 4, label: 'xDDDD' };
|
||||
return { tier: 5, label: 'xDDDDD+' };
|
||||
};
|
||||
|
||||
export default {
|
||||
@@ -260,6 +260,12 @@ export default {
|
||||
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.
|
||||
// Profile pages, tag searches, halls, favorites, mime filters all use tier 1 (1×1).
|
||||
const isMainFeed = cfg.websrv.enable_dynamic_thumbs
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
@if(item.is_oc)
|
||||
<span class="oc-indicator anim">OC</span>
|
||||
@endif
|
||||
@if(enable_xd_score && item.xd_score > 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>
|
||||
@if(enable_xd_score && item.xd_tier > 0)
|
||||
<span class="thumb-xd-indicator xd-tier-{{ item.xd_tier }}" title="xD Score: {{ item.xd_score }}">xD</span>
|
||||
@endif
|
||||
</div>
|
||||
<p></p>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
@if(item.is_oc)
|
||||
<span class="oc-indicator anim">OC</span>
|
||||
@endif
|
||||
@if(enable_xd_score && item.xd_score > 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>
|
||||
@if(enable_xd_score && item.xd_tier > 0)
|
||||
<span class="thumb-xd-indicator xd-tier-{{ item.xd_tier }}" title="xD Score: {{ item.xd_score }}">xD</span>
|
||||
@endif
|
||||
</div>
|
||||
<p></p>
|
||||
|
||||
Reference in New Issue
Block a user