coollsd commited on
Commit
784c796
1 Parent(s): 415df9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +63 -46
app.py CHANGED
@@ -840,55 +840,72 @@ HTML_CONTENT = """
840
  }
841
 
842
  function showHistory() {
843
- const history = JSON.parse(localStorage.getItem('uploadHistory')) || [];
844
- historyList.innerHTML = '';
845
- history.forEach(item => {
846
- const historyItem = document.createElement('div');
847
- historyItem.className = 'history-item';
848
-
849
- const itemName = document.createElement('span');
850
- itemName.className = 'history-item-name';
851
- itemName.textContent = item.fileName;
852
- historyItem.appendChild(itemName);
853
-
854
- const actionsContainer = document.createElement('div');
855
- actionsContainer.className = 'history-item-actions';
856
-
857
- const copyBtn = document.createElement('button');
858
- copyBtn.textContent = 'Copy Link';
859
- copyBtn.className = 'small-btn';
860
- copyBtn.onclick = () => {
861
- navigator.clipboard.writeText(window.location.origin + item.url).then(() => {
862
- alert('Link copied to clipboard!');
863
- });
864
- };
865
- actionsContainer.appendChild(copyBtn);
866
-
867
- const openBtn = document.createElement('button');
868
- openBtn.textContent = 'Open';
869
- openBtn.className = 'small-btn';
870
- openBtn.onclick = () => {
871
- quickOpen(item.url, item.fileName, item.originalExtension);
872
- };
873
- actionsContainer.appendChild(openBtn);
874
-
875
- if (item.originalExtension.toLowerCase() === 'mp4') {
876
- const embedBtn = document.createElement('button');
877
- embedBtn.textContent = 'Embed';
878
- embedBtn.className = 'small-btn';
879
- embedBtn.onclick = () => {
880
- showEmbedModal(item.url);
881
- historyModal.style.display = "none";
882
- };
883
- actionsContainer.appendChild(embedBtn);
884
- }
885
-
886
- historyItem.appendChild(actionsContainer);
887
- historyList.appendChild(historyItem);
888
  });
889
- historyModal.style.display = "block";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
890
  }
891
 
 
 
 
 
 
 
892
  function quickOpen(url, fileName, originalExtension) {
893
  quickOpenContent.innerHTML = '';
894
  const fullUrl = window.location.origin + url;
 
840
  }
841
 
842
  function showHistory() {
843
+ const history = JSON.parse(localStorage.getItem('uploadHistory')) || [];
844
+ historyList.innerHTML = '';
845
+
846
+ // Add Copy All Links button
847
+ const copyAllBtn = document.createElement('button');
848
+ copyAllBtn.textContent = 'Copy All Links';
849
+ copyAllBtn.className = 'small-btn';
850
+ copyAllBtn.style.marginBottom = '15px';
851
+ copyAllBtn.onclick = () => {
852
+ const links = history.map(item => window.location.origin + item.url).join('\n');
853
+ navigator.clipboard.writeText(links).then(() => {
854
+ alert('All links copied to clipboard!');
855
+ }).catch(err => {
856
+ console.error('Failed to copy links:', err);
857
+ alert('Failed to copy links to clipboard');
858
+ });
859
+ };
860
+ historyList.appendChild(copyAllBtn);
861
+
862
+ history.forEach(item => {
863
+ const historyItem = document.createElement('div');
864
+ historyItem.className = 'history-item';
865
+
866
+ const itemName = document.createElement('span');
867
+ itemName.className = 'history-item-name';
868
+ itemName.textContent = item.fileName;
869
+ historyItem.appendChild(itemName);
870
+
871
+ const actionsContainer = document.createElement('div');
872
+ actionsContainer.className = 'history-item-actions';
873
+
874
+ const copyBtn = document.createElement('button');
875
+ copyBtn.textContent = 'Copy Link';
876
+ copyBtn.className = 'small-btn';
877
+ copyBtn.onclick = () => {
878
+ navigator.clipboard.writeText(window.location.origin + item.url).then(() => {
879
+ alert('Link copied to clipboard!');
 
 
 
 
 
 
 
 
880
  });
881
+ };
882
+ actionsContainer.appendChild(copyBtn);
883
+
884
+ const openBtn = document.createElement('button');
885
+ openBtn.textContent = 'Open';
886
+ openBtn.className = 'small-btn';
887
+ openBtn.onclick = () => {
888
+ quickOpen(item.url, item.fileName, item.originalExtension);
889
+ };
890
+ actionsContainer.appendChild(openBtn);
891
+
892
+ if (item.originalExtension.toLowerCase() === 'mp4') {
893
+ const embedBtn = document.createElement('button');
894
+ embedBtn.textContent = 'Embed';
895
+ embedBtn.className = 'small-btn';
896
+ embedBtn.onclick = () => {
897
+ showEmbedModal(item.url);
898
+ historyModal.style.display = "none";
899
+ };
900
+ actionsContainer.appendChild(embedBtn);
901
  }
902
 
903
+ historyItem.appendChild(actionsContainer);
904
+ historyList.appendChild(historyItem);
905
+ });
906
+ historyModal.style.display = "block";
907
+ }
908
+
909
  function quickOpen(url, fileName, originalExtension) {
910
  quickOpenContent.innerHTML = '';
911
  const fullUrl = window.location.origin + url;