Implement ProgCode identity and real shared reading UI kit
Build and deploy / deploy (push) Successful in 2m39s
Build and deploy / deploy (push) Successful in 2m39s
This commit is contained in:
1 parent
99c848189e
commit
12562baeb5
2040 files changed
+184656
-181
No files matched your search
@@ -0,0 +1,90 @@
|
||||
<!doctype html><html lang="ru"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="data:,"><title>ProgCode — от вызова к механизму / концепция V3</title><script>try{const t=localStorage.getItem("progcode-concept-v3-theme")||"system";document.documentElement.dataset.theme=t==="dark"||(t==="system"&&matchMedia("(prefers-color-scheme:dark)").matches)?"dark":"light"}catch{}</script><style>
|
||||
:root{--bg:#f5f7fa;--surface:#fff;--ink:#142035;--muted:#526179;--line:#c1cad8;--accent:#1648c6;--signal:#e6ff57;--code:#101e36;--oncode:#e8eefb;--soft:#e7edf9;color-scheme:light}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-family:Arial,Helvetica,sans-serif}html[data-theme=dark]{--bg:#111b2c;--surface:#18253a;--ink:#edf2fd;--muted:#b3c0d7;--line:#596b87;--accent:#9dbaff;--soft:#22334e;color-scheme:dark}button,input,textarea{font:inherit}a{color:inherit;text-decoration-thickness:1px;text-underline-offset:4px}button,a,input,textarea,summary{outline-offset:5px}*:focus-visible{outline:3px solid var(--accent)}button{cursor:pointer}header{max-width:1328px;margin:auto;padding:28px 32px 18px;display:flex;align-items:center;gap:32px;border-bottom:2px solid var(--ink)}.brand{display:flex;align-items:center;gap:11px;text-decoration:none;font-size:29px;font-weight:800;letter-spacing:-1.6px}.brand svg{width:42px;height:42px;color:var(--accent)}nav{display:flex;gap:24px;margin-left:auto}nav a{padding:12px 0;text-decoration:none;font-size:15px;font-weight:700}nav a[aria-current=page]{box-shadow:0 3px var(--accent)}.theme{border:1px solid var(--line);background:var(--surface);color:var(--ink);padding:12px}.notice{max-width:1264px;margin:12px auto 0;font:11px/1.6 monospace;color:var(--muted);letter-spacing:.05em}main{max-width:1328px;margin:auto;padding:40px 32px 80px}section[hidden],.entry[hidden]{display:none}.eyebrow,small,.mono{font:12px/1.6 monospace}.eyebrow{text-transform:uppercase;letter-spacing:.12em;color:var(--accent)}h1,h2,h3,p{margin-top:0}h1{font-size:clamp(38px,5.9vw,86px);line-height:1.01;letter-spacing:-.055em;margin-bottom:26px;max-width:1020px;font-weight:800}h2{font-size:32px;line-height:1.12;letter-spacing:-.03em}h3{font-size:25px;line-height:1.2;letter-spacing:-.025em;margin:7px 0 12px}.deck{font-size:21px;line-height:1.55;max-width:650px}.hero{display:grid;grid-template-columns:1.7fr 1fr;gap:56px;padding:14px 0 48px}.mechanism{background:#1648c6;color:white;padding:28px;align-self:start;position:relative;min-height:336px}.mechanism svg{width:100%;height:210px;display:block}.mechanism p{font:13px/1.6 monospace;margin:0;max-width:26ch}.section-head{border-top:2px solid var(--ink);display:flex;align-items:baseline;justify-content:space-between;padding:18px 0}.lead{display:grid;grid-template-columns:120px 1fr 260px;gap:32px;background:var(--soft);padding:32px 28px;border-left:6px solid var(--accent);margin-bottom:42px}.lead .num{font-size:70px;line-height:1;color:var(--accent);font-weight:bold;letter-spacing:-.06em}.lead h2{font-size:38px}.lead p{line-height:1.6}.lead aside{border-left:1px solid var(--line);padding-left:24px}.entry{display:grid;grid-template-columns:64px minmax(0,1fr) 30px;gap:20px;padding:25px 0;border-top:1px solid var(--line);text-decoration:none}.entry:hover h3{text-decoration:underline;color:var(--accent)}.entry h3,.entry p{overflow-wrap:anywhere}.entry-number{font:16px/2 monospace;color:var(--accent)}.entry small{color:var(--muted)}.entry p{color:var(--muted);line-height:1.6;margin-bottom:0;max-width:76ch}.arrow{font-size:20px;color:var(--accent)}.index-layout{display:grid;grid-template-columns:240px 1fr;gap:48px}.index-rail{border-top:2px solid var(--ink);padding-top:18px}.index-rail p{font-size:14px;line-height:1.6;color:var(--muted)}.topics{display:flex;gap:8px;flex-wrap:wrap;margin:18px 0}.topics button{background:var(--surface);color:var(--ink);border:1px solid var(--line);padding:10px 12px}.topics button[aria-pressed=true]{background:var(--accent);color:var(--bg);border-color:var(--accent)}label{display:block;font-size:14px;font-weight:bold;margin-bottom:10px}.searchrow{display:flex;gap:8px;max-width:600px}.searchrow input{width:100%;min-width:0;padding:14px;border:1px solid var(--muted);background:var(--surface);color:var(--ink)}.action{background:var(--accent);color:var(--bg);padding:13px 18px;border:1px solid var(--accent);font-weight:700}.secondary{background:var(--surface);color:var(--ink);border-color:var(--muted)}.result-count{padding:14px 0;color:var(--muted);font:13px/1.6 monospace}.reading-top{max-width:1000px;margin:0 0 42px 228px}.reading-top h1{font-size:clamp(35px,4.4vw,63px);line-height:1.08}.reading-layout{display:grid;grid-template-columns:180px minmax(0,720px);gap:48px}.toc{align-self:start;position:sticky;top:24px;font:13px/1.6 monospace;border-top:3px solid var(--accent);padding-top:16px}.toc a{display:block;padding:10px 0;color:var(--muted)}.prose{font-size:19px;line-height:1.7;min-width:0}.prose p{margin-bottom:1.15em}.prose h2{margin-top:48px;font-size:31px;line-height:1.2;scroll-margin-top:30px}.prose h3{margin-top:32px;font-size:24px}.prose a{color:var(--accent)}.prose pre,.spec pre{max-width:100%;overflow:auto;background:var(--code);color:var(--oncode);padding:24px;font:14px/1.7 monospace;border-left:4px solid #e6ff57}.prose code{font-family:monospace;font-size:.88em}.prose img{max-width:100%;height:auto;backgroundLine truncated
|
||||
.lead{grid-template-columns:minmax(0,1fr) 260px}.related{margin-top:64px}.continuation{display:block;padding:24px 0;border-bottom:1px solid var(--line);text-decoration:none}.continuation span{display:block;font:14px/1.6 monospace;color:var(--muted);margin-bottom:8px}.continuation strong{font-size:24px}.reason{color:var(--accent)!important;font-size:15px}.native-pair{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:16px 0}.native{padding:24px;display:flex;gap:24px;align-items:center}.native span{font:13px/1.5 monospace}.service{max-width:948px}.service h1{font-size:clamp(38px,5vw,70px)}.service>.prose{max-width:720px;margin-left:228px}.missing-code{font:64px monospace;color:var(--accent)}button:disabled{opacity:.6;cursor:not-allowed}@media(max-width:800px){.lead{grid-template-columns:minmax(0,1fr)}.lead aside{grid-column:auto;border-top:1px solid var(--line);padding-top:16px}.lead h2{font-size:28px}#home .entry{display:block}#home .entry-number{display:none}#catalog .entry{display:block}#catalog .entry-number{font-size:11px;display:inline;margin-right:10px}#catalog .arrow,#home .arrow{display:none}#catalog .entry h3{margin-top:8px}.searchrow{display:block}.searchrow input{display:block;width:100%}.searchrow button{margin-top:8px;padding:10px 14px}.mechanism{padding:16px}.mechanism svg,.mechanism p{display:none!important}.mechanism:after{content:none}.mechanism a{margin-top:0!important}.service>.prose{margin-left:0}.native-pair{grid-template-columns:1fr}.native{gap:20px;padding:16px}}
|
||||
.kit-inventory{margin:32px 0 48px;border-top:3px solid var(--accent);padding-top:18px}.kit-inventory summary{font-size:23px;font-weight:700;cursor:pointer}.kit-inventory p{line-height:1.6}.kit-inventory table{border-collapse:collapse;min-width:740px;font-size:14px;line-height:1.6}.kit-inventory th,.kit-inventory td{border:1px solid var(--line);padding:14px;vertical-align:top;text-align:left}.theme,.topics button{border-color:var(--muted)}#missing>p:not(.eyebrow){font-size:19px;line-height:1.6;max-width:60ch}#missing>a{display:inline-block;margin:12px 24px 12px 0;padding:8px 0}</style><a class="skip" href="#main">К содержанию</a><header><a class="brand" href="#home"><svg viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h18l12 12-12 12H8M26 8v24M26 20h12" fill="none" stroke="currentColor" stroke-width="5" stroke-linejoin="miter"/><path d="M33 40h11" stroke="var(--signal)" stroke-width="5"/></svg>progcode<span style="color:var(--accent)">.</span></a><nav aria-label="Разделы"><a href="#home">Журнал</a><a href="#catalog">Все материалы</a><a href="#kit">Мастерская</a></nav><select class="theme" id="theme" aria-label="Цветовая тема"><option value="system">Системная</option><option value="light">Светлая</option><option value="dark">Тёмная</option></select></header><div class="notice">КОНЦЕПЦИЯ V3 · ОТДЕЛЬНЫЙ МАКЕТ · ИСТОРИЧЕСКИЕ МАТЕРИАЛЫ 2017–2019</div><main id="main"><section id="home"><div class="hero"><div><p class="eyebrow">Инженерный журнал / 14 материалов</p><h1>От вызова<br>к механизму.</h1><p class="deck">Механизмы D, прикладной Bitrix и диагностика окружения. Код, источники и ограничения версий в архиве 2017–2019.</p><p class="mono" style="color:var(--muted)">Архив 2017–2019 · версии и контекст — внутри материалов</p></div><div class="mechanism"><p class="mono" style="display:block;margin-bottom:14px">GC / ОТ КОРНЯ К ДОСТИЖИМОМУ ОБЪЕКТУ</p><svg viewBox="0 0 350 210" role="img" aria-label="Упрощённый mark–sweep: от корней достижимы A и B; C не достижим"><g fill="none" stroke="white" stroke-width="2"><path d="M110 65h35m40 0h75"/><rect x="20" y="45" width="90" height="40"/><rect x="145" y="45" width="40" height="40"/><rect x="260" y="45" width="40" height="40"/><rect x="260" y="130" width="40" height="40" stroke-dasharray="5 4"/></g><g font-family="Arial,sans-serif" font-size="16" fill="white"><text x="29" y="71">Корни</text><text x="159" y="71">A</text><text x="274" y="71">B</text><text x="274" y="157">C</text><text x="20" y="116" fill="#e6ff57">MARK → A, B достижимы</text><text x="20" y="196">SWEEP → освободить блок C</text></g></svg><p style="display:block">Упрощённая модель из разбора 2017 года. Финализаторы и ложные указатели усложняют реализацию.</p><a href="#article" data-open="7" style="display:inline-block;margin-top:14px">Как устроен сбор →</a></div></div><div class="section-head"><h2>Разобрать механизм</h2><span class="mono">В ФОКУСЕ / ПАМЯТЬ</span></div><div class="lead"><div><p class="eyebrow">D / Память · 24.06.2017</p><h2><a href="#article" data-open="7">DConf-2017. Под капотом мусорщика D</a></h2><p>Доклад Дмитрия Ольшанского: страницы памяти, малые объекты и выбор архитектуры сборщика.</p></div><aside><span class="mono">ВНУТРИ РАЗБОРА</span><p>От выделения блока до поиска ссылок. Полный перевод с поясняющими схемами.</p><a href="#article" data-open="7">Открыть материал →</a></aside></div><div class="section-head"><h2>Продолжить разбор</h2><span class="mono">D / СРЕДА / ПРАКТИКА</span></div><a class="entry" href="#article" data-open="9"><span class="entry-number">10</span><div><small>D · 26.05.2017</small><h3>Dlang. Новый движок CTFE</h3><p class="reason">Другой этап исполнения: как представление программы влияет на CTFE.</p><p>Почему выполнение CTFE через AST могло расходовать много памяти и как NewCTFE предлагал отделить программу в компактный байт-код.</p></div><span class="arrow">↗</span></a><a class="entry" href="#article" data-open="10"><span class="entry-number">11</span><div><small>D · 23.05.2017</small><h3>Особенности Vibe.d</h3><p class="reason">От памяти к ожиданию:Line truncated
|
||||
# либо
|
||||
yarn add jquery</code></pre><p class="mono">Код прокручивается внутри блока. Tab → стрелки.</p></div><div class="spec"><h2>Таблица / CTFE / 26.05.2017</h2><p><a href="#article" data-open="9">Dlang. Новый движок CTFE</a></p><div class="prose scroll" tabindex="0" aria-label="Таблица CTFE"><table><thead><tr><th>Вопрос</th><th>Выполнение AST</th><th>Отдельный байт-код</th></tr></thead><tbody><tr><td>Представление программы</td><td>Структуры синтаксического дерева компилятора</td><td>Инструкции для специализированной виртуальной машины</td></tr><tr><td>Цена подготовки</td><td>Можно использовать существующее дерево</td><td>Нужен дополнительный этап генерации инструкций</td></tr><tr><td>Временные значения</td><td>Зависят от устройства узлов и интерпретатора</td><td>Можно спроектировать отдельное компактное хранение</td></tr><tr><td>Главная сложность</td><td>Не сделать обход и создание узлов слишком дорогими</td><td>Сохранить семантику всех поддерживаемых конструкций</td></tr></tbody></table></div></div><div class="spec"><h2>Схема / GC / 24.06.2017</h2><p><a href="#article" data-open="7">DConf-2017. Под капотом мусорщика D (Дмитрий Ольшанский)</a></p><div class="prose"><figure><img src="visuals/v2/d-gc-pools.svg" alt="Малый пул использует страницы с классами размеров; крупный объект занимает последовательность страниц" width="640" height="1250" loading="lazy" decoding="async" /><figcaption>Модель пулов из разбора 2017 года: округление малого объекта и размещение большого объекта по страницам.</figcaption></figure></div></div><div class="spec"><h2>Полный D-модуль / 17.06.2017</h2><p><a href="#article" data-open="8">Пишем аналог функции PHP preg_match_all на языке программирования D</a></p><p>«Пишем аналог функции PHP preg_match_all на языке программирования D»</p><details><summary>Открыть полный исходник и unittest</summary><pre tabindex="0" aria-label="Пример кода, прокрутка клавишами со стрелками"><code>module preg;
|
||||
|
||||
import std.regex : matchAll, regex, ctRegex;
|
||||
|
||||
struct Capture {
|
||||
string text;
|
||||
long position; // byte offset, -1 when an optional group did not participate
|
||||
}
|
||||
|
||||
class PReg {
|
||||
static string[][] matchAllPatternOrder(R)(string subject, R re, out size_t count) {
|
||||
string[][] result;
|
||||
count = 0;
|
||||
foreach (hit; matchAll(subject, re)) {
|
||||
if (result.length == 0) result.length = hit.length;
|
||||
foreach (i; 0 .. hit.length) result[i] ~= hit[i];
|
||||
++count;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static string[][] matchAllSetOrder(R)(string subject, R re, out size_t count) {
|
||||
string[][] result;
|
||||
count = 0;
|
||||
foreach (hit; matchAll(subject, re)) {
|
||||
string[] row;
|
||||
foreach (i; 0 .. hit.length) row ~= hit[i];
|
||||
result ~= row;
|
||||
++count;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static Capture[][] matchAllOffsetCapture(R)(string subject, R re, out size_t count) {
|
||||
Capture[][] result;
|
||||
count = 0;
|
||||
foreach (hit; matchAll(subject, re)) {
|
||||
if (result.length == 0) result.length = hit.length;
|
||||
foreach (i; 0 .. hit.length) {
|
||||
auto part = hit[i];
|
||||
long position = part.ptr is null
|
||||
? -1
|
||||
: cast(long)(part.ptr - subject.ptr);
|
||||
result[i] ~= Capture(part, position);
|
||||
}
|
||||
++count;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
unittest {
|
||||
size_t count;
|
||||
auto pattern = regex(`(\w)(\w)\w+`);
|
||||
|
||||
auto byGroup = PReg.matchAllPatternOrder("one two", pattern, count);
|
||||
assert(count == 2);
|
||||
assert(byGroup == [["one", "two"], ["o", "t"], ["n", "w"]]);
|
||||
|
||||
auto byMatch = PReg.matchAllSetOrder("one two", pattern, count);
|
||||
assert(count == 2);
|
||||
assert(byMatch == [["one", "o", "n"], ["two", "t", "w"]]);
|
||||
|
||||
auto offsets = PReg.matchAllOffsetCapture("one two", ctRegex!(`(\w)(\w)\w+`), count);
|
||||
assert(count == 2);
|
||||
assert(offsets[0][0] == Capture("one", 0));
|
||||
assert(offsets[0][1] == Capture("two", 4));
|
||||
assert(offsets[1][1] == Capture("t", 4));
|
||||
assert(offsets[2][1] == Capture("w", 5));
|
||||
|
||||
assert(PReg.matchAllPatternOrder("---", pattern, count).length == 0);
|
||||
assert(count == 0);
|
||||
assert(PReg.matchAllSetOrder("", pattern, count).length == 0);
|
||||
assert(count == 0);
|
||||
assert(PReg.matchAllOffsetCapture("---", pattern, count).length == 0);
|
||||
assert(count == 0);
|
||||
|
||||
auto moreGroups = PReg.matchAllPatternOrder("abc def", regex(`(\w)(\w)(\w)`), count);
|
||||
assert(moreGroups == [["abc", "def"], ["a", "d"], ["b", "e"], ["c", "f"]]);
|
||||
|
||||
auto unicodeOffsets = PReg.matchAllOffsetCapture("я x", regex(`x`), count);
|
||||
assert(count == 1);
|
||||
assert(unicodeOffsets[0][0].position == 3); // UTF-8 bytes, not character index
|
||||
}</code></pre></details></div><div class="spec"><h2>Bitrix FileInput / 19.10.2018</h2><p><a href="#article" data-open="1">Bitrix API. Вставка на страницу встроенного редактора картинок</a></p><div class="prose"><figure><img src="visuals/v2/bitrix-file-preview.jpg" alt="Поле изображения Bitrix с превью, кнопками выбора файла и редактирования" width="435" height="280" loading="lazy" decoding="async" /><figcaption>Элемент выбора изображения в форме Bitrix: превью и кнопки управления.</figcaption></figure></div></div><div class="spec" style="grid-column:1/-1"><h2>Два маршрута знака / реальные 16, 32, 48 px</h2><p>A: P с направлением. B: P с выходом по ортогональной трассе — без треугольника play. Оба — отдельные эскизы, не production assets.</p><div class="native-pair"><div class="native" style="background:#f5f7fa;color:#1648c6"><span>A / Светлая</span><svg width="16" height="16" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h18v24H8M26 8l12 12-12 12" fill="none" stroke="currentColor" stroke-width="5"/><path d="M33 40h11" stroke="#b2cb1f" stroke-width="5"/></svg><svg width="32" height="32" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h18v24H8M26 8l12 12-12 12" fill="none" stroke="currentColor" stroke-width="5"/><path d="M33 40h11" stroke="#b2cb1f" stroke-width="5"/></svg><svg width="48" height="48" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h18v24H8M26 8l12 12-12 12" fill="none" stroke="currentColor" stroke-width="5"/><path d="M33 40h11" stroke="#b2cb1f" stroke-width="5"/></svg></div><div class="native" style="background:#111b2c;color:#9dbaff"><span>A / Тёмная</span><svg width="16" height="16" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h18v24H8M26 8l12 12-12 12" fill="none" stroke="currentColor" stroke-width="5"/><path d="M33 40h11" stroke="#b2cb1f" stroke-width="5"/></svg><svg width="32" height="32" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h18v24H8M26 8l12 12-12 12" fill="none" stroke="currentColor" stroke-width="5"/><path d="M33 40h11" stroke="#b2cb1f" stroke-width="5"/></svg><svg width="48" height="48" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h18v24H8M26 8l12 12-12 12" fill="none" stroke="currentColor" stroke-width="5"/><path d="M33 40h11" stroke="#b2cb1f" stroke-width="5"/></svg></div></div><div class="native-pair"><div class="native" style="background:#f5f7fa;color:#1648c6"><span>B / Светлая</span><svg width="16" height="16" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h24v20H8M20 28v12h20" fill="none" stroke="currentColor" stroke-width="5"/><rect x="29" y="5" width="8" height="8" fill="currentColor"/><rect x="36" y="36" width="8" height="8" fill="currentColor"/></svg><svg width="32" height="32" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h24v20H8M20 28v12h20" fill="none" stroke="currentColor" stroke-width="5"/><rect x="29" y="5" width="8" height="8" fill="currentColor"/><rect x="36" y="36" width="8" height="8" fill="currentColor"/></svg><svg width="48" height="48" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h24v20H8M20 28v12h20" fill="none" stroke="currentColor" stroke-width="5"/><rect x="29" y="5" width="8" height="8" fill="currentColor"/><rect x="36" y="36" width="8" height="8" fill="currentColor"/></svg></div><div class="native" style="background:#111b2c;color:#9dbaff"><span>B / Тёмная</span><svg width="16" height="16" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h24v20H8M20 28v12h20" fill="none" stroke="currentColor" stroke-width="5"/><rect x="29" y="5" width="8" height="8" fill="currentColor"/><rect x="36" y="36" width="8" height="8" fill="currentColor"/></svg><svg width="32" height="32" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h24v20H8M20 28v12h20" fill="none" stroke="currentColor" stroke-width="5"/><rect x="29" y="5" width="8" height="8" fill="currentColor"/><rect x="36" y="36" width="8" height="8" fill="currentColor"/></svg><svg width="48" height="48" viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h24v20H8M20 28v12h20" fill="none" stroke="currentColor" stroke-width="5"/><rect x="29" y="5" width="8" height="8" fill="currentColor"/><rect x="36" y="36" width="8" height="8" fill="currentColor"/></svg></div></div></div><div class="spec"><h2>Знак и сигналы</h2><div class="identityspec"><svg viewBox="0 0 48 48" aria-hidden="true"><path d="M8 40V8h18l12 12-12 12H8M26 8v24M26 20h12" fill="none" stroke="currentColor" stroke-width="5" stroke-linejoin="miter"/><path d="M33 40h11" stroke="var(--signal)" stroke-width="5"/></svg><span style="font-size:25px;font-weight:800">progcode.</span></div><p class="mono">Новый векторный эскиз / не текущий favicon</p><divLine truncated
|
||||
let selected=7,topic='';const qs=s=>document.querySelector(s);function article(i){selected=i;const a=articles[i];qs('#article-title').textContent=a.title;qs('#article-meta').textContent=a.categories.join(' / ')+' · '+a.date.slice(0,10).split('-').reverse().join('.');qs('#article-excerpt').textContent=a.excerpt;qs('#author').textContent='Публикация: '+a.author+' · Историческая публикация';qs('#body').innerHTML=a.contentHtml.replaceAll('/assets/','/web/public/assets/');qs('#body').querySelectorAll('pre').forEach(p=>{p.tabIndex=0;p.setAttribute('aria-label','Код с горизонтальной прокруткой')});const reasons={7:[[9,'От памяти к представлению программы: другой этап исполнения.'],[10,'От памяти к ожиданию: волокна в одном потоке.'],[2,'Как автор Tilix применяет D и оценивает управление памятью.']],9:[[7,'Другой компромисс runtime: устройство сборщика памяти.']],10:[[7,'Как runtime возвращает память после работы объектов.']],2:[[7,'Подробнее о сборщике памяти D той же эпохи.']],1:[[3,'Другой вызов Bitrix API: сформировать код элемента.'],[4,'Связать элементы каталога и предложение.']],3:[[1,'От значения поля к интерфейсу Bitrix FileInput.']],4:[[3,'Подготовить символьный код элемента каталога.']]};qs('#related').innerHTML='<div class="section-head"><h2>Продолжить чтение</h2></div>'+((reasons[i]||[]).map(([j,why])=>'<a class="continuation" href="#article" data-open="'+j+'"><span>'+why+'</span><strong>'+articles[j].title+' →</strong></a>').join('')||'<a href="#catalog">Выбрать вопрос в указателе материалов →</a>');qs('#toc-links').innerHTML=[...qs('#body').querySelectorAll('h2')].map(h=>'<a href="#'+h.id+'" data-anchor="'+h.id+'">'+h.textContent+'</a>').join('');}function route(){let hash=location.hash.slice(1)||'home';if(!['home','catalog','article','kit','privacy','sources','accessibility','missing'].includes(hash))return;document.querySelectorAll('main>section').forEach(s=>s.hidden=s.id!==hash);document.querySelectorAll('nav a').forEach(a=>{if(a.hash==='#'+hash)a.setAttribute('aria-current','page');else a.removeAttribute('aria-current')});window.scrollTo(0,0)}document.addEventListener('click',e=>{const open=e.target.closest('[data-open]');if(open){article(+open.dataset.open);if(location.hash==='#article')window.scrollTo(0,0)}const anchor=e.target.closest('[data-anchor]');if(anchor){e.preventDefault();document.getElementById(anchor.dataset.anchor).scrollIntoView();}});window.addEventListener('hashchange',route);const media=matchMedia('(prefers-color-scheme:dark)');function applyTheme(){const t=qs('#theme').value;document.documentElement.dataset.theme=t==='dark'||(t==='system'&&media.matches)?'dark':'light'}try{qs('#theme').value=localStorage.getItem('progcode-concept-v3-theme')||'system'}catch{}qs('#theme').onchange=()=>{try{localStorage.setItem('progcode-concept-v3-theme',qs('#theme').value)}catch{}applyTheme()};media.addEventListener('change',applyTheme);applyTheme();function filter(){let q=qs('#query').value.toLowerCase();let rows=[...qs('#results').children];let n=0;rows.forEach((r,i)=>{let match=(!q||(articles[i].title+' '+articles[i].excerpt).toLowerCase().includes(q))&&(!topic||articles[i].categories.includes(topic));r.hidden=!match;if(match)n++});qs('#count').textContent='Найдено: '+n+(!n?' · Попробуйте другой запрос или сбросьте фильтры.':'')}qs('#query').oninput=filter;qs('#reset').onclick=()=>{topic='';qs('#query').value='';document.querySelectorAll('[data-topic]').forEach(b=>b.setAttribute('aria-pressed',!b.dataset.topic));filter();qs('#query').focus()};document.querySelectorAll('[data-topic]').forEach(b=>b.onclick=()=>{topic=b.dataset.topic;document.querySelectorAll('[data-topic]').forEach(c=>c.setAttribute('aria-pressed',c===b));filter()});qs('#copy').onclick=async()=>{try{await navigator.clipboard.writeText(qs('#json').value);qs('#jsonstate').className='state success';qs('#jsonstate').textContent='Скопировано.'}catch{qs('#jsonstate').className='state error';qs('#jsonstate').textContent='Браузер не разрешил копирование. Выделите текст и скопируйте вручную.'}};qs('#json').addEventListener('input',()=>{qs('#format').disabled=!qs('#json').value.trim()});qs('#format').onclick=()=>{try{qs('#json').value=JSON.stringify(JSON.parse(qs('#json').value),null,2);qs('#jsonstate').className='state success';qs('#jsonstate').textContent='JSON корректен. Отформатировано.'}catch(e){qs('#jsonstatLine truncated
|
||||
Reference in new issue
Block a user