FABLESLIP commited on
Commit
a9291a6
·
verified ·
1 Parent(s): 1b8fd89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -0
app.py CHANGED
@@ -905,6 +905,8 @@ HTML_TEMPLATE = r"""
905
  .repo-item{display:flex; align-items:center; gap:8px; padding:6px; border-bottom:1px solid #f3f4f6}
906
  .repo-item:last-child{border-bottom:none}
907
  .repo-id{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size:12px}
 
 
908
 
909
  </style>
910
  <h1>🎬 Video Editor</h1>
@@ -1018,6 +1020,7 @@ HTML_TEMPLATE = r"""
1018
  </div>
1019
  <div id="warmup-logs" style="max-height:220px; overflow:auto; font-size:12px; color:#6b7280; white-space:pre-wrap"></div>
1020
  <div style="margin-top:10px; display:flex; gap:8px; justify-content:flex-end">
 
1021
  <button id="warmupCloseBtn" class="btn">Fermer</button>
1022
  </div>
1023
  </div>
@@ -1025,6 +1028,7 @@ HTML_TEMPLATE = r"""
1025
  <h3>Sélection des modèles à préparer</h3>
1026
  <div id="repoList" class="repo-list"></div>
1027
  <div style="margin-top:12px; display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap">
 
1028
  <button id="selectAllBtn" class="btn">Tout cocher</button>
1029
  <button id="selectNoneBtn" class="btn">Tout décocher</button>
1030
  <button id="selectCancelBtn" class="btn">Annuler</button>
@@ -1095,6 +1099,8 @@ const warmupPopup = document.getElementById('warmupPopup');
1095
  const warmupPopupStatus = document.getElementById('warmupPopupStatus');
1096
  const warmupProgressFill = document.getElementById('warmup-progress-fill');
1097
  const warmupLogs = document.getElementById('warmup-logs');
 
 
1098
 
1099
  // Mémorise la dernière instance vue pour détecter les bascules
1100
  window._lastInstanceId = null;
@@ -1152,6 +1158,53 @@ let userClosedWarmupPopup = false;
1152
 
1153
  if (warmupCloseBtn) warmupCloseBtn.addEventListener('click', closeWarmupPopup);
1154
  if (warmupCloseBtn) warmupCloseBtn.addEventListener('click', ()=>{ userClosedWarmupPopup = true; });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1155
 
1156
 
1157
  // Rafraîchissement d’état
 
905
  .repo-item{display:flex; align-items:center; gap:8px; padding:6px; border-bottom:1px solid #f3f4f6}
906
  .repo-item:last-child{border-bottom:none}
907
  .repo-id{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size:12px}
908
+ /* Popups déplaçables : poignée = <h3> */
909
+ #warmupPopup h3, #warmupSelectPopup h3 { cursor: move; user-select: none; }
910
 
911
  </style>
912
  <h1>🎬 Video Editor</h1>
 
1020
  </div>
1021
  <div id="warmup-logs" style="max-height:220px; overflow:auto; font-size:12px; color:#6b7280; white-space:pre-wrap"></div>
1022
  <div style="margin-top:10px; display:flex; gap:8px; justify-content:flex-end">
1023
+ <button id="warmupCopyBtn" class="btn" title="Copier le contenu">Copier</button>
1024
  <button id="warmupCloseBtn" class="btn">Fermer</button>
1025
  </div>
1026
  </div>
 
1028
  <h3>Sélection des modèles à préparer</h3>
1029
  <div id="repoList" class="repo-list"></div>
1030
  <div style="margin-top:12px; display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap">
1031
+ <button id="warmupSelectCopyBtn" class="btn" title="Copier le contenu">Copier</button>
1032
  <button id="selectAllBtn" class="btn">Tout cocher</button>
1033
  <button id="selectNoneBtn" class="btn">Tout décocher</button>
1034
  <button id="selectCancelBtn" class="btn">Annuler</button>
 
1099
  const warmupPopupStatus = document.getElementById('warmupPopupStatus');
1100
  const warmupProgressFill = document.getElementById('warmup-progress-fill');
1101
  const warmupLogs = document.getElementById('warmup-logs');
1102
+ const warmupCopyBtn = document.getElementById('warmupCopyBtn');
1103
+ const warmupSelectCopyBtn = document.getElementById('warmupSelectCopyBtn');
1104
 
1105
  // Mémorise la dernière instance vue pour détecter les bascules
1106
  window._lastInstanceId = null;
 
1158
 
1159
  if (warmupCloseBtn) warmupCloseBtn.addEventListener('click', closeWarmupPopup);
1160
  if (warmupCloseBtn) warmupCloseBtn.addEventListener('click', ()=>{ userClosedWarmupPopup = true; });
1161
+ // Bouton "Copier" — popup Téléchargement
1162
+ if (warmupCopyBtn){
1163
+ warmupCopyBtn.addEventListener('click', async ()=>{
1164
+ const title = (warmupPopup.querySelector('h3')?.innerText || '').trim();
1165
+ const status = (warmupPopupStatus?.innerText || '').trim();
1166
+ const body = (warmupLogs?.innerText || '').trim();
1167
+ const txt = [title, status, '', body].filter(Boolean).join('\n');
1168
+ try{ await navigator.clipboard.writeText(txt); showToast('Contenu copié ✅'); }
1169
+ catch{ alert('Copie impossible'); }
1170
+ });
1171
+ }
1172
+
1173
+ // Bouton "Copier" — popup Sélection
1174
+ if (warmupSelectCopyBtn){
1175
+ warmupSelectCopyBtn.addEventListener('click', async ()=>{
1176
+ const title = (warmupSelectPopup.querySelector('h3')?.innerText || '').trim();
1177
+ const list = (repoListEl?.innerText || '').trim();
1178
+ const txt = [title, '', list].filter(Boolean).join('\n');
1179
+ try{ await navigator.clipboard.writeText(txt); showToast('Contenu copié ✅'); }
1180
+ catch{ alert('Copie impossible'); }
1181
+ });
1182
+ }
1183
+
1184
+ // Rendre les popups déplaçables en saisissant leur <h3>
1185
+ function makeDraggable(el, handle){
1186
+ if(!el || !handle) return;
1187
+ let drag=false, sx=0, sy=0, bx=0, by=0;
1188
+ handle.addEventListener('mousedown', (e)=>{
1189
+ const r = el.getBoundingClientRect();
1190
+ el.style.left = r.left + 'px';
1191
+ el.style.top = r.top + 'px';
1192
+ el.style.transform = 'none';
1193
+ drag=true; sx=e.clientX; sy=e.clientY; bx=r.left; by=r.top; e.preventDefault();
1194
+ });
1195
+ window.addEventListener('mousemove', (e)=>{
1196
+ if(!drag) return;
1197
+ const nx = bx + (e.clientX - sx);
1198
+ const ny = by + (e.clientY - sy);
1199
+ const maxX = window.innerWidth - el.offsetWidth - 8;
1200
+ const maxY = window.innerHeight - el.offsetHeight - 8;
1201
+ el.style.left = Math.max(8, Math.min(maxX, nx)) + 'px';
1202
+ el.style.top = Math.max(8, Math.min(maxY, ny)) + 'px';
1203
+ });
1204
+ window.addEventListener('mouseup', ()=>{ drag=false; });
1205
+ }
1206
+ makeDraggable(warmupPopup, warmupPopup?.querySelector('h3'));
1207
+ makeDraggable(warmupSelectPopup, warmupSelectPopup?.querySelector('h3'));
1208
 
1209
 
1210
  // Rafraîchissement d’état