File size: 22,273 Bytes
4886d66
d390af3
369729c
0bd367c
 
 
 
 
 
4016fcc
0bd367c
 
 
 
 
 
4886d66
369729c
4886d66
ba807db
4886d66
 
 
 
4016fcc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fb7d3dc
0bd367c
4016fcc
0bd367c
 
4886d66
4016fcc
0bd367c
4886d66
0bd367c
 
 
 
 
 
 
 
 
 
 
 
 
 
4016fcc
0bd367c
 
 
4016fcc
0bd367c
 
 
 
 
 
 
 
 
4016fcc
 
fb7d3dc
4016fcc
 
0bd367c
 
4016fcc
fff20b8
369729c
 
 
fff20b8
369729c
 
 
fff20b8
0bd367c
4016fcc
0bd367c
4016fcc
 
 
 
0bd367c
fff20b8
 
0bd367c
 
ba807db
 
 
 
fff20b8
0bd367c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369729c
fb7d3dc
369729c
 
 
0bd367c
 
fb7d3dc
 
c69a43e
 
 
0bd367c
 
 
 
 
 
 
9325762
0bd367c
d390af3
0bd367c
 
 
 
 
 
 
 
369729c
fb7d3dc
369729c
 
 
0bd367c
 
fb7d3dc
 
c69a43e
 
 
0bd367c
 
 
 
 
 
 
9325762
0bd367c
d390af3
0bd367c
 
 
 
d390af3
0bd367c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69519e1
0bd367c
4886d66
 
 
69519e1
4886d66
0bd367c
69519e1
 
 
0bd367c
 
69519e1
 
 
0bd367c
 
4886d66
 
0bd367c
69519e1
0bd367c
 
 
 
 
4886d66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0bd367c
 
 
 
 
 
 
 
 
 
 
 
9325762
 
 
 
 
 
 
 
 
 
 
 
 
0bd367c
9325762
 
0bd367c
 
9325762
 
 
 
 
 
 
0bd367c
 
4016fcc
8433b75
 
3e0b288
 
 
 
 
 
8433b75
3e0b288
 
 
 
 
 
 
 
4016fcc
 
8433b75
fb7d3dc
8433b75
3e0b288
 
8433b75
 
 
3e0b288
8433b75
3e0b288
4016fcc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0bd367c
 
 
 
 
ba807db
d390af3
7e01f7a
 
89ce8a2
fb7d3dc
 
 
 
 
 
8433b75
 
d390af3
7e01f7a
8433b75
fb7d3dc
8433b75
 
 
 
 
 
 
369729c
0bd367c
369729c
 
fff20b8
369729c
0bd367c
 
 
369729c
 
fff20b8
369729c
0bd367c
369729c
0bd367c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4886d66
ba807db
4886d66
ba807db
69519e1
4886d66
 
 
 
 
69519e1
 
 
 
 
 
4886d66
 
69519e1
 
4886d66
 
69519e1
 
4886d66
 
69519e1
 
 
 
 
369729c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69519e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4886d66
 
 
 
 
 
69519e1
4886d66
 
 
69519e1
4886d66
 
 
69519e1
 
 
 
4886d66
 
 
 
 
 
69519e1
4886d66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0bd367c
fff20b8
4886d66
fff20b8
4886d66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d390af3
0bd367c
d390af3
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565

