()
| 1438 | } |
| 1439 | |
| 1440 | function createSettingsUI() { |
| 1441 | const modalContainer = createControl('div', { |
| 1442 | className: 'settings-modal' |
| 1443 | }, { |
| 1444 | position: 'fixed', |
| 1445 | top: '50%', |
| 1446 | left: '50%', |
| 1447 | transform: 'translate(-50%, -50%)', |
| 1448 | backgroundColor: 'rgba(255, 255, 255, 1)', |
| 1449 | borderRadius: '8px', |
| 1450 | boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', |
| 1451 | zIndex: '9999', |
| 1452 | padding: '20px', |
| 1453 | width: '400px', |
| 1454 | maxWidth: '80%' |
| 1455 | }) |
| 1456 | |
| 1457 | const title = createControl('h2', { |
| 1458 | textContent: '设置' |
| 1459 | }, { |
| 1460 | textAlign: 'center' |
| 1461 | }) |
| 1462 | modalContainer.appendChild(title) |
| 1463 | |
| 1464 | // 创建控件并添加到模态框 |
| 1465 | const controls = [ |
| 1466 | { |
| 1467 | type: 'checkbox', |
| 1468 | id: 'saveImageCheckbox', |
| 1469 | label: '下载图片', |
| 1470 | checked: GM_getValue('saveImage', true), |
| 1471 | onchange: function () { GM_setValue('saveImage', this.checked) } |
| 1472 | }, |
| 1473 | { |
| 1474 | type: 'checkbox', |
| 1475 | id: 'saveJsonCheckbox', |
| 1476 | label: '下载JSON', |
| 1477 | checked: GM_getValue('saveJson', false), |
| 1478 | onchange: function () { GM_setValue('saveJson', this.checked) } |
| 1479 | }, |
| 1480 | { |
| 1481 | type: 'checkbox', |
| 1482 | id: 'hdImageCheckbox', |
| 1483 | label: '下载高清大图', |
| 1484 | checked: GM_getValue('shouldReplace', false), |
| 1485 | onchange: function () { GM_setValue('shouldReplace', this.checked) } |
| 1486 | }, |
| 1487 | { |
| 1488 | type: 'checkbox', |
| 1489 | id: 'defaultTitleCheckbox', |
| 1490 | label: '使用网页标题名保存', |
| 1491 | checked: GM_getValue('useDefaultTitle', true), |
| 1492 | onchange: function () { GM_setValue('useDefaultTitle', this.checked) } |
| 1493 | }, |
| 1494 | { |
| 1495 | type: 'checkbox', |
| 1496 | id: 'saveVideoInfoCheckbox', |
| 1497 | label: '下载视频信息', |
no test coverage detected