Add game_ownership (schema v10) and tools/check_ownership.py, compare the local library with GetOwnedGames, expose owned/shared counts and filters, and show a shared-game badge on cards.
This commit is contained in:
1 parent
528fcb7474
commit
2ed00b7912
18 files changed
+255
-10
No files matched your search
+8
-2
@@ -19,7 +19,7 @@ let coldStartManual = false;
|
||||
function defaultFilters() {
|
||||
return {
|
||||
status: "", genres: [], tags: [], installed: false, unplayed: false, favorite: false,
|
||||
duration: "", minHours: "", maxHours: "", minYear: "", maxYear: "",
|
||||
ownership: "", duration: "", minHours: "", maxHours: "", minYear: "", maxYear: "",
|
||||
minReview: "", maxReview: "",
|
||||
};
|
||||
}
|
||||
@@ -273,6 +273,9 @@ function cardHtml(g, mode = "library") {
|
||||
? `<span class="badge score">${g.score}</span>`
|
||||
: (g.review != null ? `<span class="badge review ${g.review < 85 ? "warn" : ""}">${g.review}%</span>` : "");
|
||||
const installed = g.installed ? `<span class="badge installed" title="установлена">●</span>` : "";
|
||||
const shared = g.owned === 0
|
||||
? `<span class="badge shared" title="Не в списке владения (возможно, семейная)">семейная</span>`
|
||||
: "";
|
||||
const selectBox = mode === "library" && state.selectionMode
|
||||
? `<label class="select-box" title="Выбрать игру"><input type="checkbox" value="${g.appid}" data-select="${g.appid}"${state.selected.has(g.appid) ? " checked" : ""} aria-label="Выбрать игру"></label>`
|
||||
: "";
|
||||
@@ -304,7 +307,7 @@ function cardHtml(g, mode = "library") {
|
||||
<img data-appid="${g.appid}" loading="lazy" width="300" height="450"
|
||||
src="${coverUrl(g.appid)}" alt="">
|
||||
<div class="fallback">${esc(initials(g.name))}</div>
|
||||
${review}${installed}${selectBox}
|
||||
${review}${installed}${shared}${selectBox}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h3 class="card-title">${esc(g.name)}</h3>
|
||||
@@ -667,6 +670,7 @@ function syncFilterControls() {
|
||||
$("#search").value = state.q;
|
||||
$("#sort").value = state.sort;
|
||||
$("#fStatus").value = state.filters.status;
|
||||
$("#fOwnership").value = state.filters.ownership;
|
||||
$("#fDuration").value = state.filters.duration;
|
||||
$("#fInstalled").checked = !!state.filters.installed;
|
||||
$("#fUnplayed").checked = !!state.filters.unplayed;
|
||||
@@ -880,6 +884,7 @@ function filterParams() {
|
||||
if (state.filters.installed) p.set("installed", "1");
|
||||
if (state.filters.unplayed) p.set("unplayed", "1");
|
||||
if (state.filters.favorite) p.set("favorite", "1");
|
||||
if (state.filters.ownership) p.set("ownership", state.filters.ownership);
|
||||
if (state.filters.duration) p.set("duration", state.filters.duration);
|
||||
p.set("dir", state.dir);
|
||||
[
|
||||
@@ -1728,6 +1733,7 @@ $("#sort").addEventListener("change", (e) => {
|
||||
});
|
||||
|
||||
$("#fStatus").addEventListener("change", (e) => { state.filters.status = e.target.value; loadGames(true); });
|
||||
$("#fOwnership").addEventListener("change", (e) => { state.filters.ownership = e.target.value; loadGames(true); });
|
||||
$("#fDuration").addEventListener("change", (e) => { state.filters.duration = e.target.value; loadGames(true); });
|
||||
let rangeTimer = null;
|
||||
document.querySelectorAll("[data-filter]").forEach((input) => {
|
||||
|
||||
@@ -98,6 +98,15 @@ try {
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="field">
|
||||
<span>Владение</span>
|
||||
<select id="fOwnership">
|
||||
<option value="">любое</option>
|
||||
<option value="owned">личные</option>
|
||||
<option value="shared">не в списке владения</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<div class="field">
|
||||
<span>Жанры</span>
|
||||
<details class="multi-select" id="genreSelect">
|
||||
|
||||
@@ -681,6 +681,7 @@ html[data-theme="light"] .game-table tbody tr:hover { background: rgba(23, 32, 5
|
||||
.badge.review { top: 8px; left: 8px; color: #b8f5e9; }
|
||||
.badge.review.warn { color: #ffd59a; }
|
||||
.badge.installed { top: 8px; right: 8px; color: var(--accent-2); }
|
||||
.badge.shared { top: 34px; right: 8px; color: #f5b8c9; font-size: 10px; }
|
||||
.badge.score { top: 8px; left: 8px; color: #0a0d13; background: linear-gradient(135deg, var(--accent), #ffd59a); border: 0; }
|
||||
|
||||
.card-body { display: flex; flex-direction: column; gap: 7px; padding: 11px 12px 13px; }
|
||||
|
||||
Reference in new issue
Block a user