MediaWiki:Common.js: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 362: | Строка 362: | ||
// Пропускаем первую строку, если нет thead и нет класса 'no-header' | // Пропускаем первую строку, если нет thead и нет класса 'no-header' | ||
var topLevelRows = (!thead && !noHeader) ? rows.slice(1) : rows; | var topLevelRows = (!thead && !noHeader) ? rows.slice(1) : rows; | ||
// Объект для хранения оригинальных стилей | // Объект для хранения оригинальных стилей | ||
| Строка 435: | Строка 395: | ||
highlightedCells[cellId] = true; | highlightedCells[cellId] = true; | ||
// Подсвечиваем ячейку | // Подсвечиваем текущую ячейку | ||
cell.style.backgroundColor = brightenColor(getComputedStyle(cell).backgroundColor); | cell.style.backgroundColor = brightenColor(getComputedStyle(cell).backgroundColor); | ||
cell.style.color = brightenColor(getComputedStyle(cell).color); | cell.style.color = brightenColor(getComputedStyle(cell).color); | ||
| Строка 455: | Строка 415: | ||
} | } | ||
// Подсвечиваем все строки | // Подсвечиваем все строки с rowspan в том же столбце | ||
topLevelRows.forEach(function(checkRow, checkRowIndex) { | |||
if ( | if (checkRowIndex === rowIndex) return; | ||
var checkCells = Array.prototype.slice.call(checkRow.querySelectorAll('td, th')); | var checkCells = Array.prototype.slice.call(checkRow.querySelectorAll('td, th')); | ||
var targetCell = checkCells[cellIndex]; | |||
if (targetCell && targetCell.hasAttribute('rowspan')) { | |||
var | var targetCellId = 'row-' + checkRowIndex + '-cell-' + cellIndex; | ||
if (highlightedCells[ | if (!highlightedCells[targetCellId]) { | ||
targetCell.style.backgroundColor = brightenColor(getComputedStyle(targetCell).backgroundColor); | |||
targetCell.style.color = brightenColor(getComputedStyle(targetCell).color); | |||
highlightedCells[targetCellId] = true; | |||
highlightedCells[ | |||
} | } | ||
} | } | ||
} | }); | ||
}); | }); | ||