MediaWiki:Common.js: различия между версиями
Страница интерфейса MediaWiki
Дополнительные действия
Admin (обсуждение | вклад) Нет описания правки |
Admin (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
current = null; | let current = null; | ||
table = document.getElementById("law"); | let currentCell = null; | ||
if(table) table.addEventListener("click", function (event) { | const table = document.getElementById("law"); | ||
if (table) { | |||
table.addEventListener("click", function (event) { | |||
const cell = event.target.closest("td"); | |||
if (!cell) return; | |||
if (current !== null) { | |||
document.getElementById(current).style.display = "none"; | |||
if (currentCell) currentCell.classList.remove("law-selected"); | |||
} | |||
}); | |||
if (cell.dataset.id === current) { | |||
current = null; | |||
currentCell = null; | |||
return; | |||
} | |||
current = cell.dataset.id; | |||
currentCell = cell; | |||
document.getElementById(current).style.display = "block"; | |||
cell.classList.add("law-selected"); | |||
}); | |||
} | |||
mw.loader.using('jquery', function () { | mw.loader.using('jquery', function () { | ||