MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
AdminIsidore (talk | contribs)
No edit summary
AdminIsidore (talk | contribs)
No edit summary
Line 8: Line 8:
     }
     }
} );
} );
// Append SVG filter for parchment effect to the body
 
$(function() {
/* Vulgate */
     var svgFilter = '<svg style="position:absolute; height:0; width:0;">' +
// Function to resize parchment backgrounds to match content height
                      '<filter id="wavy2">' +
function resizeParchments() {
                        '<feTurbulence x="0" y="0" baseFrequency="0.015" numOctaves="5" seed="1" />' +
  var containers = document.querySelectorAll('.vulgate-container');
                        '<feDisplacementMap in="SourceGraphic" scale="15" />' +
  containers.forEach(function(container) {
                      '</filter>' +
     var content = container.querySelector('.vulgate-content');
                    '</svg>';
    var parchment = container.querySelector('.vulgate-parchment');
    $('body').append(svgFilter);
    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);