PageSourceSearch

https://majestic-mods.ru/js/ktoposetil.js

js majestic-mods.ru collected 2026-10-08 14:34:55 UTC 2,518 bytes, 75 lines download raw bytes

1// ⛔ Блокируем только вызов стандартного окна "Сегодняшние посетители"
2document.addEventListener("DOMContentLoaded", function () {
3 document.querySelectorAll("a.fUsrList").forEach(link => {
4 link.removeAttribute("onclick"); // удаляем встроенный uCoz скрипт
5 link.addEventListener("click", function (e) {
6 e.preventDefault();
7 e.stopPropagation();
8 openUserList(); // открываем кастомную модалку
9 });
10 });
11});
12
13// ✅ Функция открытия модального окна
14function openUserList() {
15 const modal = document.getElementById("userListModal");
16 const content = document.getElementById("userListContent");
17 if (!modal || !content) return;
18
19 modal.style.display = "flex";
20 content.innerHTML = "Загрузка...";
21
22 fetch("/index/62-2")
23 .then(res => res.text())
24 .then(xmlText => {
25 const parser = new DOMParser();
26 const xml = parser.parseFromString(xmlText, "application/xml");
27 const contentNode = xml.querySelector('cmd[p="content"]');
28
29 if (contentNode) {
30 const cdataText = contentNode.textContent;
31 content.innerHTML = cdataText;
32
33 // Добавляем ID к каждому пользователю
34 const users = content.querySelectorAll("ul.uz li");
35 users.forEach(item => {
36 const link = item.querySelector("a[href*='/index/8-']");
37 if (link) {
38 const match = link.href.match(/\/index\/8-(\d+)/);
39 if (match) {
40 const id = match[1];
41 const span = document.createElement("span");
42 span.textContent = ` [ID ${id}]`;
43 span.style.cssText = "font-size:11px; color:#5f5e5e; margin-left:5px;";
44 link.after(span);
45 }
46 }
47 });
48
49 // Счётчик
50 const count = users.length;
51 function getWord(n) {
52 if (n % 10 === 1 && n % 100 !== 11) return "пользователь";
53 if ([2, 3, 4].includes(n % 10) && ![12, 13, 14].includes(n % 100)) return "пользователя";
54 return "пользователей";
55}
56
57 const counter = document.createElement("div");
58 counter.textContent = `👥 ${count} ${getWord(count)}`;
59 counter.style.cssText = "margin-bottom: 8px; font-weight: bold;";
60 content.prepend(counter);
61 } else {
62 content.innerHTML = "⚠️ Не удалось загрузить список.";
63 }
64 })
65 .catch(err => {
66 content.innerHTML = "⚠️ Ошибка загрузки.";
67 console.error(err);
68 });
69}
70
71// ✅ Закрытие модалки
72function closeUserList() {
73 const modal = document.getElementById("userListModal");
74 if (modal) modal.style.display = "none";
75}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.