GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / globalgrid2050 / testcode/202609051152/pipeline/scripts/plugins

Newspaper V9 2 and 5 more files

A JavaScript module in the plugins folder of GlobalGrid2050 that refreshes projects, draws news v9 and fetches payload, covering battery storage (BESS) and solar.

650 lines of JavaScript from globalgrid2050, in 6 files. Topic: Electricity markets and data pipelines. Section 903 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Gauges V9 1 render · globalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/gauges-v9-1.js lines 1–37
  2. Gauges V9 2 render · globalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/gauges-v9-2.js lines 1–68
  3. Gauges render · globalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/gauges.js lines 1–63
  4. Newspaper V9 2 render · globalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-2.js lines 1–168
  5. Newspaper V9 5 1 render · globalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-5-1.js lines 1–163
  6. Newspaper V9 5 render · globalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-5.js lines 1–151

Gauges V9 1

A JavaScript module in the plugins folder of GlobalGrid2050 that updates chart (`updateChart`) and sets gauge universe v9 (`setGaugeUniverseV9_1`) (units: MW).

renderglobalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/gauges-v9-1.js · lines 1–37 of 37 · version 2026-09-05 11:52 · Not reached from any entry point (candidate for review) · pattern setGaugeUniverse (shared by 5 files)

What it does
Defines createGauge, updateChart, initialiseGaugesV9_1, setGaugeUniverseV9_1, updateGaugesV9_1. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
Used directly by 2 files: Projects V9 1 (globalgrid2050); Projects V9 1 (globalgrid2050).
What it achieves
It creates gauge (`createGauge`), updates chart (`updateChart`) and sets gauge universe v9 (`setGaugeUniverseV9_1`). Defines `createGauge`, `updateChart`, `initialiseGaugesV9_1` and 2 more.
Why it matters
Imported by Projects V9 1.
Application
globalgrid2050 · testcode/202609051152/pipeline/scripts/plugins · JavaScript module
Uses
none found
Used by
imported by Projects V9 1 (import), imported by Projects V9 1 (import), mentioned in Standalone (comment link)
Produces
initialiseGaugesV9_1, setGaugeUniverseV9_1, updateGaugesV9_1
Defines here
createGauge, updateChart, initialiseGaugesV9_1, setGaugeUniverseV9_1, updateGaugesV9_1
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051152/pipeline/scripts/plugins/gauges-v9-1.js:1-37 · blob 72baa0883a5182b4f62a764b7619b280815336e1 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: unreached_review
const charts = { capacity: null, projects: null, largest: null };
let universe = [];

function createGauge(canvasId, colour, options) {
  const config = { type: "doughnut", data: { datasets: [{ data: [0, 1], backgroundColor: [colour, "#222"], borderWidth: 0 }] }, options };
  if (typeof globalThis.Chart !== "function") return { data: config.data, update() {} };
  return new globalThis.Chart(document.getElementById(canvasId), config);
}

function updateChart(chart, value, maximum) {
  chart.data.datasets[0].data = [value, Math.max(maximum - value, 0)];
  chart.update();
}

export function initialiseGaugesV9_1() {
  const options = { responsive: true, maintainAspectRatio: false, circumference: 180, rotation: 270, cutout: "80%", plugins: { tooltip: { enabled: false }, legend: { display: false } } };
  charts.capacity = createGauge("g1", "#ff00ff", options);
  charts.projects = createGauge("g2", "#00ffff", options);
  charts.largest = createGauge("g3", "#00ff88", options);
}

export function setGaugeUniverseV9_1(projects) {
  universe = projects;
}

export function updateGaugesV9_1(projects) {
  const total = projects.reduce((sum, project) => sum + project.capacity_mw, 0);
  const largest = projects.length ? Math.max(...projects.map((project) => project.capacity_mw)) : 0;
  const universeTotal = universe.reduce((sum, project) => sum + project.capacity_mw, 0) || 1;
  const universeLargest = universe.length ? Math.max(...universe.map((project) => project.capacity_mw)) : 1;
  document.getElementById("v1").textContent = total.toLocaleString("en-GB", { maximumFractionDigits: 0 });
  document.getElementById("v2").textContent = projects.length.toLocaleString("en-GB");
  document.getElementById("v3").textContent = largest.toLocaleString("en-GB", { maximumFractionDigits: 1 });
  updateChart(charts.capacity, total, universeTotal);
  updateChart(charts.projects, projects.length, universe.length || 1);
  updateChart(charts.largest, largest, universeLargest);
}

Gauges V9 2

A JavaScript module in the plugins folder of GlobalGrid2050 that updates chart (`updateChart`) and formats capacity v9 (`formatCapacityV9_2`) and largest v9 (`formatLargestV9_2`) (units: MW).

Set aside from the main view: 91% of its lines are the same as uk_renewables_pipeline/202611191418/scripts/plugins/gauges-v9-2.js (globalgrid2050), which stays. (near-copy-of, proposed by families.py). 90% of lines shared with Gauges V9 2; read that one first. All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line-jaccard 0.9057 to globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611191418/scripts/plugins/gauges-v9-2.js:1-71 1c8a158a98621eded5caf81714fd96f9221514fa
  • sha256 30803e3ecc787175bc31b6913541d52cc6065e9be2b50dc4d3ed900797348682
  • target sha256 a7b4b98df0b36b98057233df2607506592c074c47c18f1dba309dba9329b040d
  • group of 2 (identity.json near-copy edges >= 0.9)
  • canonical rule: reachable, newest stamp, core repo, most lines

renderglobalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/gauges-v9-2.js · lines 1–68 of 68 · version 2026-09-05 11:52 · pattern formatLargest (shared by 4 files)

