Add friend search and online/offline filter, sort online friends first, move the comparison panel above the list, cache comparisons in the browser, add game search and show local/friend hours with installed badges.
This commit is contained in:
1 parent
71ca94d5e3
commit
80aae1a1df
7 files changed
+313
-63
No files matched your search
@@ -150,6 +150,9 @@
|
|||||||
- Вкладка «Друзья»: `GET /api/steam/friends`, `GET /api/steam/friends/{steamid}`,
|
- Вкладка «Друзья»: `GET /api/steam/friends`, `GET /api/steam/friends/{steamid}`,
|
||||||
сравнение библиотек (общие игры, игры друга вне библиотеки), кэш 1 час.
|
сравнение библиотек (общие игры, игры друга вне библиотеки), кэш 1 час.
|
||||||
При закрытом списке друзей можно ввести SteamID64 вручную.
|
При закрытом списке друзей можно ввести SteamID64 вручную.
|
||||||
|
- Страница «Друзья» удобнее: поиск и фильтр по статусу, онлайн-друзья первыми,
|
||||||
|
сворачиваемый ручной SteamID, поиск по играм в сравнении, часы обоих игроков,
|
||||||
|
отметка «установлена» и переход в профиль Steam.
|
||||||
- DLC/саундтреки/тулзы связаны с базовой игрой (`games.parent_appid`, схема v9):
|
- DLC/саундтреки/тулзы связаны с базовой игрой (`games.parent_appid`, схема v9):
|
||||||
в карточке появились блок «Дополнения» и ссылка «Часть игры»;
|
в карточке появились блок «Дополнения» и ссылка «Часть игры»;
|
||||||
`import_steam.py --refresh-parents` заполняет связи без полного импорта.
|
`import_steam.py --refresh-parents` заполняет связи без полного импорта.
|
||||||
|
|||||||
+7
-5
@@ -402,11 +402,13 @@ API может меняться. Без пакета проект работае
|
|||||||
### Друзья
|
### Друзья
|
||||||
|
|
||||||
Вкладка **Друзья** (нужен ключ Steam Web API) показывает список друзей с аватарами
|
Вкладка **Друзья** (нужен ключ Steam Web API) показывает список друзей с аватарами
|
||||||
и статусом. Если список друзей закрыт настройками приватности, можно ввести
|
и статусом; онлайн-друзья идут первыми. Есть поиск по имени, фильтр
|
||||||
SteamID64 друга вручную. Клик по другу или кнопка «сравнить» открывает сравнение
|
онлайн/офлайн и кнопка «обновить». Если список закрыт настройками приватности,
|
||||||
библиотек: общие игры (со статусом и часами друга) и игры, которых нет в вашей
|
SteamID64 друга можно ввести вручную в сворачиваемом блоке. Клик по другу
|
||||||
библиотеке (ссылка в Steam). Список и сравнение кэшируются на сервере на час;
|
открывает сравнение библиотек: общие игры (статус, ваши и его часы, отметка
|
||||||
без ключа вкладка показывает подсказку.
|
«установлена») и игры, которых нет в вашей библиотеке (ссылка в Steam). В сравнении
|
||||||
|
есть поиск по названию и переход в профиль Steam. Список и сравнение кэшируются
|
||||||
|
на сервере на час; без ключа вкладка показывает подсказку.
|
||||||
|
|
||||||
### Перевод
|
### Перевод
|
||||||
|
|
||||||
|
|||||||
@@ -544,6 +544,8 @@ class ApiTests(unittest.TestCase):
|
|||||||
self.assertEqual(data["common_count"], 1)
|
self.assertEqual(data["common_count"], 1)
|
||||||
self.assertEqual(data["common"][0]["appid"], 1)
|
self.assertEqual(data["common"][0]["appid"], 1)
|
||||||
self.assertEqual(data["common"][0]["status"], "playing")
|
self.assertEqual(data["common"][0]["status"], "playing")
|
||||||
|
self.assertEqual(data["common"][0]["local_hours"], 2.0)
|
||||||
|
self.assertTrue(data["common"][0]["installed"])
|
||||||
self.assertEqual(data["friend_only_count"], 1)
|
self.assertEqual(data["friend_only_count"], 1)
|
||||||
self.assertEqual(data["friend_only"][0]["appid"], 999)
|
self.assertEqual(data["friend_only"][0]["appid"], 999)
|
||||||
|
|
||||||
|
|||||||
+10
-2
@@ -1436,8 +1436,13 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
return
|
return
|
||||||
local = {
|
local = {
|
||||||
row["appid"]: row for row in con.execute(
|
row["appid"]: row for row in con.execute(
|
||||||
"""SELECT g.appid, g.name, COALESCE(pe.status, 'backlog') AS status
|
"""SELECT g.appid, g.name, COALESCE(pe.status, 'backlog') AS status,
|
||||||
FROM games g LEFT JOIN personal pe ON pe.appid = g.appid
|
COALESCE(p.minutes, 0) AS minutes,
|
||||||
|
COALESCE(i.installed, 0) AS installed
|
||||||
|
FROM games g
|
||||||
|
LEFT JOIN personal pe ON pe.appid = g.appid
|
||||||
|
LEFT JOIN game_playtime p ON p.appid = g.appid
|
||||||
|
LEFT JOIN game_install i ON i.appid = g.appid
|
||||||
WHERE LOWER(g.type) = 'game'""")
|
WHERE LOWER(g.type) = 'game'""")
|
||||||
}
|
}
|
||||||
common, friend_only = [], []
|
common, friend_only = [], []
|
||||||
@@ -1450,6 +1455,8 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
common.append({
|
common.append({
|
||||||
"appid": appid, "name": local[appid]["name"],
|
"appid": appid, "name": local[appid]["name"],
|
||||||
"status": local[appid]["status"], "friend_hours": hours,
|
"status": local[appid]["status"], "friend_hours": hours,
|
||||||
|
"local_hours": round((local[appid]["minutes"] or 0) / 60, 1),
|
||||||
|
"installed": bool(local[appid]["installed"]),
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
friend_only.append({
|
friend_only.append({
|
||||||
@@ -1465,6 +1472,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
"avatar": player.get("avatarmedium") or player.get("avatar") or "",
|
"avatar": player.get("avatarmedium") or player.get("avatar") or "",
|
||||||
"profile_url": player.get("profileurl")
|
"profile_url": player.get("profileurl")
|
||||||
or f"https://steamcommunity.com/profiles/{friend_id}",
|
or f"https://steamcommunity.com/profiles/{friend_id}",
|
||||||
|
"state": player.get("personastate"),
|
||||||
"total_games": len(games),
|
"total_games": len(games),
|
||||||
"common_count": len(common),
|
"common_count": len(common),
|
||||||
"friend_only_count": len(friend_only),
|
"friend_only_count": len(friend_only),
|
||||||
|
|||||||
+191
-40
@@ -1384,90 +1384,240 @@ recoGrid.addEventListener("click", async (event) => {
|
|||||||
|
|
||||||
const FRIEND_STATE = ["офлайн", "онлайн", "занят", "не беспокоить", "отошёл",
|
const FRIEND_STATE = ["офлайн", "онлайн", "занят", "не беспокоить", "отошёл",
|
||||||
"не активен", "хочет играть"];
|
"не активен", "хочет играть"];
|
||||||
|
const friendsState = {
|
||||||
|
items: [],
|
||||||
|
loaded: false,
|
||||||
|
query: "",
|
||||||
|
status: "",
|
||||||
|
cache: new Map(),
|
||||||
|
compare: null,
|
||||||
|
compareQuery: "",
|
||||||
|
limit: 100,
|
||||||
|
};
|
||||||
|
|
||||||
|
function friendOnline(friend) {
|
||||||
|
return Number(friend.state) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function friendSince(friend) {
|
||||||
|
if (!friend.friend_since) return "";
|
||||||
|
const date = new Date(friend.friend_since * 1000);
|
||||||
|
return Number.isNaN(date.getTime()) ? "" : `с ${date.getFullYear()}`;
|
||||||
|
}
|
||||||
|
|
||||||
function friendCardHtml(friend) {
|
function friendCardHtml(friend) {
|
||||||
const label = FRIEND_STATE[friend.state] || "";
|
const online = friendOnline(friend);
|
||||||
|
const label = FRIEND_STATE[Number(friend.state)] || "";
|
||||||
|
const since = friendSince(friend);
|
||||||
return `<button class="friend-card" type="button" data-steamid="${esc(friend.steamid)}">
|
return `<button class="friend-card" type="button" data-steamid="${esc(friend.steamid)}">
|
||||||
${friend.avatar
|
<span class="friend-avatar-wrap">
|
||||||
? `<img src="${esc(friend.avatar)}" alt="" width="48" height="48" loading="lazy">`
|
${friend.avatar
|
||||||
: `<span class="friend-avatar"></span>`}
|
? `<img src="${esc(friend.avatar)}" alt="" width="44" height="44" loading="lazy">`
|
||||||
<span class="friend-info"><b>${esc(friend.name)}</b><span class="muted">${esc(label)}</span></span>
|
: `<span class="friend-avatar"></span>`}
|
||||||
|
<span class="friend-dot ${online ? "online" : "offline"}"></span>
|
||||||
|
</span>
|
||||||
|
<span class="friend-info">
|
||||||
|
<b>${esc(friend.name)}</b>
|
||||||
|
<span class="friend-meta">${esc(label)}${since ? ` · ${esc(since)}` : ""}</span>
|
||||||
|
</span>
|
||||||
</button>`;
|
</button>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function friendGameList(items, local) {
|
function renderFriends() {
|
||||||
|
const box = $("#friendsList");
|
||||||
|
if (!box) return;
|
||||||
|
const query = friendsState.query.trim().toLowerCase();
|
||||||
|
let items = friendsState.items.filter((friend) => {
|
||||||
|
if (query && !friend.name.toLowerCase().includes(query)) return false;
|
||||||
|
if (friendsState.status === "online" && !friendOnline(friend)) return false;
|
||||||
|
if (friendsState.status === "offline" && friendOnline(friend)) return false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
items.sort((a, b) => {
|
||||||
|
const online = Number(friendOnline(b)) - Number(friendOnline(a));
|
||||||
|
return online || a.name.localeCompare(b.name, "ru");
|
||||||
|
});
|
||||||
|
const online = friendsState.items.filter(friendOnline).length;
|
||||||
|
$("#friendsCount").textContent = items.length === friendsState.items.length
|
||||||
|
? `${friendsState.items.length} друзей`
|
||||||
|
: `показано ${items.length} из ${friendsState.items.length}`;
|
||||||
|
$("#friendsSummary").textContent =
|
||||||
|
`${online} онлайн · ${friendsState.items.length - online} офлайн`;
|
||||||
|
if (!items.length) {
|
||||||
|
box.innerHTML = '<div class="empty">ничего не найдено</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
box.innerHTML = items.map(friendCardHtml).join("");
|
||||||
|
box.querySelectorAll(".friend-card").forEach((card) => {
|
||||||
|
card.addEventListener("click", () => openFriendCompare(card.dataset.steamid));
|
||||||
|
});
|
||||||
|
if (friendsState.compare) {
|
||||||
|
const active = box.querySelector(
|
||||||
|
`.friend-card[data-steamid="${CSS.escape(String(friendsState.compare.steamid))}"]`);
|
||||||
|
if (active) active.classList.add("active");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function friendGameList(items, local, limit) {
|
||||||
if (!items.length) return '<div class="muted">нет</div>';
|
if (!items.length) return '<div class="muted">нет</div>';
|
||||||
return `<ul>${items.slice(0, 200).map((game) => {
|
const rows = items.slice(0, limit).map((game) => {
|
||||||
const hours = game.friend_hours ? `${game.friend_hours} ч` : "";
|
const friendHours = game.friend_hours ? `друг: ${game.friend_hours} ч` : "";
|
||||||
const score = local
|
const localHours = local && game.local_hours ? `вы: ${game.local_hours} ч` : "";
|
||||||
? `${esc(STATUS_LABEL[game.status] || game.status || "")}${hours ? ` · ${hours}` : ""}`
|
const hours = [localHours, friendHours].filter(Boolean).join(" · ");
|
||||||
: hours;
|
const status = local ? (STATUS_LABEL[game.status] || game.status || "") : "";
|
||||||
|
const meta = [status, hours].filter(Boolean).join(" · ");
|
||||||
|
const badge = game.installed ? '<span class="friend-installed">установлена</span>' : "";
|
||||||
const name = local
|
const name = local
|
||||||
? `<button class="link" type="button" data-appid="${game.appid}">${esc(game.name)}</button>`
|
? `<button class="link" type="button" data-appid="${game.appid}">${esc(game.name)}</button>`
|
||||||
: `<a class="link" href="https://store.steampowered.com/app/${game.appid}/" target="_blank" rel="noopener">${esc(game.name)}</a>`;
|
: `<a class="link" href="https://store.steampowered.com/app/${game.appid}/" target="_blank" rel="noopener">${esc(game.name)}</a>`;
|
||||||
return `<li>${name}<span class="compare-score">${score}</span></li>`;
|
return `<li>${name}${badge}<span class="compare-score">${esc(meta)}</span></li>`;
|
||||||
}).join("")}</ul>`;
|
}).join("");
|
||||||
|
return `<ul>${rows}</ul>` +
|
||||||
|
(items.length > limit
|
||||||
|
? `<button class="link friend-more" type="button">показать ещё ${Math.min(100, items.length - limit)}</button>`
|
||||||
|
: "");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadFriends() {
|
function renderFriendCompare(data) {
|
||||||
|
const box = $("#friendCompare");
|
||||||
|
const query = friendsState.compareQuery.trim().toLowerCase();
|
||||||
|
const matches = (game) => !query || game.name.toLowerCase().includes(query);
|
||||||
|
const common = (data.common || []).filter(matches);
|
||||||
|
const only = (data.friend_only || []).filter(matches);
|
||||||
|
const online = friendOnline(data);
|
||||||
|
box.classList.remove("hidden");
|
||||||
|
box.innerHTML = `
|
||||||
|
<div class="friend-head">
|
||||||
|
<span class="friend-avatar-wrap">
|
||||||
|
${data.avatar
|
||||||
|
? `<img src="${esc(data.avatar)}" alt="" width="56" height="56">`
|
||||||
|
: `<span class="friend-avatar"></span>`}
|
||||||
|
<span class="friend-dot ${online ? "online" : "offline"}"></span>
|
||||||
|
</span>
|
||||||
|
<div class="friend-title">
|
||||||
|
<h2>${esc(data.name)}</h2>
|
||||||
|
<div class="muted">общих: ${data.common_count} · всего у друга: ${data.total_games} · вне библиотеки: ${data.friend_only_count}</div>
|
||||||
|
<a class="friend-profile" href="${esc(data.profile_url)}" target="_blank" rel="noopener">профиль Steam ↗</a>
|
||||||
|
</div>
|
||||||
|
<button id="friendClose" class="link" type="button">закрыть</button>
|
||||||
|
</div>
|
||||||
|
<div class="friend-compare-toolbar">
|
||||||
|
<input id="friendGameSearch" type="search" placeholder="Поиск игры…"
|
||||||
|
aria-label="Поиск игры у друга" value="${esc(friendsState.compareQuery)}">
|
||||||
|
<span class="count">${common.length} / ${only.length}</span>
|
||||||
|
</div>
|
||||||
|
<div class="friend-columns">
|
||||||
|
<div class="compare-col"><h3>есть у обоих (${common.length})</h3>${friendGameList(common, true, friendsState.limit)}</div>
|
||||||
|
<div class="compare-col"><h3>только у друга (${only.length})</h3>${friendGameList(only, false, friendsState.limit)}</div>
|
||||||
|
</div>`;
|
||||||
|
$("#friendClose").addEventListener("click", () => {
|
||||||
|
box.classList.add("hidden");
|
||||||
|
setFriendUrl(null);
|
||||||
|
});
|
||||||
|
box.querySelectorAll("button[data-appid]").forEach((button) => {
|
||||||
|
button.addEventListener("click", () => openGame(Number(button.dataset.appid)));
|
||||||
|
});
|
||||||
|
box.querySelectorAll(".friend-more").forEach((button) => {
|
||||||
|
button.addEventListener("click", () => {
|
||||||
|
friendsState.limit += 100;
|
||||||
|
renderFriendCompare(friendsState.compare);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const search = $("#friendGameSearch");
|
||||||
|
search.addEventListener("input", debounce(() => {
|
||||||
|
friendsState.compareQuery = search.value;
|
||||||
|
renderFriendCompare(friendsState.compare);
|
||||||
|
const input = $("#friendGameSearch");
|
||||||
|
if (input) {
|
||||||
|
input.focus();
|
||||||
|
input.setSelectionRange(input.value.length, input.value.length);
|
||||||
|
}
|
||||||
|
}, 200));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadFriends(force = false) {
|
||||||
const box = $("#friendsList");
|
const box = $("#friendsList");
|
||||||
if (!box) return;
|
if (!box) return;
|
||||||
if (!state.meta || !state.meta.steam_api) {
|
if (!state.meta || !state.meta.steam_api) {
|
||||||
box.innerHTML = '<div class="empty">Steam API не настроен: добавь ключ и перезапусти сервер.</div>';
|
box.innerHTML = '<div class="empty">Steam API не настроен: добавь ключ и перезапусти сервер.</div>';
|
||||||
$("#friendsSummary").textContent = "";
|
$("#friendsSummary").textContent = "";
|
||||||
|
$("#friendsCount").textContent = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (friendsState.loaded && !force) {
|
||||||
|
renderFriends();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
box.innerHTML = '<div class="muted">загрузка…</div>';
|
box.innerHTML = '<div class="muted">загрузка…</div>';
|
||||||
try {
|
try {
|
||||||
const data = await api("/api/steam/friends");
|
const data = await api("/api/steam/friends");
|
||||||
$("#friendsSummary").textContent = `Всего: ${data.total}`;
|
|
||||||
if (data.private) {
|
if (data.private) {
|
||||||
|
friendsState.items = [];
|
||||||
|
friendsState.loaded = true;
|
||||||
$("#friendsSummary").textContent = "Список закрыт";
|
$("#friendsSummary").textContent = "Список закрыт";
|
||||||
|
$("#friendsCount").textContent = "";
|
||||||
|
$("#friendsManual").open = true;
|
||||||
box.innerHTML = '<div class="empty">Список друзей недоступен (профиль Steam закрыт). Введи SteamID64 друга вручную.</div>';
|
box.innerHTML = '<div class="empty">Список друзей недоступен (профиль Steam закрыт). Введи SteamID64 друга вручную.</div>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!data.friends.length) {
|
friendsState.items = data.friends || [];
|
||||||
box.innerHTML = '<div class="empty">друзей не найдено</div>';
|
friendsState.loaded = true;
|
||||||
return;
|
renderFriends();
|
||||||
}
|
|
||||||
box.innerHTML = data.friends.map(friendCardHtml).join("");
|
|
||||||
box.querySelectorAll(".friend-card").forEach((card) => {
|
|
||||||
card.addEventListener("click", () => openFriendCompare(card.dataset.steamid));
|
|
||||||
});
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
friendsState.loaded = false;
|
||||||
box.innerHTML = `<div class="empty">${esc(err.message)}</div>`;
|
box.innerHTML = `<div class="empty">${esc(err.message)}</div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setFriendUrl(steamid) {
|
||||||
|
try {
|
||||||
|
const url = new URL(location.href);
|
||||||
|
url.searchParams.set("view", "friends");
|
||||||
|
if (steamid) url.searchParams.set("friend", steamid);
|
||||||
|
else url.searchParams.delete("friend");
|
||||||
|
history.replaceState(null, "", url);
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
|
||||||
async function openFriendCompare(steamid) {
|
async function openFriendCompare(steamid) {
|
||||||
const box = $("#friendCompare");
|
const box = $("#friendCompare");
|
||||||
box.classList.remove("hidden");
|
box.classList.remove("hidden");
|
||||||
|
setFriendUrl(steamid);
|
||||||
|
document.querySelectorAll(".friend-card.active").forEach((card) => card.classList.remove("active"));
|
||||||
|
const active = document.querySelector(
|
||||||
|
`.friend-card[data-steamid="${CSS.escape(String(steamid))}"]`);
|
||||||
|
if (active) active.classList.add("active");
|
||||||
|
friendsState.compareQuery = "";
|
||||||
|
friendsState.limit = 100;
|
||||||
|
const cached = friendsState.cache.get(steamid);
|
||||||
|
if (cached) {
|
||||||
|
friendsState.compare = cached;
|
||||||
|
renderFriendCompare(cached);
|
||||||
|
box.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
box.innerHTML = '<div class="muted">загрузка…</div>';
|
box.innerHTML = '<div class="muted">загрузка…</div>';
|
||||||
box.scrollIntoView({ behavior: "smooth", block: "start" });
|
box.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||||
try {
|
try {
|
||||||
const data = await api(`/api/steam/friends/${encodeURIComponent(steamid)}`);
|
const data = await api(`/api/steam/friends/${encodeURIComponent(steamid)}`);
|
||||||
box.innerHTML = `
|
friendsState.cache.set(steamid, data);
|
||||||
<div class="friend-head">
|
friendsState.compare = data;
|
||||||
${data.avatar ? `<img src="${esc(data.avatar)}" alt="" width="56" height="56">` : ""}
|
renderFriendCompare(data);
|
||||||
<div class="friend-title">
|
|
||||||
<h2>${esc(data.name)}</h2>
|
|
||||||
<div class="muted">общих: ${data.common_count} · всего у друга: ${data.total_games} · вне библиотеки: ${data.friend_only_count}</div>
|
|
||||||
</div>
|
|
||||||
<button id="friendClose" class="link" type="button">закрыть</button>
|
|
||||||
</div>
|
|
||||||
<div class="friend-columns">
|
|
||||||
<div class="compare-col"><h3>есть у обоих</h3>${friendGameList(data.common || [], true)}</div>
|
|
||||||
<div class="compare-col"><h3>только у друга</h3>${friendGameList(data.friend_only || [], false)}</div>
|
|
||||||
</div>`;
|
|
||||||
$("#friendClose").addEventListener("click", () => box.classList.add("hidden"));
|
|
||||||
box.querySelectorAll("button[data-appid]").forEach((button) => {
|
|
||||||
button.addEventListener("click", () => openGame(Number(button.dataset.appid)));
|
|
||||||
});
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
box.innerHTML = `<div class="empty">${esc(err.message)}</div>`;
|
box.innerHTML = `<div class="empty">${esc(err.message)}</div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#friendsSearch").addEventListener("input", debounce(() => {
|
||||||
|
friendsState.query = $("#friendsSearch").value;
|
||||||
|
renderFriends();
|
||||||
|
}, 180));
|
||||||
|
$("#friendsStatus").addEventListener("change", () => {
|
||||||
|
friendsState.status = $("#friendsStatus").value;
|
||||||
|
renderFriends();
|
||||||
|
});
|
||||||
|
$("#friendsRefresh").addEventListener("click", () => loadFriends(true));
|
||||||
|
|
||||||
$("#friendCompareBtn").addEventListener("click", () => {
|
$("#friendCompareBtn").addEventListener("click", () => {
|
||||||
const value = $("#friendSteamId").value.trim();
|
const value = $("#friendSteamId").value.trim();
|
||||||
if (!/^\d{17}$/.test(value)) {
|
if (!/^\d{17}$/.test(value)) {
|
||||||
@@ -2211,6 +2361,7 @@ if ("serviceWorker" in navigator) {
|
|||||||
switchView("hltb");
|
switchView("hltb");
|
||||||
} else if (params.get("view") === "friends") {
|
} else if (params.get("view") === "friends") {
|
||||||
switchView("friends");
|
switchView("friends");
|
||||||
|
if (params.get("friend")) openFriendCompare(params.get("friend"));
|
||||||
} else if (params.get("view") === "services") {
|
} else if (params.get("view") === "services") {
|
||||||
switchView("services");
|
switchView("services");
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-5
@@ -407,13 +407,27 @@ try {
|
|||||||
<h1>Друзья</h1>
|
<h1>Друзья</h1>
|
||||||
<div class="muted" id="friendsSummary"></div>
|
<div class="muted" id="friendsSummary"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="friends-manual">
|
<div class="friends-toolbar">
|
||||||
<input id="friendSteamId" type="text" inputmode="numeric" autocomplete="off"
|
<input id="friendsSearch" type="search" placeholder="Поиск друга…" autocomplete="off"
|
||||||
placeholder="SteamID64 друга" aria-label="SteamID64 друга">
|
aria-label="Поиск друга">
|
||||||
<button id="friendCompareBtn" class="ghost" type="button">сравнить</button>
|
<select id="friendsStatus" aria-label="Статус друзей">
|
||||||
|
<option value="">все</option>
|
||||||
|
<option value="online">онлайн</option>
|
||||||
|
<option value="offline">офлайн</option>
|
||||||
|
</select>
|
||||||
|
<button id="friendsRefresh" class="ghost" type="button">обновить</button>
|
||||||
|
<span class="count" id="friendsCount"></span>
|
||||||
</div>
|
</div>
|
||||||
<div id="friendsList" class="friends-list"></div>
|
<details class="friends-manual" id="friendsManual">
|
||||||
|
<summary>сравнить по SteamID64</summary>
|
||||||
|
<div class="friends-manual-row">
|
||||||
|
<input id="friendSteamId" type="text" inputmode="numeric" autocomplete="off"
|
||||||
|
placeholder="7656119..." aria-label="SteamID64 друга">
|
||||||
|
<button id="friendCompareBtn" class="ghost" type="button">сравнить</button>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
<div id="friendCompare" class="friend-compare hidden" aria-live="polite"></div>
|
<div id="friendCompare" class="friend-compare hidden" aria-live="polite"></div>
|
||||||
|
<div id="friendsList" class="friends-list"></div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
+81
-11
@@ -920,15 +920,40 @@ html[data-theme="light"] .game-table tbody tr:hover { background: rgba(23, 32, 5
|
|||||||
.compare-score { margin-left: 6px; font-size: 12px; color: var(--accent-2); }
|
.compare-score { margin-left: 6px; font-size: 12px; color: var(--accent-2); }
|
||||||
.compare-jaccard { margin-bottom: 4px; font-size: 13px; color: var(--text); }
|
.compare-jaccard { margin-bottom: 4px; font-size: 13px; color: var(--text); }
|
||||||
|
|
||||||
.friends-page { display: flex; flex-direction: column; gap: 18px; }
|
.friends-page { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
|
||||||
.friends-manual { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
.friends-toolbar {
|
||||||
.friends-manual input { flex: 1 1 220px; max-width: 320px; }
|
display: flex;
|
||||||
.friends-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.friends-toolbar input { flex: 1 1 220px; max-width: 360px; min-width: 0; }
|
||||||
|
.friends-toolbar select { width: auto; min-width: 120px; }
|
||||||
|
.friends-toolbar .count { margin-left: auto; }
|
||||||
|
.friends-toolbar .ghost, .friends-manual-row .ghost { flex: 0 0 auto; }
|
||||||
|
.friends-manual {
|
||||||
|
padding: 0 12px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 12px;
|
||||||
|
background: var(--panel);
|
||||||
|
}
|
||||||
|
.friends-manual summary { padding: 9px 0; cursor: pointer; font-size: 13px; color: var(--muted); }
|
||||||
|
.friends-manual[open] summary { color: var(--text); }
|
||||||
|
.friends-manual-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 10px; }
|
||||||
|
.friends-manual-row input { flex: 1 1 220px; max-width: 320px; }
|
||||||
|
.friends-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
.friend-card {
|
.friend-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding: 10px;
|
padding: 9px;
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 14px;
|
border-radius: 14px;
|
||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
@@ -936,16 +961,37 @@ html[data-theme="light"] .game-table tbody tr:hover { background: rgba(23, 32, 5
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
transition: .15s;
|
transition: .15s;
|
||||||
}
|
}
|
||||||
.friend-card:hover { border-color: var(--accent); }
|
.friend-card:hover { border-color: var(--accent); background: var(--panel-2); }
|
||||||
.friend-card img, .friend-avatar {
|
.friend-card.active { border-color: var(--accent); background: var(--panel-2); }
|
||||||
width: 48px;
|
.friend-avatar-wrap { position: relative; flex: 0 0 44px; width: 44px; height: 44px; }
|
||||||
height: 48px;
|
.friend-avatar-wrap img, .friend-avatar {
|
||||||
|
display: block;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: var(--bg-2);
|
background: var(--bg-2);
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
.friend-dot {
|
||||||
|
position: absolute;
|
||||||
|
right: -2px;
|
||||||
|
bottom: -2px;
|
||||||
|
width: 11px;
|
||||||
|
height: 11px;
|
||||||
|
border: 2px solid var(--panel);
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #6b7280;
|
||||||
|
}
|
||||||
|
.friend-dot.online { background: #34d399; }
|
||||||
|
.friend-dot.offline { background: #6b7280; }
|
||||||
.friend-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
.friend-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||||
.friend-info b { font-size: 14px; }
|
.friend-info b {
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 14px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.friend-meta { font-size: 12px; color: var(--muted); }
|
||||||
.friend-compare {
|
.friend-compare {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -957,14 +1003,31 @@ html[data-theme="light"] .game-table tbody tr:hover { background: rgba(23, 32, 5
|
|||||||
}
|
}
|
||||||
.friend-compare[hidden] { display: none; }
|
.friend-compare[hidden] { display: none; }
|
||||||
.friend-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
.friend-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
||||||
.friend-head img { width: 56px; height: 56px; border-radius: 12px; background: var(--bg-2); }
|
.friend-head .friend-avatar-wrap { flex-basis: 56px; width: 56px; height: 56px; }
|
||||||
|
.friend-head .friend-avatar-wrap img, .friend-head .friend-avatar {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
.friend-title { flex: 1 1 200px; }
|
.friend-title { flex: 1 1 200px; }
|
||||||
.friend-title h2 { margin: 0 0 2px; font-size: 20px; }
|
.friend-title h2 { margin: 0 0 2px; font-size: 20px; }
|
||||||
|
.friend-profile { font-size: 12px; color: var(--accent-2); }
|
||||||
.friend-head #friendClose { margin-left: auto; }
|
.friend-head #friendClose { margin-left: auto; }
|
||||||
|
.friend-compare-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
||||||
|
.friend-compare-toolbar input { flex: 1 1 220px; max-width: 360px; }
|
||||||
|
.friend-compare-toolbar .count { margin-left: auto; }
|
||||||
.friend-columns { display: flex; flex-wrap: wrap; gap: 18px; }
|
.friend-columns { display: flex; flex-wrap: wrap; gap: 18px; }
|
||||||
.friend-columns .compare-col { flex: 1 1 260px; min-width: 220px; }
|
.friend-columns .compare-col { flex: 1 1 260px; min-width: 220px; }
|
||||||
.friend-columns ul { max-height: 360px; overflow-y: auto; }
|
.friend-columns ul { max-height: 360px; overflow-y: auto; }
|
||||||
.friend-columns li { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
|
.friend-columns li { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
|
||||||
|
.friend-installed {
|
||||||
|
padding: 0 5px;
|
||||||
|
border: 1px solid rgba(94, 234, 212, .3);
|
||||||
|
border-radius: 99px;
|
||||||
|
font-size: 10px;
|
||||||
|
color: var(--accent-2);
|
||||||
|
}
|
||||||
|
.friend-more { align-self: flex-start; margin-top: 6px; }
|
||||||
|
|
||||||
.reco-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
|
.reco-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
|
||||||
.reco-actions[hidden] { display: none; }
|
.reco-actions[hidden] { display: none; }
|
||||||
@@ -1330,6 +1393,13 @@ html[data-theme="light"] ::-webkit-scrollbar-thumb { background: #c9c0ad; }
|
|||||||
.theme-toggle { position: absolute; top: 12px; right: 16px; }
|
.theme-toggle { position: absolute; top: 12px; right: 16px; }
|
||||||
.tabs { gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; }
|
.tabs { gap: 2px; padding: 3px; max-width: 100%; overflow-x: auto; }
|
||||||
.tab { padding: 6px 9px; font-size: 12px; white-space: nowrap; }
|
.tab { padding: 6px 9px; font-size: 12px; white-space: nowrap; }
|
||||||
|
.friends-list { grid-template-columns: 1fr; }
|
||||||
|
.friends-toolbar { display: flex; }
|
||||||
|
.friends-toolbar input { flex: 1 1 100%; max-width: none; }
|
||||||
|
.friends-toolbar select { flex: 1 1 auto; min-width: 0; }
|
||||||
|
.friends-toolbar .ghost { flex: 0 0 auto; }
|
||||||
|
.friends-toolbar .count { flex: 1 1 100%; margin-left: 0; }
|
||||||
|
.friends-manual-row input { max-width: none; }
|
||||||
.stats { width: 100%; justify-content: flex-start; }
|
.stats { width: 100%; justify-content: flex-start; }
|
||||||
main { padding: 18px 16px 60px; }
|
main { padding: 18px 16px 60px; }
|
||||||
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
|
.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
|
||||||
|
|||||||
Reference in new issue
Block a user