Открыть меню
Переключить меню настроек
Открыть персональное меню
Вы не представились системе
Ваш IP-адрес будет виден всем, если вы внесёте какие-либо изменения.

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

Страница интерфейса MediaWiki
Нет описания правки
Нет описания правки
Строка 1: Строка 1:
let current = null;
let currentCell = null;
const table = document.getElementById("law");
const table = document.getElementById("law");
if (table) {
  table.addEventListener("click", function (event) {
    const cell = event.target.closest("td");
    if (!cell) return;


     if (current !== null) {
if (pageName === "Шаблон:Таблица_Космический_Закон") {
      document.getElementById(current).style.display = "none";
  const allObjects = document.querySelectorAll(".law-object");
      if (currentCell) currentCell.classList.remove("law-selected");
  allObjects.forEach(el => el.style.display = "block");
    }
} else {
 
     let current = null;
    if (cell.dataset.id === current) {
    let currentCell = null;
      current = null;
    const table = document.getElementById("law");
      currentCell = null;
    if (table) {
      return;
        table.addEventListener("click", function (event) {
    }
          const cell = event.target.closest("td");
 
          if (!cell) return;
    current = cell.dataset.id;
     
    currentCell = cell;
          if (current !== null) {
 
            document.getElementById(current).style.display = "none";
    document.getElementById(current).style.display = "block";
            if (currentCell) currentCell.classList.remove("law-selected");
    cell.classList.add("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");
        });
      }
}
}