Zual commited on
Commit
5fcf9d2
·
verified ·
1 Parent(s): 215ec13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -22,17 +22,18 @@ def render_chessboard():
22
  <meta charset="UTF-8">
23
  <link
24
  rel="stylesheet"
25
- href="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.css"
26
- integrity="sha384-q94+BZtLrkL1/ohfjR8c6L+A6qzNH9R2hBLwyoAfu3i/WCvQjzL2RQJ3uNHDISdU"
27
- crossorigin="anonymous">
 
28
  <script
29
- src="https://code.jquery.com/jquery-3.5.1.min.js"
30
- integrity="sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2"
31
  crossorigin="anonymous">
32
  </script>
33
  <script
34
- src="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.js"
35
- integrity="sha384-8Vi8VHwn3vjQ9eUHUxex3JSN/NFqUg3QbPyX8kWyb93+8AC/pPWTzj+nHtbC5bxD"
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://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/img/chesspieces/wikipedia/{{piece}}.png'
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') {{