|
|
| Line 1: |
Line 1: |
| /* Any JavaScript here will be loaded for all users on every page load. */ | | /* Any JavaScript here will be loaded for all users on every page load. */ |
| // Helix Project - Wiki Chat Bubble (Working Version) | | // Helix Project - Chatbase Integration Only |
| console.log('Helix Wiki Chat Bubble: Script loading...'); | | console.log('Loading Helix Chatbase integration...'); |
|
| |
|
| // Create chat bubble immediately, don't wait for load | | // Only load Chatbase - remove custom chat bubble code |
| function createChatBubble() {
| |
| console.log('Creating chat bubble...');
| |
|
| |
| // Remove any existing bubble first
| |
| var existingBubble = document.getElementById('helix-wiki-chat-bubble');
| |
| if (existingBubble) {
| |
| existingBubble.parentNode.removeChild(existingBubble);
| |
| }
| |
|
| |
| // Create new bubble
| |
| var chatBubble = document.createElement('div');
| |
| chatBubble.innerHTML = '💬 Wiki Help';
| |
| chatBubble.id = 'helix-wiki-chat-bubble';
| |
|
| |
| // Style it to be visible and in correct position
| |
| chatBubble.style.position = 'fixed';
| |
| chatBubble.style.bottom = '20px';
| |
| chatBubble.style.right = '20px';
| |
| chatBubble.style.background = '#007cba';
| |
| chatBubble.style.color = 'white';
| |
| chatBubble.style.padding = '12px 18px';
| |
| chatBubble.style.borderRadius = '20px';
| |
| chatBubble.style.cursor = 'pointer';
| |
| chatBubble.style.zIndex = '100000'; // Very high z-index
| |
| chatBubble.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
| |
| chatBubble.style.fontFamily = 'sans-serif';
| |
| chatBubble.style.fontSize = '14px';
| |
| chatBubble.style.fontWeight = 'bold';
| |
| chatBubble.style.display = 'block'; // Force display
| |
| chatBubble.style.visibility = 'visible'; // Force visibility
| |
|
| |
| // Simple click action
| |
| chatBubble.onclick = function() {
| |
| window.location.href = '/wiki/Help:Contents';
| |
| };
| |
|
| |
| // Add hover effect
| |
| chatBubble.onmouseover = function() {
| |
| this.style.background = '#005a87';
| |
| this.style.transform = 'scale(1.05)';
| |
| };
| |
|
| |
| chatBubble.onmouseout = function() {
| |
| this.style.background = '#007cba';
| |
| this.style.transform = 'scale(1)';
| |
| };
| |
|
| |
| // Append to body
| |
| document.body.appendChild(chatBubble);
| |
| console.log('Chat bubble created and appended');
| |
|
| |
| // Verify it's visible
| |
| setTimeout(function() {
| |
| var bubble = document.getElementById('helix-wiki-chat-bubble');
| |
| if (bubble) {
| |
| console.log('✅ Chat bubble exists in DOM');
| |
| console.log('Computed style display:', window.getComputedStyle(bubble).display);
| |
| console.log('Computed style visibility:', window.getComputedStyle(bubble).visibility);
| |
| } else {
| |
| console.log('❌ Chat bubble not found in DOM');
| |
| }
| |
| }, 100);
| |
| }
| |
| | |
| // Try multiple ways to ensure the bubble gets created
| |
| | |
| // 1. Try immediately
| |
| createChatBubble();
| |
| | |
| // 2. Also try on DOMContentLoaded as backup
| |
| document.addEventListener('DOMContentLoaded', createChatBubble);
| |
| | |
| // 3. And try on window.load as another backup
| |
| window.addEventListener('load', createChatBubble);
| |
| | |
| // Keep your Chatbase integration
| |
| var script = document.createElement('script'); | | var script = document.createElement('script'); |
| script.src = 'https://www.chatbase.co/embed.min.js'; | | script.src = 'https://www.chatbase.co/embed.min.js'; |
| Line 87: |
Line 11: |
| document.body.appendChild(script); | | document.body.appendChild(script); |
|
| |
|
| console.log('Helix Wiki Chat Bubble: Setup complete'); | | console.log('Chatbase integration loaded successfully'); |