GET /coworkers отдаёт партнёров по фильмам (актёры, режиссёры, композиторы) с числом совместных работ. Страница /person.html показывает фильмографию и партнёров со ссылками. В графе при клике на персону — ссылка на профиль. Проверено: Zendaya → Denis Villeneuve, Hans Zimmer, Javier Bardem (по Dune: Part Two).
92 lines
3.9 KiB
HTML
92 lines
3.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ru">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Персона — Buryans Hub</title>
|
|
<style>
|
|
:root { --bg:#0d1117; --fg:#c9d1d9; --dim:#8b949e; --line:#30363d; --acc:#58a6ff; }
|
|
* { box-sizing: border-box; }
|
|
body { margin:0; background:var(--bg); color:var(--fg);
|
|
font:15px/1.6 -apple-system,"Segoe UI",Roboto,sans-serif; }
|
|
.wrap { max-width:900px; margin:0 auto; padding:28px 20px 60px; }
|
|
h1 { font-size:22px; margin:0 0 4px; }
|
|
.sub { color:var(--dim); font-size:13px; margin-bottom:20px; }
|
|
form { display:flex; gap:8px; margin-bottom:22px; }
|
|
input { flex:1; background:#161b22; border:1px solid var(--line); color:var(--fg);
|
|
border-radius:8px; padding:10px 12px; outline:none; }
|
|
input:focus { border-color:var(--acc); }
|
|
button { background:var(--acc); color:#0d1117; border:0; border-radius:8px;
|
|
padding:10px 16px; font-weight:600; cursor:pointer; }
|
|
.grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
|
|
.card { background:#161b22; border:1px solid var(--line); border-radius:10px; padding:14px 16px; }
|
|
.card h3 { margin:0 0 10px; font-size:13px; color:var(--dim); font-weight:600;
|
|
text-transform:uppercase; letter-spacing:.04em; }
|
|
ul { margin:0; padding-left:18px; }
|
|
li { margin:4px 0; }
|
|
.muted { color:var(--dim); font-size:13px; }
|
|
a { color:var(--acc); text-decoration:none; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="wrap">
|
|
<h1 id="title">Персона</h1>
|
|
<div class="sub" id="sub"></div>
|
|
<form id="f">
|
|
<input id="q" placeholder="Имя: Zendaya, Nolan, Hans Zimmer" autofocus>
|
|
<button>Показать</button>
|
|
</form>
|
|
<div class="grid">
|
|
<div class="card"><h3>Фильмография</h3><ul id="films"><li class="muted">—</li></ul></div>
|
|
<div class="card"><h3>Вместе снимались</h3><ul id="partners"><li class="muted">—</li></ul></div>
|
|
</div>
|
|
<p class="muted" style="margin-top:22px">
|
|
<a href="graph.html">граф</a> · <a href="ask.html">спросить агента</a> · <a href="./">панель</a>
|
|
</p>
|
|
</div>
|
|
<script>
|
|
const params = new URLSearchParams(location.search);
|
|
const name = params.get("name") || "";
|
|
const $ = id => document.getElementById(id);
|
|
|
|
document.getElementById("f").addEventListener("submit", e => {
|
|
e.preventDefault();
|
|
const q = $("q").value.trim();
|
|
if (q) location.search = "?name=" + encodeURIComponent(q);
|
|
});
|
|
|
|
async function load(person){
|
|
$("title").textContent = person;
|
|
$("q").value = person;
|
|
$("films").innerHTML = '<li class="muted">загрузка…</li>';
|
|
$("partners").innerHTML = '<li class="muted">загрузка…</li>';
|
|
try {
|
|
const [p, c] = await Promise.all([
|
|
fetch("person?q=" + encodeURIComponent(person)).then(r => r.json()),
|
|
fetch("coworkers?q=" + encodeURIComponent(person)).then(r => r.json())
|
|
]);
|
|
if (p.error) throw new Error(p.error);
|
|
const films = (p.films || []);
|
|
$("sub").textContent = (p.person ? p.person.kind : "") + " · фильмов: " + films.length;
|
|
$("films").innerHTML = films.length
|
|
? films.map(f => "<li>" + esc(f.title) + "</li>").join("")
|
|
: '<li class="muted">ничего не найдено</li>';
|
|
const partners = (c.partners || []);
|
|
$("partners").innerHTML = partners.length
|
|
? partners.map(x => "<li><a href='?name=" + encodeURIComponent(x.title) + "'>" +
|
|
esc(x.title) + "</a> — " + x.together + " <span class='muted'>" +
|
|
esc((x.films || "").slice(0, 60)) + "</span></li>").join("")
|
|
: '<li class="muted">нет общих фильмов</li>';
|
|
} catch (e) {
|
|
$("sub").textContent = "не найдено";
|
|
$("films").innerHTML = '<li class="muted">' + esc(String(e)) + "</li>";
|
|
$("partners").innerHTML = '<li class="muted">—</li>';
|
|
}
|
|
}
|
|
function esc(s){ return String(s).replace(/[&<>]/g, c => ({"&":"&","<":"<",">":">"}[c])); }
|
|
|
|
if (name) load(name);
|
|
</script>
|
|
</body>
|
|
</html>
|