class RabbitHole {
    constructor() {
        this.titleEl = document.getElementById('title');
        this.extractEl = document.getElementById('extract');
        this.metaEl = document.getElementById('meta');
        this.errorEl = document.getElementById('error');
        this.progressBar = document.getElementById('progress-bar');
        this.card = document.getElementById('card');
        this.enterBtn = document.getElementById('enter');
        this.currentTitle = null;
        this.outgoingLinks = [];
        this.started = false;
        this.startX = null;
        this.history = [];
        this.currentIndex = -1;
        this.insights = [];
        this.swipeCount = 0;
        this.analytics = {
totalArticles: 0,
            totalTime: 0,
            categories: {},
            startTime: Date.now()
        };
        this.welcomeSteps = [
            {
                title: "Welcome to DondlingerGC's RabbitHole",
                extract: "Swipe to continue the introduction...",
                meta: "πŸ‡ Enter the Rabbit Hole"
            },
            {
                title: "The Only Truly Random Online Information",
                extract: "Experience the internet's most unpredictable journey through knowledge",
                meta: "🎲 Pure Randomness"
            },
            {
                title: "Swipe Right β†’ Follow Related Articles",
                extract: "Dive deeper into connected topics and discover meaningful connections",
                meta: "πŸ”— Connected Knowledge"
            },
            {
                title: "Swipe Left ← Jump to Random Articles",
                extract: "Explore completely unexpected topics and broaden your horizons",
                meta: "🌍 Unexpected Discoveries"
            },
            {
                title: "Ready to Explore?",
                extract: "Begin your journey through the infinite knowledge universe",
                meta: "πŸš€ Start Your Adventure"
            }
        ];
        this.currentStep = 0;
this.init();
    }
    init() {
        this.createParticles();
        this.bindEvents();
        this.startAnalytics();
        this.startWelcomeSequence();
    }
createParticles() {
        const container = document.getElementById('particles');
        for (let i = 0; i < 20; i++) {
            const particle = document.createElement('div');
            particle.className = 'particle';
            particle.style.width = Math.random() * 4 + 1 + 'px';
            particle.style.height = particle.style.width;
            particle.style.left = Math.random() * 100 + '%';
            particle.style.top = Math.random() * 100 + '%';
            particle.style.animationDelay = Math.random() * 20 + 's';
            particle.style.animationDuration = (Math.random() * 10 + 15) + 's';
            container.appendChild(particle);
        }
    }
    bindEvents() {
        this.enterBtn.addEventListener('click', () => this.startExperience());
        document.getElementById('arrow-right').addEventListener('click', () => this.handleArrowRight());
        document.getElementById('arrow-left').addEventListener('click', () => this.handleArrowLeft());

        // Enhanced touch handling for welcome sequence
        document.addEventListener('touchstart', e => {
            this.startX = e.touches[0].clientX;
        }, { passive: true });

        document.addEventListener('touchend', e => {
            if (this.startX === null) return;
            const dx = e.changedTouches[0].clientX - this.startX;
            this.startX = null;

            if (!this.started) {
                // Handle welcome sequence swipes
                if (Math.abs(dx) > 60) {
                    this.nextWelcomeStep();
                }
                return;
            }
            
            if (dx < -60) {
                this.swipeCount++;
                this.fetchLinkedArticle();
            }
            if (dx > 60) {
                this.swipeCount++;
                this.fetchRandomArticle();
            }
        });

        // Keyboard navigation for welcome sequence
        document.addEventListener('keydown', e => {
            if (!this.started && (e.key === 'ArrowLeft' || e.key === 'ArrowRight')) {
                this.nextWelcomeStep();
                return;
            }
            if (!this.started) return;
            if (e.key === 'ArrowLeft') this.fetchLinkedArticle();
            if (e.key === 'ArrowRight') this.fetchRandomArticle();
        });
    }

    showAuthModal() {
        // Removed auth modal functionality
    }
animateEntrance() {
        setTimeout(() => {
            this.card.classList.add('fade-in');
        }, 100);
    }

    showError(msg) {
        this.errorEl.textContent = msg;
        this.errorEl.classList.add('fade-in');
        setTimeout(() => {
            this.errorEl.classList.remove('fade-in');
        }, 3000);
    }

