cormort commited on
Commit
e314321
·
verified ·
1 Parent(s): 2f45c12

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +25 -20
index.html CHANGED
@@ -83,22 +83,27 @@
83
  mark { background-color: #fff3cd; color: #856404; padding: 0.2em; border-radius: 3px; font-weight: bold; }
84
 
85
  /* 儀表板 */
86
- .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-bottom: 30px; }
87
  .kpi-card { background-color: var(--table-striped); padding: 20px; border-radius: 8px; border-left: 5px solid var(--primary-color); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); text-align: center; }
88
  .kpi-title { font-size: 1.1em; color: #666; margin-bottom: 10px; }
89
  body.dark-mode .kpi-title { color: #aaa; }
90
  .kpi-value { font-size: 2.2em; font-weight: bold; color: var(--primary-color); }
91
- .charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 30px; margin-bottom: 20px; }
92
- .chart-box { background-color: var(--table-striped); padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); display: flex; flex-direction: column; }
93
- .chart-title { text-align: center; font-size: 1.2em; font-weight: bold; margin-bottom: 15px; color: var(--text-color); }
94
- .chart-container { position: relative; height: 300px; width: 100%; flex-grow: 1; }
95
 
96
  /* 互動連結列表 */
97
  .clickable-row { cursor: pointer; transition: background-color 0.2s; }
98
  .clickable-row:hover { background-color: var(--law-info-bg) !important; }
99
- .fund-link { color: var(--primary-color); text-decoration: none; transition: text-decoration 0.2s; }
100
  .clickable-row:hover .fund-link { text-decoration: underline; }
101
 
 
 
 
 
 
102
  /* 分頁 */
103
  .pagination { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 20px; }
104
  .page-btn { padding: 8px 15px; background-color: var(--primary-color); color: white; border: none; border-radius: 4px; cursor: pointer; }
@@ -159,11 +164,18 @@
159
  <div class="loader" id="main-loader"></div> 資料載入中,請稍候... (首次載入需下載全國法規資料庫)
160
  </div>
161
  <div id="dashboard-content" style="display: none;">
 
162
  <div class="kpi-grid">
163
  <div class="kpi-card"><div class="kpi-title">現行運作中基金總數</div><div class="kpi-value" id="kpi-active-funds">-</div></div>
164
  <div class="kpi-card"><div class="kpi-title">涵蓋主管機關數</div><div class="kpi-value" id="kpi-total-auths">-</div></div>
165
  <div class="kpi-card"><div class="kpi-title">收錄現行法規總條數</div><div class="kpi-value" id="kpi-total-articles">-</div></div>
166
  </div>
 
 
 
 
 
 
167
 
168
  <div class="charts-grid">
169
  <div class="chart-box">
@@ -182,11 +194,6 @@
182
  <div class="chart-title">💸 基金用途分析文字雲</div>
183
  <div class="chart-container" style="height: 350px;"><canvas id="useWordCloudChart"></canvas></div>
184
  </div>
185
- <div class="chart-box">
186
- <div class="chart-title">🕒 最近修正前 10 名基金 (點擊查看法條)</div>
187
- <div class="chart-container" id="recent-funds-container" style="overflow-y: auto; padding: 0 10px;">
188
- </div>
189
- </div>
190
  </div>
191
  </div>
192
  </div>
@@ -352,8 +359,7 @@
352
  drawChart('sourceWordCloudChart', 'wordCloud', topSources.map(i => i[0]), topSources.map(i => i[1]), chartTextColor);
353
  drawChart('useWordCloudChart', 'wordCloud', topUses.map(i => i[0]), topUses.map(i => i[1]), chartTextColor);
354
 
