diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..668244b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +logo-variants/ +nul diff --git a/img/sponzor34.png b/img/sponzor34.png index eee3eb8..6d3c4d9 100644 Binary files a/img/sponzor34.png and b/img/sponzor34.png differ diff --git a/tools/validate-match-order.js b/tools/validate-match-order.js new file mode 100644 index 0000000..0e916ea --- /dev/null +++ b/tools/validate-match-order.js @@ -0,0 +1,44 @@ +// Validation harness: runs the real js/facr-frontend.js with a minimal DOM stub +// and prints the rendered order of matches in #facr-all-matches. +const fs = require('fs'); +const vm = require('vm'); + +const JS_FILE = 'W:/Downloads/HTML_projekty/bizoni/js/facr-frontend.js'; +const LOCAL_JSON = 'W:/Downloads/HTML_projekty/bizoni/data/club.json'; +const LIVE_URL = 'https://bizoniuh.cz/data/club.json'; + +async function run(data, label) { + const code = fs.readFileSync(JS_FILE, 'utf8'); + const container = { innerHTML: '' }; + let initFn = null; + + const sandbox = { + console, + setInterval: () => 0, + clearInterval: () => {}, + Date, + document: { + addEventListener: (ev, cb) => { if (ev === 'DOMContentLoaded') initFn = cb; }, + getElementById: (id) => (id === 'facr-all-matches' ? container : null), + createElement: () => ({ appendChild() {}, style: {} }), + head: { appendChild() {} }, + }, + fetch: async () => ({ ok: true, json: async () => data }), + }; + sandbox.window = sandbox; + vm.createContext(sandbox); + vm.runInContext(code, sandbox); + + await initFn(); + + const dates = container.innerHTML.match(/\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}/g) || []; + console.log(`\n=== ${label} ===`); + dates.forEach((d, i) => console.log(`${String(i + 1).padStart(2)}. ${d}`)); +} + +(async () => { + const local = JSON.parse(fs.readFileSync(LOCAL_JSON, 'utf8')); + await run(local, 'local data/club.json'); + const live = await (await fetch(LIVE_URL)).json(); + await run(live, 'live bizoniuh.cz/data/club.json'); +})().catch(e => { console.error('FAILED:', e); process.exit(1); });