MediaWiki:Common.js: различия между версиями

мНет описания правки
мНет описания правки
Строка 402: Строка 402:


                 cells.forEach(function(cell, index) {
                 cells.forEach(function(cell, index) {
                     if (!cell.hasAttribute('rowspan') || cell.getAttribute('rowspan') === '1') {
                     var rowspan = parseInt(cell.getAttribute('rowspan'), 10);
                        cell.addEventListener('mouseover', function() {
                    if (!isNaN(rowspan) && rowspan > 1) return; // Игнорируем ячейки с rowspan > 1
                            cells.forEach(function(innerCell, innerIndex) {
 
                                if (!innerCell.hasAttribute('rowspan') || innerCell.getAttribute('rowspan') === '1') {
                    cell.addEventListener('mouseover', function() {
                                    innerCell.style.setProperty('background-color', brightenColor(originalStyles[innerIndex].backgroundColor), 'important');
                        cells.forEach(function(innerCell, innerIndex) {
                                    innerCell.style.setProperty('color', brightenColor(originalStyles[innerIndex].color), 'important');
                            var innerRowspan = parseInt(innerCell.getAttribute('rowspan'), 10);
                                }
                            if (!isNaN(innerRowspan) && innerRowspan > 1) return; // Игнорируем подсветку для ячеек с rowspan
                            });
 
                            innerCell.style.setProperty('background-color', brightenColor(originalStyles[innerIndex].backgroundColor), 'important');
                            innerCell.style.setProperty('color', brightenColor(originalStyles[innerIndex].color), 'important');
                         });
                         });
                        cell.addEventListener('mouseout', function() {
                    });
                            cells.forEach(function(innerCell, innerIndex) {
 
                                if (!innerCell.hasAttribute('rowspan') || innerCell.getAttribute('rowspan') === '1') {
                    cell.addEventListener('mouseout', function() {
                                    innerCell.style.setProperty('background-color', originalStyles[innerIndex].backgroundColor, 'important');
                        cells.forEach(function(innerCell, innerIndex) {
                                    innerCell.style.setProperty('color', originalStyles[innerIndex].color, 'important');
                            var innerRowspan = parseInt(innerCell.getAttribute('rowspan'), 10);
                                }
                            if (!isNaN(innerRowspan) && innerRowspan > 1) return; // Игнорируем сброс стилей для ячеек с rowspan
                            });
 
                            innerCell.style.setProperty('background-color', originalStyles[innerIndex].backgroundColor, 'important');
                            innerCell.style.setProperty('color', originalStyles[innerIndex].color, 'important');
                         });
                         });
                     }
                     });
                 });
                 });
             });
             });