()
| 476 | |
| 477 | // 尝试下载 |
| 478 | function tryDownload() { |
| 479 | try { |
| 480 | let aLink = document.createElement('a'); |
| 481 | aLink.download = 'FeHelper-' + dt + '.json'; |
| 482 | aLink.href = URL.createObjectURL(blob); |
| 483 | aLink.style.display = 'none'; |
| 484 | |
| 485 | document.body.appendChild(aLink); |
| 486 | aLink.click(); |
| 487 | |
| 488 | setTimeout(() => { |
| 489 | if (document.body.contains(aLink)) { |
| 490 | document.body.removeChild(aLink); |
| 491 | } |
| 492 | URL.revokeObjectURL(aLink.href); |
| 493 | }, 100); |
| 494 | |
| 495 | return true; |
| 496 | } catch (error) { |
| 497 | console.error('下载失败:', error); |
| 498 | return false; |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | // 下载按钮点击事件 |
| 503 | button.click(function (e) { |
no test coverage detected