Difference between revisions of "MediaWiki:Common.js"
(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...") |
(adding a bot to the site) |
||
| Line 1: | Line 1: | ||
| − | + | ||
| − | + | /* M'adrono Chat Widget for Talmido - Fixed Version */ | |
mw.loader.using(['mediawiki.util'], function() { | mw.loader.using(['mediawiki.util'], function() { | ||
$(document).ready(function() { | $(document).ready(function() { | ||
| − | |||
| − | |||
| − | |||
const script = document.createElement('script'); | const script = document.createElement('script'); | ||
script.src = "https://storage.googleapis.com/creatorsagi-scripts/creatorsagi-widget.min.js"; | script.src = "https://storage.googleapis.com/creatorsagi-scripts/creatorsagi-widget.min.js"; | ||
| Line 19: | Line 16: | ||
document.body.appendChild(script); | 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 | ||
| + | }; | ||
}); | }); | ||
}); | }); | ||
Revision as of 23:48, 27 October 2025
/* M'adrono Chat Widget for Talmido - Fixed Version */
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
};
});
});