fix
This commit is contained in:
69
templates/base.html
Normal file
69
templates/base.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user