MediaWiki:Common.js

From OODA WIKI
Revision as of 21:44, 4 September 2025 by AdminIsidore (talk | contribs)
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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
// Force the glossary and music creation forms to open in a new tab
$( function() {
    // This selector targets both form containers by their ID
    var $formContainer = $( '#new-term-form, #new-concept-form' );
    if ( $formContainer.length ) {
        $formContainer.find( 'form' ).attr( 'target', '_blank' );
    }
} );

/* Vulgate */
// Function to resize parchment backgrounds to match content height
function resizeParchments() {
  var containers = document.querySelectorAll('.vulgate-container');
  containers.forEach(function(container) {
    var content = container.querySelector('.vulgate-content');
    var parchment = container.querySelector('.vulgate-parchment');
    if (content && parchment) {
      parchment.style.height = content.offsetHeight + 'px';
    }
  });
}

// Run on initial page load and after any window resizing
$(document).ready(resizeParchments);
$(window).on('resize', resizeParchments);