PageSourceSearch

https://2026.trondheimdc.no/assets/js/components/session-language.js

js trondheimdc.no collected 2026-10-03 19:55:11 UTC 677 bytes, 18 lines download raw bytes

1// Clones badge markup from the page rather than building it in JS, so
2// components/session-language.njk stays the single source of the markup.
3
4export function sessionLanguageBadge(card) {
5  return card?.querySelector("[data-session-language]")?.cloneNode(true) ?? null;
6}
7
8export function languageBadge(root, code) {
9  if (!code) return null;
10  const template = root?.querySelector("template[data-language-badges]");
11  const badge = template?.content.querySelector(`[data-session-language="${code}"]`);
12  return badge ? badge.cloneNode(true) : null;
13}
14
15export function setLanguageSlot(slot, badge) {
16  if (!slot) return;
17  slot.replaceChildren(...(badge ? [badge] : []));
18}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.