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

Нет описания правки
Нет описания правки
Строка 371: Строка 371:
                         rowspanCells.push({ cell: cell, rowIndex: rowIndex, rowspan: rowspan });
                         rowspanCells.push({ cell: cell, rowIndex: rowIndex, rowspan: rowspan });


                         // Подсвечиваем строки, которые затрагивает ячейка с rowspan (только один раз)
                         // Подсвечиваем строки, которые затрагивает ячейка с rowspan
                         var isRowspanHighlighted = false;
                         var isRowspanHighlighted = false;
                         cell.addEventListener('mouseover', function() {
                         cell.addEventListener('mouseover', function() {
                             if (!isRowspanHighlighted) {
                             if (!isRowspanHighlighted) {
Строка 393: Строка 394:
                                 if (targetRow) {
                                 if (targetRow) {
                                     Array.from(targetRow.children).forEach(function(targetCell) {
                                     Array.from(targetRow.children).forEach(function(targetCell) {
                                         targetCell.style.setProperty('background-color', getComputedStyle(targetCell).backgroundColor, 'important');
                                         targetCell.style.removeProperty('background-color');
                                         targetCell.style.setProperty('color', getComputedStyle(targetCell).color, 'important');
                                         targetCell.style.removeProperty('color');
                                     });
                                     });
                                 }
                                 }
Строка 421: Строка 422:
                     cell.addEventListener('mouseout', function() {
                     cell.addEventListener('mouseout', function() {
                         cells.forEach(function(innerCell, innerIndex) {
                         cells.forEach(function(innerCell, innerIndex) {
                             innerCell.style.setProperty('background-color', originalStyles[innerIndex].backgroundColor, 'important');
                             innerCell.style.removeProperty('background-color');
                             innerCell.style.setProperty('color', originalStyles[innerIndex].color, 'important');
                             innerCell.style.removeProperty('color');
                         });
                         });


Строка 428: Строка 429:
                         rowspanCells.forEach(function(rowspanCell) {
                         rowspanCells.forEach(function(rowspanCell) {
                             if (rowIndex >= rowspanCell.rowIndex && rowIndex < rowspanCell.rowIndex + rowspanCell.rowspan) {
                             if (rowIndex >= rowspanCell.rowIndex && rowIndex < rowspanCell.rowIndex + rowspanCell.rowspan) {
                                 rowspanCell.cell.style.setProperty('background-color', getComputedStyle(rowspanCell.cell).backgroundColor, 'important');
                                 rowspanCell.cell.style.removeProperty('background-color');
                                 rowspanCell.cell.style.setProperty('color', getComputedStyle(rowspanCell.cell).color, 'important');
                                 rowspanCell.cell.style.removeProperty('color');
                             }
                             }
                         });
                         });