Difference between revisions of "MediaWiki:Common.js"

(adding a bot to the site)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
/* M'adrono Widget for Talmido - Completely Minimized */
 +
  $(document).ready(function() {
 +
      var script = document.createElement('script');
 +
      script.src = 'https://storage.googleapis.com/creatorsagi-scripts/creatorsagi-widget.min.js';
 +
      script.setAttribute('data-domain', 'ai.talmido.org');
 +
      script.setAttribute('data-dialog-title', 'Ask Madrono... 🙏');
 +
      script.setAttribute('data-mobile-button-text', 'Chat with Madrono');
 +
      script.setAttribute('data-dialog-subtitle', 'Your AI assistant for Malankara Orthodox Sunday School teaching');
 +
      script.setAttribute('data-primary-color', '#1aafe3');
 +
      script.setAttribute('data-placeholder-texts', '["Ask about lesson planning...", "How can I teach children about...", "Need help with Grade..."]');
 +
      // Add onload handler to minimize completely
 +
      script.onload = function() {
 +
          // Wait for widget to initialize
 +
          setTimeout(function() {
 +
              // Find and click the close button to minimize properly
 +
              var closeButton = document.getElementById('dialog-close-btn');
 +
              if (closeButton) {
 +
                  closeButton.click();
 +
              } else {
 +
                  // Fallback method if close button not found
 +
                  var dialogBox = document.getElementById('dialog-box');
 +
                  if (dialogBox) {
 +
                      dialogBox.style.display = 'none';
 +
                  }
 +
                  var circleButton = document.querySelector('.desktop-circle-button');
 +
                  if (circleButton) {
 +
                      circleButton.style.display = 'flex';
 +
                  }
 +
              }
 +
          }, 500); // Wait 500ms for widget to fully load
 +
      };
  
−
/* M'adrono Chat Widget for Talmido - Fixed Version */
+
       document.body.appendChild(script);
−
  mw.loader.using(['mediawiki.util'], function() {
 
−
       $(document).ready(function() {
 
−
          const script = document.createElement('script');
 
−
          script.src = "https://storage.googleapis.com/creatorsagi-scripts/creatorsagi-widget.min.js";
 
−
          script.setAttribute('data-domain', 'ai.talmido.org');
 
−
          script.setAttribute('data-dialog-title', 'Ask M\'adrono... 🙏');
 
−
          script.setAttribute('data-mobile-button-text', 'Chat with M\'adrono');
 
−
          script.setAttribute('data-dialog-subtitle', 'Your AI assistant for Malankara Orthodox Sunday School teaching. Supporting teachers in forming young disciples of Christ 💫');
 
−
          script.setAttribute('data-suggestions', '["Lesson Planning", "Teaching Activities", "Learning Assessment", "Orthodox Doctrine"]');
 
−
          script.setAttribute('data-extended-suggestions', '["Grade Resources", "Liturgical Calendar", "Children Engagement", "Talmido Curriculum"]');
 
−
          script.setAttribute('data-primary-color', '#1aafe3');
 
−
          script.setAttribute('data-placeholder-texts', '["Ask about lesson planning...", "How can I teach children about...", "Need help with Grade..."]');
 
−
 
 
−
          document.body.appendChild(script);
 
−
 
 
−
          // Add CSS fixes after widget loads
 
−
          script.onload = function() {
 
−
              setTimeout(function() {
 
−
                  // Add custom styles to fix button positioning
 
−
                  const style = document.createElement('style');
 
−
                  style.textContent = `
 
−
                      /* Fix widget button positioning */
 
−
                      .creatorsagi-suggestions button,
 
−
                      .creatorsagi-extended-suggestions button {
 
−
                          position: relative !important;
 
−
                          float: none !important;
 
−
                          display: inline-block !important;
 
−
                          margin: 4px !important;
 
−
                      }
 
−
                      .creatorsagi-dialog {
 
−
                          z-index: 999999 !important;
 
−
                      }
 
−
                      /* Reset any MediaWiki interference */
 
−
                      .creatorsagi-widget-container * {
 
−
                          box-sizing: border-box !important;
 
−
                      }
 
−
                  `;
 
−
                  document.head.appendChild(style);
 
−
              }, 1000); // Wait for widget to initialize
 
−
          };
 
−
      });
 
 
   });
 
   });

Latest revision as of 05:06, 28 October 2025

/* M'adrono Widget for Talmido - Completely Minimized */
  $(document).ready(function() {
      var script = document.createElement('script');
      script.src = 'https://storage.googleapis.com/creatorsagi-scripts/creatorsagi-widget.min.js';
      script.setAttribute('data-domain', 'ai.talmido.org');
      script.setAttribute('data-dialog-title', 'Ask Madrono... 🙏');
      script.setAttribute('data-mobile-button-text', 'Chat with Madrono');
      script.setAttribute('data-dialog-subtitle', 'Your AI assistant for Malankara Orthodox Sunday School teaching');
      script.setAttribute('data-primary-color', '#1aafe3');
      script.setAttribute('data-placeholder-texts', '["Ask about lesson planning...", "How can I teach children about...", "Need help with Grade..."]');
      // Add onload handler to minimize completely
      script.onload = function() {
          // Wait for widget to initialize
          setTimeout(function() {
              // Find and click the close button to minimize properly
              var closeButton = document.getElementById('dialog-close-btn');
              if (closeButton) {
                  closeButton.click();
              } else {
                  // Fallback method if close button not found
                  var dialogBox = document.getElementById('dialog-box');
                  if (dialogBox) {
                      dialogBox.style.display = 'none';
                  }
                  var circleButton = document.querySelector('.desktop-circle-button');
                  if (circleButton) {
                      circleButton.style.display = 'flex';
                  }
              }
          }, 500); // Wait 500ms for widget to fully load
      };

      document.body.appendChild(script);
  });