What it does
Defines 7 functions or classes, including createGauge, updateChart, formatCapacityV9_2, formatLargestV9_2, initialiseGaugesV9_2. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
Used directly by 29 files: App V9 3 (globalgrid2050); App V9 4 (globalgrid2050); App V9 5 1 (globalgrid2050); App V9 5 (globalgrid2050); and 25 more. Reached from 190 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — PipelineNews Intelligence Page (globalgrid2050, https://globalgrid2050.com/pipelinenews_intelligence/202609050309/).
What it achieves
It creates gauge (`createGauge`), updates chart (`updateChart`) and formats capacity v9 (`formatCapacityV9_2`). Defines `createGauge`, `updateChart`, `formatCapacityV9_2` and 4 more.
Why it matters
Imported by 29 files, including App V9 3, App V9 4 and App V9 5 1, from PipelineNews.
Application
globalgrid2050 · testcode/202609051152/pipeline/scripts/plugins · JavaScript module
Uses
none found
Used by
imported by App V9 3 (import), imported by App V9 4 (import), imported by App V9 5 1 (import), imported by App V9 5 (import), imported by App V9 6 2 (import), imported by App V9 7 (import), imported by Testcode — Pipeline (import), imported by Projects V9 2 (import), and 21 more, mentioned in Standalone (comment link)
Produces
formatCapacityV9_2, formatLargestV9_2, initialiseGaugesV9_2, setGaugeUniverseV9_2, updateGaugesV9_2
Defines here
createGauge, updateChart, formatCapacityV9_2, formatLargestV9_2, initialiseGaugesV9_2, setGaugeUniverseV9_2, updateGaugesV9_2
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051152/pipeline/scripts/plugins/gauges-v9-2.js:1-68 · blob 1d081d2d9e1630912b912953cf18f431754f9e19 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
const charts = { capacity: null, projects: null, largest: null };
let universe = [];

function createGauge(canvasId, colour, options) {
  const config = {
    type: "doughnut",
    data: { datasets: [{ data: [0, 1], backgroundColor: [colour, "#222"], borderWidth: 0 }] },
    options,
  };
  if (typeof globalThis.Chart !== "function") return { data: config.data, update() {} };
  return new globalThis.Chart(document.getElementById(canvasId), config);
}

function updateChart(chart, value, maximum) {
  chart.data.datasets[0].data = [value, Math.max(maximum - value, 0)];
  chart.update();
}

export function formatCapacityV9_2(value) {
  const rounded = Math.round(((Number(value) || 0) + Number.EPSILON) * 100) / 100;
  return rounded.toLocaleString("en-GB", {
    minimumFractionDigits: 0,
    maximumFractionDigits: 2,
  });
}

export function formatLargestV9_2(value) {
  return (Number(value) || 0).toLocaleString("en-GB", { maximumFractionDigits: 2 });
}

export function initialiseGaugesV9_2() {
  const options = {
    responsive: true,
    maintainAspectRatio: false,
    circumference: 180,
    rotation: 270,
    cutout: "80%",
    plugins: { tooltip: { enabled: false }, legend: { display: false } },
  };
  charts.capacity = createGauge("g1", "#ff00ff", options);
  charts.projects = createGauge("g2", "#00ffff", options);
  charts.largest = createGauge("g3", "#00ff88", options);
}

export function setGaugeUniverseV9_2(projects) {
  universe = projects;
}

export function updateGaugesV9_2(projects) {
  const total = projects.reduce((sum, project) => sum + project.capacity_mw, 0);
  const largest = projects.length ? Math.max(...projects.map((project) => project.capacity_mw)) : 0;
  const universeTotal = universe.reduce((sum, project) => sum + project.capacity_mw, 0) || 1;
  const universeLargest = universe.length ? Math.max(...universe.map((project) => project.capacity_mw)) : 1;

  const capacityValue = document.getElementById("v1");
  const projectValue = document.getElementById("v2");
  const largestValue = document.getElementById("v3");
  capacityValue.textContent = formatCapacityV9_2(total);
  projectValue.textContent = projects.length.toLocaleString("en-GB");
  largestValue.textContent = formatLargestV9_2(largest);
  capacityValue.setAttribute("aria-label", `${formatCapacityV9_2(total)} megawatts filtered capacity`);
  projectValue.setAttribute("aria-label", `${projects.length.toLocaleString("en-GB")} filtered records`);
  largestValue.setAttribute("aria-label", `${formatLargestV9_2(largest)} megawatts largest single site`);

  updateChart(charts.capacity, total, universeTotal);
  updateChart(charts.projects, projects.length, universe.length || 1);
  updateChart(charts.largest, largest, universeLargest);
}

Gauges

A JavaScript module in the plugins folder of GlobalGrid2050 that updates chart (`updateChart`) (units: MW), covering solar and battery storage (BESS). It creates gauge (`createGauge`) and updates chart (`updateChart`).

renderglobalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/gauges.js · lines 1–63 of 63 · version 2026-09-05 11:52 · pattern initialiseGauges (shared by 7 files)

What it does
It lists and searches solar and battery storage (BESS). Defines createGauge, initialiseGauges, totalFor, updateChart, updateGauges. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: solar, battery storage (BESS).
Downstream impact
Used directly by 4 files: Project Filters (globalgrid2050); Projects (globalgrid2050); UK Renewables Pipeline — V8 (globalgrid2050); Projects (globalgrid2050). Reached from 188 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — PipelineNews Intelligence Page (globalgrid2050, https://globalgrid2050.com/pipelinenews_intelligence/202609050309/).
What it achieves
Defines `createGauge`, `initialiseGauges`, `totalFor` and 2 more.
Why it matters
Imported by 4 files, including Project Filters, Projects and UK Renewables Pipeline — V8.
Application
globalgrid2050 · testcode/202609051152/pipeline/scripts/plugins · JavaScript module
Uses
State (import)
Used by
imported by Project Filters (import), imported by Projects (import), imported by UK Renewables Pipeline — V8 (import), imported by Projects (import), mentioned in Standalone (comment link)
Produces
initialiseGauges, updateGauges
Defines here
createGauge, initialiseGauges, totalFor, updateChart, updateGauges
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051152/pipeline/scripts/plugins/gauges.js:1-63 · blob cdf1e0d9254aee0af46627238082b1141b9b28a9 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
import { state } from "../core/state.js";

function createGauge(canvasId, colour, options) {
  const config = {
    type: "doughnut",
    data: { datasets: [{ data: [0, 1], backgroundColor: [colour, "#222"], borderWidth: 0 }] },
    options,
  };
  if (typeof globalThis.Chart !== "function") {
    document.getElementById(canvasId).hidden = true;
    return { data: config.data, update() {} };
  }
  return new globalThis.Chart(document.getElementById(canvasId), config);
}

export function initialiseGauges() {
  const options = {
    responsive: true,
    maintainAspectRatio: false,
    circumference: 180,
    rotation: 270,
    cutout: "80%",
    plugins: { tooltip: { enabled: false }, legend: { display: false } },
  };

  state.charts.solar = createGauge("g1", "#ffff00", options);
  state.charts.bess = createGauge("g2", "#ffae00", options);
  state.charts.projects = createGauge("g3", "#00ffff", options);
  state.charts.largest = createGauge("g4", "#00ff88", options);
}

function totalFor(projects, technology) {
  return projects
    .filter((project) => project.technology === technology)
    .reduce((sum, project) => sum + project.capacity_mw, 0);
}

function updateChart(chart, value, maximum) {
  chart.data.datasets[0].data = [value, Math.max(maximum - value, 0)];
  chart.update();
}

export function updateGauges(projects) {
  const solarMwp = totalFor(projects, "solar");
  const bessMw = totalFor(projects, "bess");
  const projectCount = projects.length;
  const largestMw = projects.length ? Math.max(...projects.map((project) => project.capacity_mw)) : 0;
  const allSolarMwp = totalFor(state.all, "solar") || 1;
  const allBessMw = totalFor(state.all, "bess") || 1;
  const allProjectCount = state.all.length || 1;
  const allLargestMw = state.all.length ? Math.max(...state.all.map((project) => project.capacity_mw)) : 1;
  const capacityFormat = { maximumFractionDigits: 2 };

  document.getElementById("v1").textContent = solarMwp.toLocaleString("en-GB", capacityFormat);
  document.getElementById("v2").textContent = bessMw.toLocaleString("en-GB", capacityFormat);
  document.getElementById("v3").textContent = projectCount.toLocaleString("en-GB");
  document.getElementById("v4").textContent = largestMw.toLocaleString("en-GB", capacityFormat);

  updateChart(state.charts.solar, solarMwp, allSolarMwp);
  updateChart(state.charts.bess, bessMw, allBessMw);
  updateChart(state.charts.projects, projectCount, allProjectCount);
  updateChart(state.charts.largest, largestMw, allLargestMw);
}

Newspaper V9 2

A JavaScript module in the plugins folder of GlobalGrid2050 that refreshes projects, draws news v9 and fetches payload, covering battery storage (BESS) and solar.

renderglobalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-2.js · lines 1–168 of 168 · version 2026-09-05 11:52 · pattern signalForProject (shared by 9 files)

What it does
It draws battery storage (BESS), solar and the REPD register. Defines 13 functions or classes, including refreshProjects, newsKey, indexNewsItems, signalLabel, signalForProjectV9_2. Side effects: changes the web page (DOM); makes network requests.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: battery storage (BESS), solar, the REPD register.
Downstream impact
Used directly by 9 files: App V9 3 (globalgrid2050); App V9 4 (globalgrid2050); Testcode — Pipeline (globalgrid2050); Projects V9 2 (globalgrid2050); and 5 more. Reached from 188 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — PipelineNews Intelligence Page (globalgrid2050, https://globalgrid2050.com/pipelinenews_intelligence/202609050309/).
What it achieves
It refreshes projects (`refreshProjects`), indexes news (`indexNewsItems`) and draws news v9 (`drawNewsV9_2`). Defines `refreshProjects`, `newsKey`, `indexNewsItems` and 10 more.
Why it matters
Imported by 9 files, including App V9 3, App V9 4 and Testcode — Pipeline.
Application
globalgrid2050 · testcode/202609051152/pipeline/scripts/plugins · JavaScript module
Uses
State (import), Testcode — Pipeline (import), News Relevance V9 2 (import)
Used by
imported by App V9 3 (import), imported by App V9 4 (import), imported by Testcode — Pipeline (import), imported by Projects V9 2 (import), imported by Projects V9 3 (import), imported by Projects V9 4 (import), imported by Projects V9 2 (import), imported by Projects V9 3 (import), and 1 more, mentioned in Standalone (comment link)
Produces
signalForProjectV9_2, drawNewsV9_2, loadNewsV9_2, bindNewspaperV9_2
Defines here
refreshProjects, newsKey, indexNewsItems, signalLabel, signalForProjectV9_2, newsMatches, drawNewsV9_2, renderNews, validPayload, payloadTime, fetchPayload, loadNewsV9_2, bindNewspaperV9_2
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-2.js:1-168 · blob 6c72de9e9bd8f41bf525a32ca2436e53ddb466b0 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: production_core
import { DATA_SOURCES, state } from "../core/state.js";
import { escapeHtml, isFinanceEvent, normaliseProject } from "../core/utils.js";
import { assessNewsItemV9_2 } from "../core/news-relevance-v9-2.js";

let refreshProjects = () => {};
let newsIndex = new Map();

function newsKey(technology, project) {
  return `${String(technology || "").toLowerCase()}|${normaliseProject(project)}`;
}

function indexNewsItems(items) {
  newsIndex = new Map();
  for (const item of items) {
    const assessment = assessNewsItemV9_2(item);
    const candidate = Object.freeze({ item, assessment });
    const key = newsKey(item.technology, item.project);
    const previous = newsIndex.get(key);
    const candidateDate = Date.parse(String(item.published || "")) || 0;
    const previousDate = previous ? Date.parse(String(previous.item.published || "")) || 0 : 0;
    if (!previous || assessment.score > previous.assessment.score
      || (assessment.score === previous.assessment.score && candidateDate > previousDate)) {
      newsIndex.set(key, candidate);
    }
  }
}

function signalLabel(item) {
  const event = String(item.event || "PROJECT UPDATE").toUpperCase();
  if (event === "CONSENT") return { label: "APPROVED*", cls: "approved" };
  if (event === "OPERATIONAL") return { label: "OPERATIONAL*", cls: "operational" };
  if (event === "CONSTRUCTION") return { label: "CONSTRUCTION*", cls: "construction" };
  if (["FINANCIAL CLOSE", "ACQUISITION"].includes(event)) {
    return { label: event === "ACQUISITION" ? "M&A*" : "FINANCED*", cls: "finance" };
  }
  return { label: `${event}*`.slice(0, 22), cls: "" };
}

export function signalForProjectV9_2(project) {
  const technology = project.technology === "solar" ? "solar" : project.technology === "bess" ? "bess" : "";
  if (!technology) return { label: "—", cls: "none", note: "legacy V5 feed did not cover wind" };
  const candidate = newsIndex.get(newsKey(technology, project.name));
  if (!candidate) return { label: "—", cls: "none", note: "no exact legacy project-name match" };
  if (!candidate.assessment.strong) {
    return {
      label: "—",
      cls: "none",
      note: `legacy headline rejected by V9.2 relevance gate (${candidate.assessment.score}%)`,
    };
  }
  const signal = signalLabel(candidate.item);
  return {
    ...signal,
    note: `algorithmic relevance ${candidate.assessment.score}% · unverified · ${candidate.item.published || "date unavailable"}`,
  };
}

function newsMatches(item) {
  const event = String(item.event || "").toUpperCase();
  const technology = String(item.technology || "").toUpperCase();
  const assessment = assessNewsItemV9_2(item);
  if (state.newsMode === "RELEVANT" && !assessment.strong) return false;
  if (state.newsMode === "SOLAR" && technology !== "SOLAR") return false;
  if (state.newsMode === "BESS" && technology !== "BESS") return false;
  if (state.newsMode === "CONSENT" && event !== "CONSENT") return false;
  if (state.newsMode === "CONSTRUCTION" && event !== "CONSTRUCTION") return false;
  if (state.newsMode === "OPERATIONAL" && event !== "OPERATIONAL") return false;
  if (state.newsMode === "FINANCE" && !isFinanceEvent(event)) return false;
  if (state.newsQuery) {
    const haystack = normaliseProject([
      item.headline,
      item.project,
      item.operator,
      item.county,
      item.source,
      item.event,
    ].join(" "));
    const tokens = normaliseProject(state.newsQuery).split(" ").filter(Boolean);
    if (!tokens.every((token) => haystack.includes(token))) return false;
  }
  return true;
}

export function drawNewsV9_2() {
  const stories = document.getElementById("stories");
  const rows = state.newsItems.filter(newsMatches);
  if (!rows.length) {
    stories.innerHTML = '<div class="news-empty">No headlines match this newspaper filter.</div>';
    return;
  }

  stories.innerHTML = rows.map((item) => {
    const articleClass = String(item.technology || "").toLowerCase() === "bess" ? "bess" : "solar";
    const capacity = Number(item.capacity_mw || 0);
    const assessment = assessNewsItemV9_2(item);
    const qualityClass = assessment.strong ? "relevant" : "unverified";
    const qualityLabel = assessment.strong ? `RELEVANT ${assessment.score}%` : `UNVERIFIED ${assessment.score}%`;
    return `<a class="story ${articleClass}" href="${escapeHtml(item.url)}" target="_blank" rel="noopener"><div class="kicker">${escapeHtml((item.technology || "").toUpperCase())} · ${escapeHtml(item.event || "PROJECT UPDATE")} · ${escapeHtml(item.published || "")}</div><h3>${escapeHtml(item.headline || item.project)}</h3><p><span class="project">${escapeHtml(item.project || "")}${capacity ? ` · $  … [line shortened here: 724 characters; full line on GitHub]
  }).join("");
}

function renderNews(payload) {
  state.newsItems = Array.isArray(payload.items) ? payload.items : [];
  indexNewsItems(state.newsItems);
  const relevant = state.newsItems.filter((item) => assessNewsItemV9_2(item).strong).length;
  const eligible = payload.eligible_projects == null
    ? "REPD universe pending first refresh"
    : `${Number(payload.eligible_projects).toLocaleString("en-GB")} legacy-eligible projects`;
  document.getElementById("newsMeta").textContent = `${relevant} relevant / ${state.newsItems.length} legacy headlines · ${eligible} · ${String(payload.updated || "").slice(0, 10)}`;
  drawNewsV9_2();
  if (state.all.length) refreshProjects();
}

function validPayload(payload) {
  return payload
    && Array.isArray(payload.items)
    && Number.isFinite(Number(payload.headline_count ?? payload.items.length));
}

function payloadTime(payload) {
  const timestamp = Date.parse(String(payload && payload.updated || ""));
  return Number.isFinite(timestamp) ? timestamp : 0;
}

async function fetchPayload(label, url) {
  const response = await fetch(url, { cache: "no-store" });
  if (!response.ok) throw new Error(`${label} ${response.status}`);
  const data = await response.json();
  if (!validPayload(data)) throw new Error(`${label} invalid payload`);
  return { label, data };
}

export async function loadNewsV9_2() {
  const stamp = Date.now();
  const sources = [
    ["Pages", `${DATA_SOURCES.newsPages}?v=${stamp}`],
    ["GitHub main", `${DATA_SOURCES.newsGitHub}?v=${stamp}`],
  ];
  const settled = await Promise.allSettled(sources.map(([label, url]) => fetchPayload(label, url)));
  const good = settled.filter((result) => result.status === "fulfilled").map((result) => result.value);
  if (!good.length) {
    document.getElementById("stories").innerHTML = '<div class="news-empty">Daily newspaper feed unavailable. REPD analytics below remain live.</div>';
    document.getElementById("newsMeta").textContent = "feed unavailable";
    return;
  }

  good.sort((left, right) => payloadTime(right.data) - payloadTime(left.data)
    || ((right.data.items || []).length - (left.data.items || []).length));
  const best = good[0];
  renderNews(best.data);
  document.getElementById("newsMeta").textContent += ` · ${best.label}`;
}

export function bindNewspaperV9_2(onNewsLoaded) {
  refreshProjects = onNewsLoaded;
  document.querySelectorAll("#newsTools button").forEach((button) => {
    button.onclick = () => {
      document.querySelectorAll("#newsTools button").forEach((candidate) => candidate.classList.remove("active"));
      button.classList.add("active");
      state.newsMode = button.dataset.news;
      drawNewsV9_2();
    };
  });
  document.getElementById("newsSearch").oninput = (event) => {
    state.newsQuery = event.target.value.trim();
    drawNewsV9_2();
  };
}

Newspaper V9 5 1

A JavaScript module in the plugins folder of GlobalGrid2050 that draws major project news, battery storage (BESS), the Renewable Energy Planning Database (REPD) register and solar.

renderglobalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-5-1.js · lines 1–163 of 163 · version 2026-09-05 11:52 · pattern itemTechnology (shared by 7 files)

What it does
It draws major project news, battery storage (BESS), the REPD register and solar. Defines 14 functions or classes, including refreshProjects, canonicalItem, indexNewsItems, signalLabel, signalForProjectV9_5_1. Side effects: changes the web page (DOM); makes network requests.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: battery storage (BESS), the REPD register, solar.
Inputs & outputs
In: JSON file major_project_news_v9_5_1.json.
Downstream impact
Used directly by 4 files: App V9 5 1 (globalgrid2050); Newspaper V9 6 2 (globalgrid2050); Newspaper V9 7 (globalgrid2050); Projects V9 5 1 (globalgrid2050). Reached from 183 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — PipelineNews Intelligence Page (globalgrid2050, https://globalgrid2050.com/pipelinenews_intelligence/202609050309/).
What it achieves
It refreshes projects (`refreshProjects`), indexes news (`indexNewsItems`) and draws news v9 (`drawNewsV9_5_1`). Defines `refreshProjects`, `canonicalItem`, `indexNewsItems` and 11 more.
Why it matters
Imported by 4 files, including App V9 5 1, Newspaper V9 6 2 and Newspaper V9 7.
Application
globalgrid2050 · testcode/202609051152/pipeline/scripts/plugins · JavaScript module
Uses
State (import), Testcode — Pipeline (import)
Used by
imported by App V9 5 1 (import), imported by Newspaper V9 6 2 (import), imported by Newspaper V9 7 (import), imported by Projects V9 5 1 (import), mentioned in Standalone (comment link)
Produces
signalForProjectV9_5_1, drawNewsV9_5_1, loadNewsV9_5_1, bindNewspaperV9_5_1
Defines here
refreshProjects, canonicalItem, indexNewsItems, signalLabel, signalForProjectV9_5_1, itemTechnology, newsMatches, drawNewsV9_5_1, validPayload, payloadTime, fetchPayload, renderNews, loadNewsV9_5_1, bindNewspaperV9_5_1
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-5-1.js:1-163 · blob c990407d2fd47ccfd9b94ab7c34230dce6741007 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: production_core
import { state } from "../core/state.js";
import { escapeHtml, isFinanceEvent, normaliseProject } from "../core/utils.js";

const NEWS_SOURCES = Object.freeze([
  ["Pages", "/dist/major_project_news_v9_5_1.json"],
  ["GitHub main", "https://raw.githubusercontent.com/Ventusltd/globalgrid2050/main/dist/major_project_news_v9_5_1.json"],
]);

let refreshProjects = () => {};
let newsIndex = new Map();

function canonicalItem(item) {
  return item
    && item.role === "PRIMARY_MATCH"
    && item.eligible_for_news_signal === true
    && String(item.repd_ref || "")
    && item.gg_project_id === `GG2050-REPD-${item.repd_ref}`;
}

function indexNewsItems(items) {
  newsIndex = new Map();
  for (const item of items.filter(canonicalItem)) {
    const key = String(item.repd_ref);
    const previous = newsIndex.get(key);
    const candidateDate = Date.parse(String(item.published || "")) || 0;
    const previousDate = previous ? Date.parse(String(previous.published || "")) || 0 : 0;
    if (!previous || Number(item.confidence || 0) > Number(previous.confidence || 0)
      || (Number(item.confidence || 0) === Number(previous.confidence || 0) && candidateDate > previousDate)) {
      newsIndex.set(key, item);
    }
  }
}

function signalLabel(item) {
  const event = String(item.event || "PROJECT UPDATE").toUpperCase();
  if (event === "CONSENT") return { label: "APPROVED*", cls: "approved" };
  if (event === "OPERATIONAL") return { label: "OPERATIONAL*", cls: "operational" };
  if (event === "CONSTRUCTION") return { label: "CONSTRUCTION*", cls: "construction" };
  if (["FINANCIAL CLOSE", "ACQUISITION"].includes(event)) {
    return { label: event === "ACQUISITION" ? "M&A*" : "FINANCED*", cls: "finance" };
  }
  return { label: `${event}*`.slice(0, 22), cls: "" };
}

export function signalForProjectV9_5_1(project) {
  const item = newsIndex.get(String(project.repd_ref));
  if (!item) return { label: "—", cls: "none", note: "no exact canonical PRIMARY_MATCH" };
  return {
    ...signalLabel(item),
    note: `canonical PRIMARY_MATCH ${Number(item.confidence || 0)}% · unverified event · ${item.published || "date unavailable"}`,
  };
}

function itemTechnology(item) {
  return String(item.canonical_technology || item.technology || "").toUpperCase();
}

function newsMatches(item) {
  const event = String(item.event || "").toUpperCase();
  const technology = itemTechnology(item);
  if (state.newsMode === "RELEVANT" && item.canonical_relevant !== true) return false;
  if (state.newsMode === "SOLAR" && technology !== "SOLAR") return false;
  if (state.newsMode === "BESS" && technology !== "BESS") return false;
  if (state.newsMode === "CONSENT" && event !== "CONSENT") return false;
  if (state.newsMode === "CONSTRUCTION" && event !== "CONSTRUCTION") return false;
  if (state.newsMode === "OPERATIONAL" && event !== "OPERATIONAL") return false;
  if (state.newsMode === "FINANCE" && !isFinanceEvent(event)) return false;
  if (state.newsQuery) {
    const haystack = normaliseProject([
      item.headline, item.canonical_project, item.project, item.operator, item.county,
      item.source, item.event, item.repd_ref, item.gg_project_id,
    ].join(" "));
    const tokens = normaliseProject(state.newsQuery).split(" ").filter(Boolean);
    if (!tokens.every((token) => haystack.includes(token))) return false;
  }
  return true;
}

export function drawNewsV9_5_1() {
  const stories = document.getElementById("stories");
  const rows = state.newsItems.filter(newsMatches);
  if (!rows.length) {
    stories.innerHTML = '<div class="news-empty">No headlines match this newspaper filter.</div>';
    return;
  }
  stories.innerHTML = rows.map((item) => {
    const technology = itemTechnology(item);
    const articleClass = technology === "BESS" ? "bess" : "solar";
    const project = item.canonical_project || item.project || "";
    const capacity = Number(item.canonical_capacity_mw ?? item.capacity_mw ?? 0);
    const quality = item.canonical_relevant === true
      ? `<span class="news-quality relevant">RELEVANT ${Number(item.confidence || 0)}%</span> · PRIMARY_MATCH · REPD ${escapeHtml(item.repd_ref)}`
      : '<span class="news-quality unverified">DISCOVERY ONLY</span> · no project signal';
    return `<a class="story ${articleClass}" href="${escapeHtml(item.url)}" target="_blank" rel="noopener"><div class="kicker">${escapeHtml(technology)} · ${escapeHtml(item.event || "PROJECT UPDATE")} · ${escapeHtml(item.published || "")}</div><h3>${escapeHtml(item.headline || project)}</h3><p><span class="project">${escapeHtml(project)}${capacity ? ` · ${capacity.toLocaleString("en-GB")} MW` : ""  … [line shortened here: 636 characters; full line on GitHub]
  }).join("");
}

function validPayload(payload) {
  return payload
    && payload.schema === "globalgrid2050.major-project-news.v9.5.1"
    && payload.release === "9.5.1"
    && Array.isArray(payload.all_items)
    && Array.isArray(payload.canonical_items)
    && payload.all_headline_count === payload.all_items.length
    && payload.relevant_headline_count === payload.canonical_items.length
    && payload.v9_4_baseline_headline_count === 125
    && payload.all_items.every((item) => typeof item.canonical_relevant === "boolean")
    && payload.canonical_items.every(canonicalItem)
    && payload.beacon_fen_contract?.repd_ref === "13599"
    && payload.beacon_fen_contract?.official_capacity_mw === 400;
}

function payloadTime(payload) {
  const timestamp = Date.parse(String(payload?.updated || ""));
  return Number.isFinite(timestamp) ? timestamp : 0;
}

async function fetchPayload(label, url) {
  const target = new URL(url, window.location.href);
  target.searchParams.set("v", Date.now());
  const response = await fetch(target, { cache: "no-store" });
  if (!response.ok) throw new Error(`${label} ${response.status}`);
  const data = await response.json();
  if (!validPayload(data)) throw new Error(`${label} invalid V9.5.1 payload`);
  return { label, data };
}

function renderNews(payload, label) {
  state.newsItems = payload.all_items;
  indexNewsItems(payload.canonical_items);
  document.getElementById("newsMeta").textContent = `${payload.relevant_headline_count} relevant / ${payload.all_headline_count} headlines · ${payload.v9_4_baseline_headline_count} V9.4 baseline retained · ${String(payload.updated || "").slice(0, 10)} · ${label}`;
  drawNewsV9_5_1();
  if (state.all.length) refreshProjects();
}

export async function loadNewsV9_5_1() {
  const settled = await Promise.allSettled(NEWS_SOURCES.map(([label, url]) => fetchPayload(label, url)));
  const good = settled.filter((result) => result.status === "fulfilled").map((result) => result.value);
  if (!good.length) {
    document.getElementById("stories").innerHTML = '<div class="news-empty">V9.5.1 newspaper unavailable. REPD analytics below remain live.</div>';
    document.getElementById("newsMeta").textContent = "newspaper unavailable";
    return;
  }
  good.sort((left, right) => payloadTime(right.data) - payloadTime(left.data)
    || right.data.all_items.length - left.data.all_items.length);
  renderNews(good[0].data, good[0].label);
}

export function bindNewspaperV9_5_1(onNewsLoaded) {
  refreshProjects = onNewsLoaded;
  document.querySelectorAll("#newsTools button").forEach((button) => {
    button.onclick = () => {
      document.querySelectorAll("#newsTools button").forEach((candidate) => candidate.classList.remove("active"));
      button.classList.add("active");
      state.newsMode = button.dataset.news;
      drawNewsV9_5_1();
    };
  });
  document.getElementById("newsSearch").oninput = (event) => {
    state.newsQuery = event.target.value.trim();
    drawNewsV9_5_1();
  };
}

Newspaper V9 5

A JavaScript module in the plugins folder of GlobalGrid2050 that draws major project news, battery storage (BESS), solar and the Renewable Energy Planning Database (REPD) register.

Set aside from the main view: 98% of its lines are the same as uk_renewables_pipeline/202609051156/scripts/plugins/newspaper-v9-5.js (globalgrid2050), which stays. (near-copy-of, proposed by families.py). 98% of lines shared with Newspaper V9 5; read that one first. All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line-jaccard 0.982 to globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202609051156/scripts/plugins/newspaper-v9-5.js:1-151 ad810d2effbc63207268d9359979a46b3a4073bb
  • sha256 abca4ff5fb4e8f28bf5a613d399d6bb8a7a4ee94234a0936694663f2c5c2f2dc
  • target sha256 623c5aa4d08fe23430d4e85b9022c65099bef198849ab6cefaa2d58209a0bbe2
  • group of 2 (identity.json near-copy edges >= 0.9)
  • canonical rule: reachable, newest stamp, core repo, most lines

renderglobalgrid2050 / testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-5.js · lines 1–151 of 151 · version 2026-09-05 11:52 · pattern signalForProject (shared by 9 files)

What it does
It draws major project news, battery storage (BESS), solar and the REPD register. Defines 13 functions or classes, including refreshProjects, canonicalItem, indexNewsItems, signalLabel, signalForProjectV9_5. Side effects: changes the web page (DOM); makes network requests.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: battery storage (BESS), solar, the REPD register.
Inputs & outputs
In: JSON file major_project_news_v6.json.
Downstream impact
Used directly by 2 files: App V9 5 (globalgrid2050); Projects V9 5 (globalgrid2050). Reached from 182 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — PipelineNews Intelligence Page (globalgrid2050, https://globalgrid2050.com/pipelinenews_intelligence/202609050309/).
What it achieves
It refreshes projects (`refreshProjects`), indexes news (`indexNewsItems`) and draws news v9 (`drawNewsV9_5`). Defines `refreshProjects`, `canonicalItem`, `indexNewsItems` and 10 more.
Why it matters
Imported by App V9 5 and Projects V9 5.
Application
globalgrid2050 · testcode/202609051152/pipeline/scripts/plugins · JavaScript module
Uses
State (import), Testcode — Pipeline (import)
Used by
imported by App V9 5 (import), imported by Projects V9 5 (import), mentioned in Standalone (comment link)
Produces
signalForProjectV9_5, drawNewsV9_5, loadNewsV9_5, bindNewspaperV9_5
Defines here
refreshProjects, canonicalItem, indexNewsItems, signalLabel, signalForProjectV9_5, newsMatches, drawNewsV9_5, renderNews, validPayload, payloadTime, fetchPayload, loadNewsV9_5, bindNewspaperV9_5
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051152/pipeline/scripts/plugins/newspaper-v9-5.js:1-151 · blob 81b219ae7e6b4c338605005063f3358778e2d7ec · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: production_core
import { state } from "../core/state.js";
import { escapeHtml, isFinanceEvent, normaliseProject } from "../core/utils.js";

const NEWS_SOURCES = Object.freeze([
  ["Pages", "/dist/major_project_news_v6.json"],
  ["GitHub main", "https://raw.githubusercontent.com/Ventusltd/globalgrid2050/main/dist/major_project_news_v6.json"],
]);

let refreshProjects = () => {};
let newsIndex = new Map();

function canonicalItem(item) {
  return item
    && item.role === "PRIMARY_MATCH"
    && item.eligible_for_news_signal === true
    && String(item.repd_ref || "")
    && String(item.gg_project_id || "");
}

function indexNewsItems(items) {
  newsIndex = new Map();
  for (const item of items.filter(canonicalItem)) {
    const key = String(item.repd_ref);
    const previous = newsIndex.get(key);
    const candidateDate = Date.parse(String(item.published || "")) || 0;
    const previousDate = previous ? Date.parse(String(previous.published || "")) || 0 : 0;
    if (!previous || Number(item.confidence || 0) > Number(previous.confidence || 0)
      || (Number(item.confidence || 0) === Number(previous.confidence || 0) && candidateDate > previousDate)) {
      newsIndex.set(key, item);
    }
  }
}

function signalLabel(item) {
  const event = String(item.event || "PROJECT UPDATE").toUpperCase();
  if (event === "CONSENT") return { label: "APPROVED*", cls: "approved" };
  if (event === "OPERATIONAL") return { label: "OPERATIONAL*", cls: "operational" };
  if (event === "CONSTRUCTION") return { label: "CONSTRUCTION*", cls: "construction" };
  if (["FINANCIAL CLOSE", "ACQUISITION"].includes(event)) {
    return { label: event === "ACQUISITION" ? "M&A*" : "FINANCED*", cls: "finance" };
  }
  return { label: `${event}*`.slice(0, 22), cls: "" };
}

export function signalForProjectV9_5(project) {
  const item = newsIndex.get(String(project.repd_ref));
  if (!item) {
    const note = ["solar", "bess"].includes(project.technology)
      ? "no canonical PRIMARY_MATCH in current V9.5 feed"
      : "canonical V9.5 feed does not yet cover wind";
    return { label: "—", cls: "none", note };
  }
  return {
    ...signalLabel(item),
    note: `canonical PRIMARY_MATCH ${Number(item.confidence || 0)}% · unverified event · ${item.published || "date unavailable"}`,
  };
}

function newsMatches(item) {
  const event = String(item.event || "").toUpperCase();
  const technology = String(item.technology || "").toUpperCase();
  if (state.newsMode === "SOLAR" && technology !== "SOLAR") return false;
  if (state.newsMode === "BESS" && technology !== "BESS") return false;
  if (state.newsMode === "CONSENT" && event !== "CONSENT") return false;
  if (state.newsMode === "CONSTRUCTION" && event !== "CONSTRUCTION") return false;
  if (state.newsMode === "OPERATIONAL" && event !== "OPERATIONAL") return false;
  if (state.newsMode === "FINANCE" && !isFinanceEvent(event)) return false;
  if (state.newsQuery) {
    const haystack = normaliseProject([
      item.headline, item.project, item.operator, item.county, item.source,
      item.event, item.repd_ref, item.gg_project_id,
    ].join(" "));
    const tokens = normaliseProject(state.newsQuery).split(" ").filter(Boolean);
    if (!tokens.every((token) => haystack.includes(token))) return false;
  }
  return true;
}

export function drawNewsV9_5() {
  const stories = document.getElementById("stories");
  const rows = state.newsItems.filter(newsMatches);
  if (!rows.length) {
    stories.innerHTML = '<div class="news-empty">No canonical headlines match this newspaper filter.</div>';
    return;
  }
  stories.innerHTML = rows.map((item) => {
    const articleClass = String(item.technology || "").toLowerCase() === "bess" ? "bess" : "solar";
    const capacity = Number(item.capacity_mw || 0);
    return `<a class="story ${articleClass}" href="${escapeHtml(item.url)}" target="_blank" rel="noopener"><div class="kicker">${escapeHtml((item.technology || "").toUpperCase())} · ${escapeHtml(item.event || "PROJECT UPDATE")} · ${escapeHtml(item.published || "")}</div><h3>${escapeHtml(item.headline || item.project)}</h3><p><span class="project">${escapeHtml(item.project || "")}${capacity ? ` · $  … [line shortened here: 751 characters; full line on GitHub]
  }).join("");
}

function renderNews(payload, label) {
  state.newsItems = payload.items.filter(canonicalItem);
  indexNewsItems(state.newsItems);
  document.getElementById("newsMeta").textContent = `${state.newsItems.length} canonical PRIMARY_MATCH headlines · ${String(payload.updated || "").slice(0, 10)} · ${label}`;
  drawNewsV9_5();
  if (state.all.length) refreshProjects();
}

function validPayload(payload) {
  return payload
    && payload.schema === "globalgrid2050.major-project-news.v6"
    && Array.isArray(payload.items)
    && payload.items.every(canonicalItem)
    && Number(payload.headline_count) === payload.items.length;
}

function payloadTime(payload) {
  const timestamp = Date.parse(String(payload?.updated || ""));
  return Number.isFinite(timestamp) ? timestamp : 0;
}

async function fetchPayload(label, url) {
  const target = new URL(url, window.location.href);
  target.searchParams.set("v", Date.now());
  const response = await fetch(target, { cache: "no-store" });
  if (!response.ok) throw new Error(`${label} ${response.status}`);
  const data = await response.json();
  if (!validPayload(data)) throw new Error(`${label} invalid canonical payload`);
  return { label, data };
}

export async function loadNewsV9_5() {
  const settled = await Promise.allSettled(NEWS_SOURCES.map(([label, url]) => fetchPayload(label, url)));
  const good = settled.filter((result) => result.status === "fulfilled").map((result) => result.value);
  if (!good.length) {
    document.getElementById("stories").innerHTML = '<div class="news-empty">Canonical newspaper feed unavailable. REPD analytics below remain live.</div>';
    document.getElementById("newsMeta").textContent = "canonical feed unavailable";
    return;
  }
  good.sort((left, right) => payloadTime(right.data) - payloadTime(left.data)
    || right.data.items.length - left.data.items.length);
  renderNews(good[0].data, good[0].label);
}

export function bindNewspaperV9_5(onNewsLoaded) {
  refreshProjects = onNewsLoaded;
  document.querySelectorAll("#newsTools button").forEach((button) => {
    button.onclick = () => {
      document.querySelectorAll("#newsTools button").forEach((candidate) => candidate.classList.remove("active"));
      button.classList.add("active");
      state.newsMode = button.dataset.news;
      drawNewsV9_5();
    };
  });
  document.getElementById("newsSearch").oninput = (event) => {
    state.newsQuery = event.target.value.trim();
    drawNewsV9_5();
  };
}