загрузка матрицы на кнопки парсинга в редактировании базы
This commit is contained in:
@@ -128,6 +128,60 @@
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action-form.is-loading .action-btn {
|
||||||
|
opacity: 0.75;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-loader {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
display: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgba(3, 8, 15, 0.94);
|
||||||
|
z-index: 9999;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-loader.active {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-canvas {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-content {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
width: min(90vw, 560px);
|
||||||
|
padding: 28px 24px;
|
||||||
|
border-radius: 18px;
|
||||||
|
border: 1px solid rgba(79, 140, 255, 0.35);
|
||||||
|
background: rgba(12, 17, 26, 0.88);
|
||||||
|
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
|
||||||
|
text-align: center;
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #f4f8ff;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.matrix-status {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #c5d2e6;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -145,19 +199,19 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="parser-actions">
|
<div class="parser-actions">
|
||||||
<form method="post" action="/admin/db/run-parser" class="action-form">
|
<form method="post" action="/admin/db/run-parser" class="action-form" data-parser-title="Игроки" data-parser-status="Сбор и сохранение базы игроков...">
|
||||||
<input type="hidden" name="parser_name" value="players">
|
<input type="hidden" name="parser_name" value="players">
|
||||||
<button type="submit" class="action-btn">Заграбить игроков</button>
|
<button type="submit" class="action-btn">🗄️ Заграбить игроков</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form method="post" action="/admin/db/run-parser" class="action-form">
|
<form method="post" action="/admin/db/run-parser" class="action-form" data-parser-title="Расписание" data-parser-status="Загрузка расписания матчей с сайта...">
|
||||||
<input type="hidden" name="parser_name" value="schedule">
|
<input type="hidden" name="parser_name" value="schedule">
|
||||||
<button type="submit" class="action-btn">Заграбить расписание</button>
|
<button type="submit" class="action-btn">🗄️ Заграбить расписание</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form method="post" action="/admin/db/run-parser" class="action-form">
|
<form method="post" action="/admin/db/run-parser" class="action-form" data-parser-title="Турнирка" data-parser-status="Обновление турнирной таблицы...">
|
||||||
<input type="hidden" name="parser_name" value="standings">
|
<input type="hidden" name="parser_name" value="standings">
|
||||||
<button type="submit" class="action-btn">Заграбить турнирку</button>
|
<button type="submit" class="action-btn">🗄️ Заграбить турнирку</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -177,5 +231,85 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="matrixLoader" class="matrix-loader" aria-hidden="true">
|
||||||
|
<canvas id="matrixCanvas" class="matrix-canvas"></canvas>
|
||||||
|
<div class="matrix-content">
|
||||||
|
<div class="matrix-title" id="matrixTitle">Запуск парсера</div>
|
||||||
|
<div class="matrix-status" id="matrixStatusText">Подготовка...</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const loader = document.getElementById("matrixLoader");
|
||||||
|
const titleEl = document.getElementById("matrixTitle");
|
||||||
|
const statusText = document.getElementById("matrixStatusText");
|
||||||
|
const canvas = document.getElementById("matrixCanvas");
|
||||||
|
const ctx = canvas ? canvas.getContext("2d") : null;
|
||||||
|
const parserForms = document.querySelectorAll(".action-form");
|
||||||
|
let drops = [];
|
||||||
|
let fontSize = 18;
|
||||||
|
let columns = 0;
|
||||||
|
let matrixAnimationId = null;
|
||||||
|
const chars = "01アイウエオカキクケコサシスセソタチツテトABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
|
function resizeCanvas() {
|
||||||
|
if (!canvas || !ctx) return;
|
||||||
|
canvas.width = window.innerWidth;
|
||||||
|
canvas.height = window.innerHeight;
|
||||||
|
columns = Math.max(1, Math.floor(canvas.width / fontSize));
|
||||||
|
drops = Array.from({ length: columns }, () => Math.random() * canvas.height / fontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawMatrix() {
|
||||||
|
if (!canvas || !ctx) return;
|
||||||
|
ctx.fillStyle = "rgba(3, 8, 15, 0.10)";
|
||||||
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
ctx.fillStyle = "#4f8cff";
|
||||||
|
ctx.font = `${fontSize}px monospace`;
|
||||||
|
|
||||||
|
for (let i = 0; i < drops.length; i++) {
|
||||||
|
const text = chars[Math.floor(Math.random() * chars.length)];
|
||||||
|
const x = i * fontSize;
|
||||||
|
const y = drops[i] * fontSize;
|
||||||
|
ctx.fillText(text, x, y);
|
||||||
|
if (y > canvas.height && Math.random() > 0.975) {
|
||||||
|
drops[i] = 0;
|
||||||
|
}
|
||||||
|
drops[i] += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
matrixAnimationId = requestAnimationFrame(drawMatrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
function startLoader(title, message) {
|
||||||
|
if (!loader) return;
|
||||||
|
titleEl.textContent = title;
|
||||||
|
statusText.textContent = message;
|
||||||
|
loader.classList.add("active");
|
||||||
|
loader.setAttribute("aria-hidden", "false");
|
||||||
|
if (!matrixAnimationId) {
|
||||||
|
resizeCanvas();
|
||||||
|
drawMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parserForms.forEach((form) => {
|
||||||
|
form.addEventListener("submit", () => {
|
||||||
|
const parserTitle = form.dataset.parserTitle || "Запуск парсера";
|
||||||
|
const parserStatus = form.dataset.parserStatus || "Обработка данных...";
|
||||||
|
|
||||||
|
document.querySelectorAll(".action-btn").forEach((btn) => {
|
||||||
|
btn.disabled = true;
|
||||||
|
});
|
||||||
|
form.classList.add("is-loading");
|
||||||
|
startLoader(`Парсинг: ${parserTitle}`, parserStatus);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
resizeCanvas();
|
||||||
|
window.addEventListener("resize", resizeCanvas);
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user