Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -22,17 +22,18 @@ def render_chessboard():
|
|
22 |
<meta charset="UTF-8">
|
23 |
<link
|
24 |
rel="stylesheet"
|
25 |
-
href="https://
|
26 |
-
integrity="
|
27 |
-
crossorigin="anonymous"
|
|
|
28 |
<script
|
29 |
-
src="https://code.jquery.com/jquery-3.
|
30 |
-
integrity="
|
31 |
crossorigin="anonymous">
|
32 |
</script>
|
33 |
<script
|
34 |
-
src="https://
|
35 |
-
integrity="
|
36 |
crossorigin="anonymous">
|
37 |
</script>
|
38 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.10.3/chess.min.js"></script>
|
@@ -43,7 +44,6 @@ def render_chessboard():
|
|
43 |
// Initialisation du jeu
|
44 |
var board = null;
|
45 |
var game = new Chess('{fen}');
|
46 |
-
var $status = $('#status');
|
47 |
|
48 |
function onDragStart (source, piece, position, orientation) {{
|
49 |
// Autoriser uniquement les pièces blanches à être déplacées
|
@@ -83,12 +83,15 @@ def render_chessboard():
|
|
83 |
onDragStart: onDragStart,
|
84 |
onDrop: onDrop,
|
85 |
onSnapEnd: onSnapEnd,
|
86 |
-
pieceTheme: 'https://
|
87 |
}};
|
88 |
|
89 |
// Initialisation de l'échiquier
|
90 |
board = Chessboard('board', config);
|
91 |
|
|
|
|
|
|
|
92 |
// Gestion des messages de Streamlit
|
93 |
window.addEventListener('message', function(e) {{
|
94 |
if (e.data.type === 'update') {{
|
|
|
22 |
<meta charset="UTF-8">
|
23 |
<link
|
24 |
rel="stylesheet"
|
25 |
+
href="https://cdnjs.cloudflare.com/ajax/libs/chessboard-js/1.0.0/chessboard-1.0.0.min.css"
|
26 |
+
integrity="sha512-TU/clvRaSqKB43MX6dvJPgxm0ytgRrg/6tkbTPCFwOXG6Ej70nGCkcFkatrbcPHqR0mlPCy3WuYNg936BGvNOg=="
|
27 |
+
crossorigin="anonymous"
|
28 |
+
/>
|
29 |
<script
|
30 |
+
src="https://code.jquery.com/jquery-3.6.0.min.js"
|
31 |
+
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
|
32 |
crossorigin="anonymous">
|
33 |
</script>
|
34 |
<script
|
35 |
+
src="https://cdnjs.cloudflare.com/ajax/libs/chessboard-js/1.0.0/chessboard-1.0.0.min.js"
|
36 |
+
integrity="sha512-WfASs5HtTgTL/eZs0Td0JVJZ+8tNxF/MDNU99TzJI8D4jXrZdQZRO9G7EPIVQhvmb7yUEEH+AKY9PfGi4pqrw=="
|
37 |
crossorigin="anonymous">
|
38 |
</script>
|
39 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.10.3/chess.min.js"></script>
|
|
|
44 |
// Initialisation du jeu
|
45 |
var board = null;
|
46 |
var game = new Chess('{fen}');
|
|
|
47 |
|
48 |
function onDragStart (source, piece, position, orientation) {{
|
49 |
// Autoriser uniquement les pièces blanches à être déplacées
|
|
|
83 |
onDragStart: onDragStart,
|
84 |
onDrop: onDrop,
|
85 |
onSnapEnd: onSnapEnd,
|
86 |
+
pieceTheme: 'https://cdnjs.cloudflare.com/ajax/libs/chessboard-js/1.0.0/img/chesspieces/wikipedia/{{piece}}.png'
|
87 |
}};
|
88 |
|
89 |
// Initialisation de l'échiquier
|
90 |
board = Chessboard('board', config);
|
91 |
|
92 |
+
// S'assurer que l'échiquier est responsive
|
93 |
+
$(window).resize(board.resize);
|
94 |
+
|
95 |
// Gestion des messages de Streamlit
|
96 |
window.addEventListener('message', function(e) {{
|
97 |
if (e.data.type === 'update') {{
|