    clearError() {
        this.errorEl.textContent = '';
    }
    async fetchRandomArticle() {
        try {
            // Check if we should show ad
            if (this.swipeCount > 0 && this.swipeCount % 5 === 0) {
                await this.showAdvertisement();
            }
            
            this.setLoading(true);
            this.clearError();
            // Show rabbit animation every 5 swipes
            if (this.swipeCount % 5 === 0) {
                this.showRabbitAnimation();
            }
const res = await fetch(
                'https://en.wikipedia.org/w/api.php?action=query&format=json&origin=*&generator=random&grnnamespace=0&prop=extracts|description|info&exintro=1&explaintext=1&inprop=url'
            );
            const data = await res.json();
            const pages = data.query.pages;
            const page = pages[Object.keys(pages)[0]];
            await this.loadArticleFromActionAPI(page);
            this.addToHistory(page);
            setTimeout(() => this.animateContent('slide-in-left'), 100);
        } catch (e) {
            this.showError('Connection unstable. Try again.');
        } finally {
            this.setLoading(false);
        }
    }
    async fetchLinkedArticle() {
        if (!this.outgoingLinks.length) return this.fetchRandomArticle();
        const next = this.outgoingLinks[Math.floor(Math.random() * this.outgoingLinks.length)];
        try {
            // Check if we should show ad
            if (this.swipeCount > 0 && this.swipeCount % 5 === 0) {
                await this.showAdvertisement();
            }
            
            this.setLoading(true);
            this.clearError();
            // Show rabbit animation every 5 swipes
            if (this.swipeCount % 5 === 0) {
                this.showRabbitAnimation();
            }
const res = await fetch(
                `https://en.wikipedia.org/w/api.php?action=query&format=json&origin=*&titles=${encodeURIComponent(next)}&prop=extracts|description|info&exintro=1&explaintext=1&inprop=url`
            );
            const data = await res.json();
            const pages = data.query.pages;
            const page = pages[Object.keys(pages)[0]];
            await this.loadArticleFromActionAPI(page);
            this.addToHistory(page);
            setTimeout(() => this.animateContent('slide-in-right'), 100);
        } catch (e) {
            this.showError('Failed to follow link. Try again.');
        } finally {
            this.setLoading(false);
        }
    }
async fetchLinks(title) {
        try {
            const url = `https://en.wikipedia.org/w/api.php?action=query&format=json&origin=*&prop=links&pllimit=50&titles=${encodeURIComponent(title)}`;
            const res = await fetch(url);
            const data = await res.json();
            const pages = data.query.pages;
            const page = pages[Object.keys(pages)[0]];
            if (!page.links) return [];
            return page.links.map(l => l.title).filter(t => !t.includes(':'));
        } catch {
            return [];
        }
    }
    async loadArticleFromActionAPI(page) {
        this.currentTitle = page.title;
        this.titleEl.textContent = page.title;
        this.extractEl.textContent = page.extract || 'No summary available.';
        
        // Generate AI-powered insights
        await this.generateInsights(page);
        
        // Update meta tags with clean, accurate data
        const linkCount = this.outgoingLinks.length;
        this.metaEl.innerHTML = `
            <span class="meta-tag">πŸ“š ${page.description || 'Wikipedia Article'}</span>
            <span class="meta-tag">πŸ”— ${linkCount} Connections</span>
            ${this.insights.length > 0 ? `<span class="meta-tag">🧠 ${this.insights.length} Insights</span>` : ''}
        `;
        
        // Set dynamic background based on content
        this.setContentBackground(page);
        
        this.outgoingLinks = await this.fetchLinks(this.currentTitle);
        this.updateProgress();
        this.saveToHistory(page);
        this.trackAnalytics(page);
    }
addToHistory(page) {
        this.history = this.history.slice(0, this.currentIndex + 1);
        this.history.push(page);
        this.currentIndex = this.history.length - 1;
    }

    saveToHistory(page) {
        const historyItem = {
            title: page.title,
            extract: page.extract?.substring(0, 200) + '...',
            url: page.fullurl,
            timestamp: Date.now(),
            insights: this.insights
        };
        
        let history = JSON.parse(localStorage.getItem('quantum_journey_history') || '[]');
        history.unshift(historyItem);
        history = history.slice(0, 100); // Keep last 100 items
        localStorage.setItem('quantum_journey_history', JSON.stringify(history));
    }
updateProgress() {
        const progress = ((this.currentIndex + 1) / Math.max(this.history.length, 1)) * 100;
        this.progressBar.style.width = progress + '%';
    }

    setLoading(loading) {
        if (loading) {
            this.card.classList.add('loading');
        } else {
            this.card.classList.remove('loading');
        }
    }
    animateContent(animationClass) {
        // Create transition overlay
        let overlay = document.querySelector('.transition-overlay');
        if (!overlay) {
            overlay = document.createElement('div');
            overlay.className = 'transition-overlay';
            document.body.appendChild(overlay);
        }
        
        // Start transition
        overlay.classList.add('active');
        this.card.classList.add('transitioning');
        
        // Remove previous animations
        this.card.classList.remove('slide-in-left', 'slide-in-right');
        
        // Add new animation after a small delay
        setTimeout(() => {
            this.card.classList.add(animationClass);
            
            // Clean up after animation completes
            setTimeout(() => {
                this.card.classList.remove('transitioning');
                overlay.classList.remove('active');
                this.card.classList.remove('slide-in-left', 'slide-in-right');
            }, 600);
        }, 50);
    }
    startWelcomeSequence() {
        // Hide rabbit animation after video completes
        const video = document.getElementById('rabbit-video');
        const rabbitAnimation = document.getElementById('rabbit-animation');
        
        // Clear any existing event listeners
        video.onended = null;
        
        // Add new event listener
        video.addEventListener('ended', () => {
            rabbitAnimation.style.display = 'none';
            this.card.style.display = 'flex';
            this.showWelcomeStep(0);
        });
        // Force video to play and ensure it ends properly
        video.play().catch(() => {
            // If video fails to play, use fallback
            rabbitAnimation.style.display = 'none';
            this.card.style.display = 'flex';
            this.showWelcomeStep(0);
        });
// Fallback in case video doesn't fire ended event
        setTimeout(() => {
            if (rabbitAnimation.style.display !== 'none') {
                rabbitAnimation.style.display = 'none';
                this.card.style.display = 'flex';
                this.showWelcomeStep(0);
            }
        }, 3000);
}
showWelcomeStep(stepIndex) {
        this.currentStep = stepIndex;
        const step = this.welcomeSteps[stepIndex];
        
        this.titleEl.textContent = step.title;
        this.extractEl.textContent = step.extract;
        this.metaEl.innerHTML = `<span class="meta-tag">${step.meta}</span>`;
        
        // Show start button on last step
        if (stepIndex === this.welcomeSteps.length - 1) {
            this.enterBtn.style.display = 'block';
        } else {
            this.enterBtn.style.display = 'none';
        }
        
        this.animateContent('slide-in-left');
    }

