Anonymous

MediaWiki:Common.js: Difference between revisions

From Melvor Idle
replace string literals
mNo edit summary
(replace string literals)
Line 3: Line 3:
/* Sets the top property for stickyHeader tables */
/* Sets the top property for stickyHeader tables */


$(document).ready(function() {
$(document).ready(function () {
   const stickyTables = document.getElementsByClassName('stickyHeader');
   const stickyTables = document.getElementsByClassName('stickyHeader');
   const headHeight = document.getElementById('mw-header-container').offsetHeight;
   const headHeight = document.getElementById('mw-header-container').offsetHeight;
Line 14: Line 14:
       const firstHeaders = firstRow[0].getElementsByTagName('th');
       const firstHeaders = firstRow[0].getElementsByTagName('th');
       for (var j = 0; j < firstHeaders.length; j++) {
       for (var j = 0; j < firstHeaders.length; j++) {
         firstHeaders[j].style.top = `${headHeight}px`;
         firstHeaders[j].style.top = headHeight + 'px';
       }
       }
       if (secondRow.length > 0) {
       if (secondRow.length > 0) {
         const secondHeaders = secondRow[0].getElementsByTagName('th');
         const secondHeaders = secondRow[0].getElementsByTagName('th');
        var secondHeight = headHeight + firstHeight;
         for (var j = 0; j < secondHeaders.length; j++) {
         for (var j = 0; j < secondHeaders.length; j++) {
           secondHeaders[j].style.top = `${headHeight + firstHeight}px`;
           secondHeaders[j].style.top = secondHeight + 'px';
         }
         }
       }
       }