MediaWiki:Common.js

From IxWiki
Revision as of 14:26, 2 January 2025 by Heku (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.
mw.hook('wikipage.content').add(function ($content) {
  // Check if the ix-time-display element exists
  if (document.getElementById('ix-time-display')) {
    // If it exists, manually trigger the script
    var script = document.createElement('script');
    script.textContent = document.querySelector('#ix-time-display + script').textContent;
    document.body.appendChild(script);
  }
});


mw.hook('wikipage.content').add(function ($content) {
  $content.find('script').each(function() {
    if (this.textContent.includes('convertToIxTime')) {
      eval(this.textContent);
    }
  });
});