    nextWelcomeStep() {
        if (this.currentStep < this.welcomeSteps.length - 1) {
            this.showWelcomeStep(this.currentStep + 1);
        }
    }
    startExperience() {
        if (this.started) return;
        this.started = true;
        this.card.setAttribute('data-state', 'exploring');
        this.fetchRandomArticle();
    }
showRabbitAnimation() {
        const rabbitAnim = document.getElementById('rabbit-animation');
        const video = document.getElementById('rabbit-video');
        
        rabbitAnim.style.display = 'flex';
        video.currentTime = 0;
        video.play().catch(() => {
            // If video fails to play, hide animation immediately
            rabbitAnim.style.display = 'none';
        });
        
        // Remove the animation after video completes
        video.addEventListener('ended', () => {
            rabbitAnim.style.display = 'none';
            video.currentTime = 0;
        });
// Fallback timeout in case video doesn't fire ended event
        setTimeout(() => {
            if (rabbitAnim.style.display !== 'none') {
                rabbitAnim.style.display = 'none';
                video.currentTime = 0;
            }
        }, 3000);
}
    handleArrowRight() {
        if (!this.started) this.startExperience();
        else {
            this.swipeCount++;
            this.fetchRandomArticle();
        }
    }

    handleArrowLeft() {
        if (this.started) {
            this.swipeCount++;
            this.fetchLinkedArticle();
        }
    }
shareExperience() {
        if (navigator.share) {
            navigator.share({
                title: 'QuantumRabbitHole Explorer',
                text: `Exploring "${this.currentTitle || 'the quantum universe'}" on QuantumRabbitHole`,
                url: window.location.href
            }).catch(() => {
                this.copyToClipboard();
            });
        } else {
            this.copyToClipboard();
        }
    }
    copyToClipboard() {
        const text = `Exploring "${this.currentTitle || 'the quantum universe'}" on QuantumRabbitHole: ${window.location.href}`;
        navigator.clipboard.writeText(text).then(() => {
            this.showError('Link copied to clipboard!');
        });
    }
    loadUser() {
        // Removed user loading functionality
    }
async generateInsights(page) {
        // Clean, meaningful insights based on actual content
        this.insights = [];
        
        if (page.extract) {
            const text = page.extract.toLowerCase();
            
            if (text.includes('quantum') || text.includes('physics') || text.includes('science')) {
                this.insights.push('πŸ”¬ Scientific content - explore related scientific concepts');
            }
            
            if (text.includes('technology') || text.includes('computer') || text.includes('digital')) {
                this.insights.push('πŸ’» Technology focus - discover technological advancements');
            }
            
            if (text.includes('history') || text.includes('historical') || text.includes('ancient')) {
                this.insights.push('πŸ“œ Historical context - explore historical timelines');
            }
            
            if (text.includes('art') || text.includes('music') || text.includes('culture')) {
                this.insights.push('🎨 Cultural significance - discover artistic connections');
            }
            
            if (text.includes('nature') || text.includes('environment') || text.includes('earth')) {
                this.insights.push('🌿 Natural world - explore environmental topics');
            }
        }
    }

