| 1232 | const totalPages = Math.ceil(totalItems / itemsPerPage) |
| 1233 | |
| 1234 | function generateTableData(page) { |
| 1235 | tbody.innerHTML = '' |
| 1236 | |
| 1237 | const startIndex = (page - 1) * itemsPerPage |
| 1238 | const endIndex = startIndex + itemsPerPage |
| 1239 | |
| 1240 | for (let i = startIndex; i < endIndex && i < data.length; i++) { |
| 1241 | const row = document.createElement('tr') |
| 1242 | tbody.appendChild(row) |
| 1243 | // 序号列 |
| 1244 | const indexCell = document.createElement('td') |
| 1245 | indexCell.textContent = i + 1 // 显示序号,从1开始 |
| 1246 | indexCell.style.textAlign = 'center' |
| 1247 | indexCell.style.padding = '5px' |
| 1248 | row.appendChild(indexCell) |
| 1249 | const checkboxCell = document.createElement('td') |
| 1250 | checkboxCell.style.textAlign = 'center' |
| 1251 | checkboxCell.style.padding = '5px' |
| 1252 | const checkbox = document.createElement('input') |
| 1253 | checkbox.type = 'checkbox' |
| 1254 | checkbox.id = `checkbox_${i}` |
| 1255 | checkbox.value = i |
| 1256 | checkboxCell.appendChild(checkbox) |
| 1257 | row.appendChild(checkboxCell) |
| 1258 | |
| 1259 | const nameCell = document.createElement('td') |
| 1260 | nameCell.textContent = data[i].name |
| 1261 | nameCell.style.padding = '10px' |
| 1262 | nameCell.style.borderBottom = '1px solid #ddd' |
| 1263 | row.appendChild(nameCell) |
| 1264 | |
| 1265 | const urlCell = document.createElement('td') |
| 1266 | const fullUrl = 'https://missav.com/playlists/' + data[i].key |
| 1267 | const link = document.createElement('a') |
| 1268 | link.textContent = fullUrl |
| 1269 | link.href = fullUrl |
| 1270 | link.target = '_blank' // 在新标签页中打开链接 |
| 1271 | urlCell.appendChild(link) |
| 1272 | urlCell.style.padding = '10px' |
| 1273 | urlCell.style.borderBottom = '1px solid #ddd' |
| 1274 | row.appendChild(urlCell) |
| 1275 | } |
| 1276 | } |
| 1277 | |
| 1278 | generateTableData(currentPage) |
| 1279 | |