| ${select} |
@@ -374,7 +401,7 @@ function rowHtml(g) {
${g.year ? esc(g.year) : "—"} |
${review} |
${modeHours(g)} |
- ${g.duration ? fmtDuration(g.duration) : "—"} |
+ ${duration ? fmtDuration(duration.value, duration.approx) : "—"} |
${genres} |
${g.favorite ? "★" : ""} |
`;
@@ -669,7 +696,9 @@ function renderSavedViews(selected = "") {
function syncFilterControls() {
$("#search").value = state.q;
+ $("#searchNameOnly").checked = !!state.nameOnly;
$("#sort").value = state.sort;
+ updateSortDirButton();
$("#fStatus").value = state.filters.status;
$("#fOwnership").value = state.filters.ownership;
$("#fDuration").value = state.filters.duration;
@@ -694,6 +723,7 @@ function syncFilterControls() {
function applySavedView(view) {
const saved = view.filters || {};
state.q = view.q || "";
+ state.nameOnly = !!view.nameOnly;
state.sort = view.sort || "review";
state.dir = view.dir || defaultDir(state.sort);
state.filters = {
@@ -879,6 +909,7 @@ $("#activityYear").addEventListener("change", () => loadActivity($("#activityYea
function filterParams() {
const p = new URLSearchParams();
if (state.q) p.set("q", state.q);
+ if (state.q && state.nameOnly) p.set("name_only", "1");
if (state.filters.status) p.set("status", state.filters.status);
state.filters.genres.forEach((value) => p.append("genre", value));
state.filters.tags.forEach((value) => p.append("tag", value));
@@ -892,6 +923,7 @@ function filterParams() {
["minHours", "min_hours"], ["maxHours", "max_hours"],
["minYear", "min_year"], ["maxYear", "max_year"],
["minReview", "min_review"], ["maxReview", "max_review"],
+ ["minDuration", "min_duration"], ["maxDuration", "max_duration"],
].forEach(([key, param]) => {
if (state.filters[key] !== "") p.set(param, state.filters[key]);
});
@@ -1032,9 +1064,9 @@ function openMoodEditor(mood = null) {
$("#meName").value = mood ? mood.name : "";
$("#meName").disabled = !!mood;
$("#meDesc").value = mood ? (mood.description || "") : "";
- $("#meGenres").value = mood ? (mood.genres || []).join(", ") : "";
+ $("#meGenres").value = mood ? (mood.genres_display || mood.genres || []).join(", ") : "";
$("#meTags").value = mood
- ? Object.entries(mood.tags || {}).map(([tag, weight]) => `${tag}: ${weight}`).join("\n")
+ ? Object.entries(mood.tags_display || mood.tags || {}).map(([tag, weight]) => `${tag}: ${weight}`).join("\n")
: "";
$("#moodEditor").classList.remove("hidden");
$("#meName").focus();
@@ -1814,18 +1846,41 @@ async function loadAchievements(appid) {
}
}
+function setupTagExpansion() {
+ const row = $("#modalTags");
+ const toggle = $("#tagsToggle");
+ if (!row || !toggle) return;
+ const count = row.querySelectorAll(".genre").length;
+ if (count <= 6 || row.scrollHeight <= row.clientHeight + 2) {
+ row.classList.remove("clamped");
+ return;
+ }
+ const label = (collapsed) => collapsed
+ ? `Показать все теги (${count})`
+ : "Свернуть теги";
+ toggle.classList.remove("hidden");
+ toggle.setAttribute("aria-expanded", "false");
+ toggle.textContent = label(true);
+ toggle.addEventListener("click", () => {
+ const collapsed = row.classList.toggle("clamped");
+ toggle.setAttribute("aria-expanded", String(!collapsed));
+ toggle.textContent = label(collapsed);
+ });
+}
+
function renderModal(g) {
const statusOptions = Object.entries(STATUS_LABEL)
.map(([k, v]) => `