355
- // --- 新增:最近修正的前 10 個基金 ---
356
- // 建立一個日期轉換函數,把 "民國 114 年 03 月 21 日" 轉成數字 1140321 方便正確比對大小
357
  const parseROCDate = (dateStr) => {
358
  if (!dateStr) return 0;
359
  const matches = dateStr.match(/(\d+)/g);
@@ -368,30 +374,29 @@
368
  if (!fundDateMap[item.基金名稱]) {
369
  fundDateMap[item.基金名稱] = item.最近發布日期;
370
  } else {
371
- // 使用轉換後的數字來比較哪一個日期比較新
372
  if (parseROCDate(item.最近發布日期) > parseROCDate(fundDateMap[item.基金名稱])) {
373
  fundDateMap[item.基金名稱] = item.最近發布日期;
374
  }
375
  }
376
  });
377
 
378
- // 使用轉換後的數字進行遞減排序 (b - a)
379
  const sortedRecentFunds = Object.entries(fundDateMap)
380
  .sort((a, b) => parseROCDate(b[1]) - parseROCDate(a[1]))
381
  .slice(0, 10);
382
 
383
  const recentContainer = document.getElementById('recent-funds-container');
384
  if (recentContainer) {
385
- let html = '<table style="width:100%; border-collapse: collapse; text-align: left; margin-top: 10px;">';
386
- html += '<thead><tr style="border-bottom: 2px solid var(--border-color);"><th style="padding:8px; color:var(--text-color);">基金名稱</th><th style="padding:8px; width:40%; color:var(--text-color);">最近發布日期</th></tr></thead><tbody>';
 
387
 
388
  sortedRecentFunds.forEach((fund, index) => {
389
  html += `<tr class="clickable-row" onclick="goToFund('${fund[0].replace(/'/g, "\\'")}')" style="border-bottom: 1px solid var(--border-color);">
390
- <td style="padding:12px 8px;">
391
- <span style="display:inline-block; width:20px; text-align:right; margin-right:5px; color:#888;">${index + 1}.</span>
392
  <span class="fund-link">${fund[0]}</span>
393
  </td>
394
- <td style="padding:12px 8px; color: var(--text-color); font-weight: bold;">${fund[1]}</td>
395
  </tr>`;
396
  });
397
  html += '</tbody></table>';
 
83
  mark { background-color: #fff3cd; color: #856404; padding: 0.2em; border-radius: 3px; font-weight: bold; }
84
 
85
  /* 儀表板 */
86
+ .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-bottom: 20px; }
87
  .kpi-card { background-color: var(--table-striped); padding: 20px; border-radius: 8px; border-left: 5px solid var(--primary-color); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); text-align: center; }
88
  .kpi-title { font-size: 1.1em; color: #666; margin-bottom: 10px; }
89
  body.dark-mode .kpi-title { color: #aaa; }
90
  .kpi-value { font-size: 2.2em; font-weight: bold; color: var(--primary-color); }
91
+
92
+ /* 全寬面板 (用於排行榜) */
93
+ .full-width-panel { background-color: var(--container-bg); border: 1px solid var(--border-color); padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); margin-bottom: 30px; }
94
+ .panel-title { font-size: 1.3em; font-weight: bold; color: var(--primary-color); border-bottom: 2px solid var(--primary-color); padding-bottom: 10px; margin-bottom: 15px; }
95
 
96
  /* 互動連結列表 */
97
  .clickable-row { cursor: pointer; transition: background-color 0.2s; }
98
  .clickable-row:hover { background-color: var(--law-info-bg) !important; }
99
+ .fund-link { color: var(--primary-color); text-decoration: none; transition: text-decoration 0.2s; font-weight: bold; }
100
  .clickable-row:hover .fund-link { text-decoration: underline; }
101
 
102
+ .charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 30px; margin-bottom: 20px; }
103
+ .chart-box { background-color: var(--table-striped); padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); display: flex; flex-direction: column; }
104
+ .chart-title { text-align: center; font-size: 1.2em; font-weight: bold; margin-bottom: 15px; color: var(--text-color); }
105
+ .chart-container { position: relative; height: 300px; width: 100%; flex-grow: 1; }
106
+
107
  /* 分頁 */
108
  .pagination { display: flex; justify-content: center; align-items: center; gap: 15px; margin-top: 20px; }
109
  .page-btn { padding: 8px 15px; background-color: var(--primary-color); color: white; border: none; border-radius: 4px; cursor: pointer; }
 
