Youngger9765 commited on
Commit
d51ce68
·
1 Parent(s): 3472fcd

更新 index.html 模板,將「彈出視窗」按鈕文字改為「新分頁」,並調整相關函式註解以反映功能變更。此次更新旨在提升用戶對功能的理解與使用體驗。

Browse files
Files changed (1) hide show
  1. templates/index.html +4 -13
templates/index.html CHANGED
@@ -1653,7 +1653,7 @@
1653
  </div>
1654
  <div class="flex gap-2">
1655
  <button onclick="openPreviewPopup()" class="text-sm" style="color: #A3E0C5;" onmouseover="this.style.color='#8FD4B3'" onmouseout="this.style.color='#A3E0C5'">
1656
- <i class="fas fa-external-link-alt mr-1"></i>彈出視窗
1657
  </button>
1658
  <button onclick="copyToClipboard()" class="text-sm" style="color: #A3E0C5;" onmouseover="this.style.color='#8FD4B3'" onmouseout="this.style.color='#A3E0C5'">
1659
  <i class="fas fa-copy mr-1"></i>複製
@@ -2230,30 +2230,21 @@
2230
  }
2231
  }
2232
 
2233
- // Open preview in popup window
2234
  function openPreviewPopup() {
2235
  if (!generatedHTML) {
2236
  showToast('請先生成 HTML!', 'error');
2237
  return;
2238
  }
2239
 
2240
- const width = 1200;
2241
- const height = 800;
2242
- const left = (window.screen.width - width) / 2;
2243
- const top = (window.screen.height - height) / 2;
2244
-
2245
- const previewWindow = window.open(
2246
- '',
2247
- 'preview_popup',
2248
- `width=${width},height=${height},left=${left},top=${top},resizable=yes,scrollbars=yes`
2249
- );
2250
 
2251
  if (previewWindow) {
2252
  previewWindow.document.write(generatedHTML);
2253
  previewWindow.document.close();
2254
  previewWindow.document.title = '預覽 - 樂寫網徵文比賽';
2255
  } else {
2256
- showToast('無法開啟預覽視窗,請檢查瀏覽器的彈出視窗設定', 'error');
2257
  }
2258
  }
2259
 
 
1653
  </div>
1654
  <div class="flex gap-2">
1655
  <button onclick="openPreviewPopup()" class="text-sm" style="color: #A3E0C5;" onmouseover="this.style.color='#8FD4B3'" onmouseout="this.style.color='#A3E0C5'">
1656
+ <i class="fas fa-external-link-alt mr-1"></i>新分頁
1657
  </button>
1658
  <button onclick="copyToClipboard()" class="text-sm" style="color: #A3E0C5;" onmouseover="this.style.color='#8FD4B3'" onmouseout="this.style.color='#A3E0C5'">
1659
  <i class="fas fa-copy mr-1"></i>複製
 
2230
  }
2231
  }
2232
 
2233
+ // Open preview in new tab
2234
  function openPreviewPopup() {
2235
  if (!generatedHTML) {
2236
  showToast('請先生成 HTML!', 'error');
2237
  return;
2238
  }
2239
 
2240
+ const previewWindow = window.open('', '_blank');
 
 
 
 
 
 
 
 
 
2241
 
2242
  if (previewWindow) {
2243
  previewWindow.document.write(generatedHTML);
2244
  previewWindow.document.close();
2245
  previewWindow.document.title = '預覽 - 樂寫網徵文比賽';
2246
  } else {
2247
+ showToast('無法開啟新分頁,請檢查瀏覽器的彈出視窗設定', 'error');
2248
  }
2249
  }
2250