MediaWiki:Common.js: Difference between revisions

From Helix Project Wiki
No edit summary
No edit summary
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 (ES5 Compatible)
// Helix Project - Wiki Chat Bubble Debug Version
console.log('=== Helix Wiki Chat Bubble Debug ===');
 
// Test if script is loading
console.log('MediaWiki:Common.js is loading...');
 
window.addEventListener('load', function() {
window.addEventListener('load', function() {
     console.log('Loading Helix Wiki Chat Bubble...');
     console.log('Window load event fired');
      
      
     // Simple, reliable chat bubble for wiki
     // Create chat bubble with very obvious styling
     var chatBubble = document.createElement('div');
     var chatBubble = document.createElement('div');
     chatBubble.innerHTML = '💬 Wiki Help';
     chatBubble.innerHTML = '💬 WIKI CHAT DEBUG';
     chatBubble.id = 'helix-wiki-chat-bubble';
     chatBubble.id = 'helix-wiki-chat-bubble';
      
      
     // Set styles individually (ES5 compatible)
     // Make it impossible to miss
     chatBubble.style.position = 'fixed';
     chatBubble.style.position = 'fixed';
     chatBubble.style.bottom = '20px';
     chatBubble.style.bottom = '20px';
     chatBubble.style.right = '20px';
     chatBubble.style.right = '20px';
     chatBubble.style.background = '#007cba';
     chatBubble.style.background = 'red';
     chatBubble.style.color = 'white';
     chatBubble.style.color = 'white';
     chatBubble.style.padding = '12px 18px';
     chatBubble.style.padding = '15px';
     chatBubble.style.borderRadius = '20px';
     chatBubble.style.borderRadius = '10px';
     chatBubble.style.cursor = 'pointer';
     chatBubble.style.cursor = 'pointer';
     chatBubble.style.zIndex = '1000';
     chatBubble.style.zIndex = '999999';
    chatBubble.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
     chatBubble.style.fontSize = '16px';
    chatBubble.style.fontFamily = 'sans-serif';
     chatBubble.style.fontSize = '14px';
     chatBubble.style.fontWeight = 'bold';
     chatBubble.style.fontWeight = 'bold';
    chatBubble.style.border = '3px solid yellow';
      
      
     // Simple click action - go to wiki help
     // Simple click action
     chatBubble.onclick = function() {
     chatBubble.onclick = function() {
         window.location.href = '/wiki/Help:Contents';
         alert('Wiki chat bubble clicked!');
    };
   
    // 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)';
     };
     };
      
      
    // Try to append to body
    console.log('Attempting to append chat bubble to body...');
     document.body.appendChild(chatBubble);
     document.body.appendChild(chatBubble);
     console.log('Helix Wiki Chat Bubble added successfully');
     console.log('Chat bubble appended to body');
      
      
     // Optional: Keep your existing Chatbase integration
     // Verify it's actually in the DOM
     var script = document.createElement('script');
     var checkBubble = document.getElementById('helix-wiki-chat-bubble');
     script.src = 'https://www.chatbase.co/embed.min.js';
     if (checkBubble) {
    script.setAttribute('chatbotId', 'i65eBj3COxUlFEU_Lsrw0');
        console.log('✅ Chat bubble found in DOM');
     script.setAttribute('domain', 'www.chatbase.co');
     } else {
     script.defer = true;
        console.log('❌ Chat bubble NOT found in DOM');
    document.body.appendChild(script);
     }
});
});
// Also try without waiting for load
console.log('Creating immediate chat bubble...');
var immediateBubble = document.createElement('div');
immediateBubble.innerHTML = 'IMMEDIATE BUBBLE';
immediateBubble.style.cssText = 'position:fixed;top:20px;right:20px;background:green;color:white;padding:10px;z-index:999999;';
document.body.appendChild(immediateBubble);
console.log('Immediate bubble added');

Revision as of 11:50, 7 October 2025

/* Any JavaScript here will be loaded for all users on every page load. */
// Helix Project - Wiki Chat Bubble Debug Version
console.log('=== Helix Wiki Chat Bubble Debug ===');

// Test if script is loading
console.log('MediaWiki:Common.js is loading...');

window.addEventListener('load', function() {
    console.log('Window load event fired');
    
    // Create chat bubble with very obvious styling
    var chatBubble = document.createElement('div');
    chatBubble.innerHTML = '💬 WIKI CHAT DEBUG';
    chatBubble.id = 'helix-wiki-chat-bubble';
    
    // Make it impossible to miss
    chatBubble.style.position = 'fixed';
    chatBubble.style.bottom = '20px';
    chatBubble.style.right = '20px';
    chatBubble.style.background = 'red';
    chatBubble.style.color = 'white';
    chatBubble.style.padding = '15px';
    chatBubble.style.borderRadius = '10px';
    chatBubble.style.cursor = 'pointer';
    chatBubble.style.zIndex = '999999';
    chatBubble.style.fontSize = '16px';
    chatBubble.style.fontWeight = 'bold';
    chatBubble.style.border = '3px solid yellow';
    
    // Simple click action
    chatBubble.onclick = function() {
        alert('Wiki chat bubble clicked!');
    };
    
    // Try to append to body
    console.log('Attempting to append chat bubble to body...');
    document.body.appendChild(chatBubble);
    console.log('Chat bubble appended to body');
    
    // Verify it's actually in the DOM
    var checkBubble = document.getElementById('helix-wiki-chat-bubble');
    if (checkBubble) {
        console.log('✅ Chat bubble found in DOM');
    } else {
        console.log('❌ Chat bubble NOT found in DOM');
    }
});

// Also try without waiting for load
console.log('Creating immediate chat bubble...');
var immediateBubble = document.createElement('div');
immediateBubble.innerHTML = 'IMMEDIATE BUBBLE';
immediateBubble.style.cssText = 'position:fixed;top:20px;right:20px;background:green;color:white;padding:10px;z-index:999999;';
document.body.appendChild(immediateBubble);
console.log('Immediate bubble added');