PageSourceSearch

https://onlinebible.github.io/js/loadsummary.js

js onlinebible.github.io collected 2026-10-03 09:43:05 UTC 2,611 bytes, 113 lines download raw bytes

1async function loadSummary(fileName)
2{
3    const response = await fetch(fileName);
4    if (!response.ok) {
5        throw new Error(`Не удалось загрузить <${fileName}>`);
6    }
7    const text = await response.text();
8    const lines = text.split(/\r?\n/);
9
10    const data = {};
11
12    let start = false;
13
14    for (const line of lines)
15    {
16        if (!start)
17        {
18            if (line.trim() === "Modules Sorted by Compile Date")
19                start = true;
20
21            continue;
22        }
23
24        const s = line.trim();
25
26        if (s === "")
27            continue;
28
29        // Language Date Code Title
30        const m = s.match(/^(\S+)\s+(\d{4}\/\d{2}\/\d{2})\s+(\S+)\s+(.+)$/);
31
32        if (!m)
33            continue;
34
35        const language = m[1];
36        const date     = m[2];
37        const code     = m[3];
38        const title    = m[4];
39
40        if (!data[language])
41            data[language] = [];
42
43        data[language].push({
44            date,
45            code,
46            title
47        });
48    }
49
50    return data;
51}
52
53function buildSummary(containerId, data)
54{
55    const container = document.getElementById(containerId);
56
57    container.innerHTML = "";
58
59    for (const language of Object.keys(data))
60    {
61        const section = document.createElement("div");
62        section.className = `section ${language}`;
63        section.innerHTML =
64        `
65            <h2 id="sec_${language}">${language}</h2>
66
67            <table class="table table-striped table-hover">
68                <tbody></tbody>
69            </table>
70
71            <a class="page_scroll" href="#language">
72                Наверх <span class="glyphicon glyphicon-upload"></span>
73            </a>
74        `;
75
76        const tbody = section.querySelector("tbody");
77
78        for (const module of data[language])
79        {
80            tbody.insertAdjacentHTML("beforeend",
81            `
82                <tr class="product">
83                    <td class="sort">
84                        ${module.date}
85                    </td>
86
87                    <td class="title">
88                        <span>${module.code}</span>
89                    </td>
90
91                    <td class="subtitle">
92                        <span>${module.title}</span>
93                    </td>
94                </tr>
95            `);
96        }
97
98        container.appendChild(section);
99    }
100}
101
102window.addEventListener("DOMContentLoaded", async () =>
103{
104    try
105    {
106        const summary = await loadSummary("Summary.Txt");
107        buildSummary("products", summary);
108    }
109    catch (err)
110    {
111        console.error(err);
112    }
113});

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.