    async showAdvertisement() {
        return new Promise((resolve) => {
            const adOverlay = document.createElement('div');
            adOverlay.className = 'ad-overlay';
            adOverlay.innerHTML = `
                <div class="ad-content">
                    <div class="ad-header">
                        <span class="ad-badge">Sponsored</span>
                        <button class="ad-close">&times;</button>
                    </div>
                    <div class="ad-body">
                        <img src="https://static.photos/technology/320x240/42" alt="Advertisement" class="ad-image">
                        <h3 class="ad-title">Discover More with Quantum Explorer</h3>
                        <p class="ad-description">Unlock premium features and ad-free experience with our Pro plan!</p>
                        <button class="ad-cta">Learn More</button>
                    </div>
                </div>
            `;
            
            document.body.appendChild(adOverlay);
            
            const closeAd = () => {
                adOverlay.classList.add('fade-out');
                setTimeout(() => {
                    document.body.removeChild(adOverlay);
                    resolve();
                }, 300);
            };
            
            adOverlay.querySelector('.ad-close').addEventListener('click', closeAd);
            adOverlay.querySelector('.ad-cta').addEventListener('click', () => {
                window.open('https://example.com/pro-plan', '_blank');
                closeAd();
            });
            
            // Auto-close after 5 seconds
            setTimeout(closeAd, 5000);
        });
    }
setContentBackground(page) {
        const text = page.extract?.toLowerCase() || '';
        const card = document.getElementById('card');
        
        // Remove previous background classes
        card.classList.remove('bg-science', 'bg-history', 'bg-art', 'bg-technology', 'bg-nature', 'bg-default');
        
        // Set appropriate background based on content
        if (text.includes('science') || text.includes('physics') || text.includes('chemistry')) {
            card.classList.add('bg-science');
        } else if (text.includes('history') || text.includes('historical') || text.includes('war')) {
            card.classList.add('bg-history');
        } else if (text.includes('art') || text.includes('music') || text.includes('culture')) {
            card.classList.add('bg-art');
        } else if (text.includes('technology') || text.includes('computer') || text.includes('digital')) {
            card.classList.add('bg-technology');
        } else if (text.includes('nature') || text.includes('environment') || text.includes('earth')) {
            card.classList.add('bg-nature');
        } else {
            card.classList.add('bg-default');
        }
    }

    trackAnalytics(page) {
        this.analytics.totalArticles++;
        
        // Track categories based on content
        const text = page.extract?.toLowerCase() || '';
        if (text.includes('science') || text.includes('physics') || text.includes('chemistry')) {
            this.analytics.categories.science = (this.analytics.categories.science || 0) + 1;
        } else if (text.includes('history') || text.includes('historical') || text.includes('war')) {
            this.analytics.categories.history = (this.analytics.categories.history || 0) + 1;
        } else if (text.includes('art') || text.includes('music') || text.includes('culture')) {
            this.analytics.categories.arts = (this.analytics.categories.arts || 0) + 1;
        } else if (text.includes('technology') || text.includes('computer') || text.includes('digital')) {
            this.analytics.categories.technology = (this.analytics.categories.technology || 0) + 1;
        } else if (text.includes('nature') || text.includes('environment') || text.includes('earth')) {
            this.analytics.categories.nature = (this.analytics.categories.nature || 0) + 1;
        } else {
            this.analytics.categories.other = (this.analytics.categories.other || 0) + 1;
        }
        
        localStorage.setItem('quantum_analytics', JSON.stringify(this.analytics));
    }
startAnalytics() {
        this.analytics.startTime = Date.now();
        setInterval(() => {
            this.analytics.totalTime += 1;
        }, 1000);
    }

    getStats() {
        return {
            totalArticles: this.analytics.totalArticles,
            totalTime: this.analytics.totalTime,
            categories: this.analytics.categories,
            averageTimePerArticle: this.analytics.totalArticles > 0 ? 
                Math.round(this.analytics.totalTime / this.analytics.totalArticles) : 0
        };
    }
}
        // Enhanced event handling for new components
document.addEventListener('DOMContentLoaded', () => {
    const quantumApp = new RabbitHole();
    // Handle user profile events
    document.addEventListener('show-history', () => {
        const historyModal = document.createElement('history-modal');
        document.body.appendChild(historyModal);
        historyModal.show();
        historyModal.addEventListener('load-article', (e) => {
            quantumApp.loadArticleFromActionAPI(e.detail);
        });
    });
    
    document.addEventListener('show-stats', () => {
        const stats = quantumApp.getStats();
        quantumApp.showError(`Stats: ${stats.totalArticles} articles, ${Math.round(stats.totalTime/60)} minutes explored`);
    });
});
// Initialize the rabbit hole experience
document.addEventListener('DOMContentLoaded', () => {
    new RabbitHole();
});