MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
AdminIsidore (talk | contribs) No edit summary |
AdminIsidore (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
} | } | ||
} ); | } ); | ||
/* 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'; | |||
} | |||
}); | |||
} | |||
// Appends the SVG filter needed for the wavy edge effect | |||
function addParchmentFilter() { | |||
var svgFilter = '<svg style="position:absolute; height:0; width:0;">' + | |||
'<filter id="wavy2">' + | |||
'<feTurbulence x="0" y="0" baseFrequency="0.015" numOctaves="5" seed="1" />' + | |||
'<feDisplacementMap in="SourceGraphic" scale="15" />' + | |||
'</filter>' + | |||
'</svg>'; | |||
$('body').append(svgFilter); | |||
} | |||
// Run functions on page load and resize | |||
$(document).ready(function() { | |||
addParchmentFilter(); | |||
resizeParchments(); | |||
}); | |||
$(window).on('resize', resizeParchments); |
Latest revision as of 21:55, 4 September 2025
/* 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';
}
});
}
// Appends the SVG filter needed for the wavy edge effect
function addParchmentFilter() {
var svgFilter = '<svg style="position:absolute; height:0; width:0;">' +
'<filter id="wavy2">' +
'<feTurbulence x="0" y="0" baseFrequency="0.015" numOctaves="5" seed="1" />' +
'<feDisplacementMap in="SourceGraphic" scale="15" />' +
'</filter>' +
'</svg>';
$('body').append(svgFilter);
}
// Run functions on page load and resize
$(document).ready(function() {
addParchmentFilter();
resizeParchments();
});
$(window).on('resize', resizeParchments);