Files
cm/templates/base.html
2026-02-02 19:18:25 +03:00

69 lines
2.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Капитал & Рынок{% endblock %}</title>
<!-- Статические файлы -->
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<link rel="icon" href="{{ url_for('static', filename='images/logo.png') }}">
<!-- WebSocket -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.5.4/socket.io.min.js"></script>
{% block head %}{% endblock %}
</head>
<body>
<!-- Уведомления -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="flash-messages">
{% for category, message in messages %}
<div class="flash-message {{ category }}">
{{ message }}
<button class="flash-close" onclick="this.parentElement.remove()">×</button>
</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<!-- Контент страницы -->
{% block content %}{% endblock %}
<!-- Общие скрипты -->
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
<!-- Инициализация WebSocket -->
<script>
// Подключение к WebSocket
const socket = io();
// Базовая обработка подключения
socket.on('connect', function() {
console.log('Connected to server');
});
socket.on('disconnect', function() {
console.log('Disconnected from server');
});
// Глобальные обработчики событий
socket.on('chat_message', function(data) {
// Обработка сообщений чата
console.log('New message:', data);
});
socket.on('player_joined', function(data) {
console.log('Player joined:', data.username);
});
socket.on('player_left', function(data) {
console.log('Player left:', data.username);
});
</script>
{% block scripts %}{% endblock %}
</body>
</html>