()
| 66 | /* Was in jede Seite eingesetzt wird */ |
| 67 | |
| 68 | function pageProbe() { |
| 69 | try { localStorage.setItem('cbm.workspace.setup', 'done'); } catch { /* ohne Speicher geht es auch */ } |
| 70 | |
| 71 | // Der sichtbare Mauszeiger. |
| 72 | const mountCursor = () => { |
| 73 | if (document.getElementById('probe-cursor')) return; |
| 74 | const dot = document.createElement('div'); |
| 75 | dot.id = 'probe-cursor'; |
| 76 | dot.style.cssText = 'position:fixed;left:-100px;top:-100px;width:22px;height:22px;margin:-11px 0 0 -11px;' |
| 77 | + 'border:2px solid #ff3b6b;border-radius:50%;box-shadow:0 0 0 2px rgba(0,0,0,.6);pointer-events:none;z-index:2147483647;'; |
| 78 | const cross = document.createElement('div'); |
| 79 | cross.style.cssText = 'position:absolute;left:9px;top:9px;width:4px;height:4px;background:#ff3b6b;border-radius:50%;'; |
| 80 | dot.appendChild(cross); |
| 81 | document.documentElement.appendChild(dot); |
| 82 | document.addEventListener('mousemove', (event) => { |
| 83 | dot.style.left = `${event.clientX}px`; |
| 84 | dot.style.top = `${event.clientY}px`; |
| 85 | }, true); |
| 86 | }; |
| 87 | if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', mountCursor); |
| 88 | else mountCursor(); |
| 89 | |
| 90 | // Welche Zeichenflaeche gerade steht: eine neu aufgebaute bekommt eine neue Nummer. |
| 91 | window.__probeCanvasSeq = 0; |
| 92 | window.__probeCanvasId = () => { |
| 93 | const canvas = document.querySelector('.atlas-galaxy canvas') ?? document.querySelector('canvas'); |
| 94 | if (!canvas) return null; |
| 95 | if (!canvas.dataset.probeId) canvas.dataset.probeId = String(++window.__probeCanvasSeq); |
| 96 | return canvas.dataset.probeId; |
| 97 | }; |
| 98 | |
| 99 | // Was zwischen Seite und Modell-Worker hin und her geht: der echte Prompt. |
| 100 | window.__probeWorker = []; |
| 101 | const keep = (entry) => { |
| 102 | window.__probeWorker.push(entry); |
| 103 | if (window.__probeWorker.length > 4000) window.__probeWorker.splice(0, 1000); |
| 104 | }; |
| 105 | const safe = (value) => { |
| 106 | try { return JSON.parse(JSON.stringify(value, (key, item) => (typeof item === 'string' && item.length > 20000 ? `${item.slice(0, 20000)}...` : item))); } |
| 107 | catch { return String(value); } |
| 108 | }; |
| 109 | const NativeWorker = window.Worker; |
| 110 | window.Worker = class ProbeWorker extends NativeWorker { |
| 111 | constructor(url, options) { |
| 112 | super(url, options); |
| 113 | this.__probeSrc = String(url); |
| 114 | if (this.__probeSrc.includes('browser-ai')) { |
| 115 | this.addEventListener('message', (event) => keep({ dir: 'from-worker', t: performance.now(), data: safe(event.data) })); |
| 116 | } |
| 117 | } |
| 118 | postMessage(message, transfer) { |
| 119 | if (this.__probeSrc.includes('browser-ai')) keep({ dir: 'to-worker', t: performance.now(), data: safe(message) }); |
| 120 | return super.postMessage(message, transfer); |
| 121 | } |
| 122 | }; |
| 123 | |
| 124 | // Ein Zeitstrahl der Kamera, alle 100 ms, unabhaengig von den Bildern. |
| 125 | window.__probeTimeline = []; |
nothing calls this directly
no test coverage detected