164
  <div class="loader" id="main-loader"></div> 資料載入中,請稍候... (首次載入需下載全國法規資料庫)
165
  </div>
166
  <div id="dashboard-content" style="display: none;">
167
+
168
  <div class="kpi-grid">
169
  <div class="kpi-card"><div class="kpi-title">現行運作中基金總數</div><div class="kpi-value" id="kpi-active-funds">-</div></div>
170
  <div class="kpi-card"><div class="kpi-title">涵蓋主管機關數</div><div class="kpi-value" id="kpi-total-auths">-</div></div>
171
  <div class="kpi-card"><div class="kpi-title">收錄現行法規總條數</div><div class="kpi-value" id="kpi-total-articles">-</div></div>
172
  </div>
173
+
174
+ <div class="full-width-panel">
175
+ <div class="panel-title">🕒 最近修正前 10 名基金 (點擊快速查看法條)</div>
176
+ <div id="recent-funds-container">
177
+ </div>
178
+ </div>
179
 
180
  <div class="charts-grid">
181
  <div class="chart-box">
 
194
  <div class="chart-title">💸 基金用途分析文字雲</div>
195
  <div class="chart-container" style="height: 350px;"><canvas id="useWordCloudChart"></canvas></div>
196
  </div>
 
 
 
 
 
197
  </div>
198
  </div>
199
  </div>
 
359
  drawChart('sourceWordCloudChart', 'wordCloud', topSources.map(i => i[0]), topSources.map(i => i[1]), chartTextColor);
360
  drawChart('useWordCloudChart', 'wordCloud', topUses.map(i => i[0]), topUses.map(i => i[1]), chartTextColor);
361
 
362
+ // --- 最近修正的前 10 個基金 (數字排序修復版) ---
 
363
  const parseROCDate = (dateStr) => {
364
  if (!dateStr) return 0;
365
  const matches = dateStr.match(/(\d+)/g);
 
374
  if (!fundDateMap[item.基金名稱]) {
375
  fundDateMap[item.基金名稱] = item.最近發布日期;
376
  } else {
 
377
  if (parseROCDate(item.最近發布日期) > parseROCDate(fundDateMap[item.基金名稱])) {
378
  fundDateMap[item.基金名稱] = item.最近發布日期;
379
  }
380
  }
381
  });
382
 
 
383
  const sortedRecentFunds = Object.entries(fundDateMap)
384
  .sort((a, b) => parseROCDate(b[1]) - parseROCDate(a[1]))
385
  .slice(0, 10);
386
 
387
  const recentContainer = document.getElementById('recent-funds-container');
388
  if (recentContainer) {
389
+ // 移除原有的 overflow-y,改用標準無框線風格表格,並加入 white-space: nowrap 防止日期換行
390
+ let html = '<table style="width:100%; border-collapse: collapse; text-align: left;">';
391
+ html += '<thead><tr style="background-color: var(--table-hover);"><th style="padding:12px; color:var(--text-color); border: 1px solid var(--border-color); width: 60px; text-align: center;">排名</th><th style="padding:12px; color:var(--text-color); border: 1px solid var(--border-color);">基金名稱</th><th style="padding:12px; color:var(--text-color); border: 1px solid var(--border-color); width: 250px; text-align: center;">最近發布日期</th></tr></thead><tbody>';
392
 
393
  sortedRecentFunds.forEach((fund, index) => {
394
  html += `<tr class="clickable-row" onclick="goToFund('${fund[0].replace(/'/g, "\\'")}')" style="border-bottom: 1px solid var(--border-color);">
395
+ <td style="padding:12px; text-align: center; font-weight: bold; color: #888; border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color);">${index + 1}</td>
396
+ <td style="padding:12px; border-right: 1px solid var(--border-color);">
397
  <span class="fund-link">${fund[0]}</span>
398
  </td>
399
+ <td style="padding:12px; text-align: center; color: var(--text-color); font-weight: bold; white-space: nowrap; border-right: 1px solid var(--border-color);">${fund[1]}</td>
400
  </tr>`;
401
  });
402
  html += '</tbody></table>';