- Contents in this wiki are for entertainment purposes only
MediaWiki:Common.js
Jump to navigation
Jump to search
Note: After publishing, 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: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
// Load Mermaid.js from CDN
mw.loader.load('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js', null, true);
// Initialize Mermaid after the page content is loaded
mw.hook('wikipage.content').add(function() {
// Check if mermaid is defined before attempting to initialize
if (typeof mermaid !== 'undefined') {
mermaid.initialize({ startOnLoad: true });
} else {
// Fallback for slower loads or specific scenarios
// (Optional: You might remove this if the above is reliable)
setTimeout(function() {
if (typeof mermaid !== 'undefined') {
mermaid.initialize({ startOnLoad: true });
}
}, 500); // Wait 0.5 seconds and try again
}
});