MediaWiki:Common.js

Revision as of 23:37, 27 October 2025 by Thomas (talk | contribs) (Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: →‎M'adrono Chat Widget for Talmido: mw.loader.using(['mediawiki.util'], function() { $(d...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */
 /* M'adrono Chat Widget for Talmido */
  mw.loader.using(['mediawiki.util'], function() {
      $(document).ready(function() {
          // Only load on certain pages if needed, or remove this if statement for all pages
          // if (mw.config.get('wgPageName') === 'Main_Page') { // Example: only on Main Page

          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);

          // Optional: Add console log for debugging
          console.log('M\'adrono widget loaded');

          // }
      });
  });