* 创建悬浮速度滑块 * @returns {HTMLElement} 滑块容器元素
()
| 535 | * @returns {HTMLElement} 滑块容器元素 |
| 536 | */ |
| 537 | function createFloatingSpeedSlider() { |
| 538 | injectFloatingPanelStyles(); |
| 539 | |
| 540 | const existingSlider = document.getElementById('linuxdo-speed-slider'); |
| 541 | |
| 542 | if (existingSlider) { |
| 543 | existingSlider.remove(); |
| 544 | } |
| 545 | |
| 546 | const container = document.createElement('div'); |
| 547 | |
| 548 | container.id = 'linuxdo-speed-slider'; |
| 549 | container.style.cssText = ` |
| 550 | position: fixed; |
| 551 | bottom: 20px; |
| 552 | right: 20px; |
| 553 | border-radius: 8px; |
| 554 | padding: 16px; |
| 555 | z-index: 9999; |
| 556 | min-width: 200px; |
| 557 | display: ${getSwitchState() ? 'block' : 'none'}; |
| 558 | `; |
| 559 | |
| 560 | const label = document.createElement('div'); |
| 561 | label.className = 'linuxdo-helper-label'; |
| 562 | label.textContent = '阅读速度'; |
| 563 | label.style.cssText = 'font-size: 14px; font-weight: 500; margin-bottom: 10px;'; |
| 564 | container.appendChild(label); |
| 565 | |
| 566 | const sliderWrapper = document.createElement('div'); |
| 567 | sliderWrapper.style.cssText = 'display: flex; align-items: center; gap: 8px;'; |
| 568 | |
| 569 | const decreaseButton = document.createElement('button'); |
| 570 | decreaseButton.type = 'button'; |
| 571 | decreaseButton.className = 'linuxdo-helper-speed-button'; |
| 572 | decreaseButton.textContent = '-'; |
| 573 | decreaseButton.title = '降低速度'; |
| 574 | |
| 575 | const slider = document.createElement('input'); |
| 576 | slider.type = 'range'; |
| 577 | slider.min = SPEED_SLIDER_CONFIG.min; |
| 578 | slider.max = SPEED_SLIDER_CONFIG.max; |
| 579 | slider.step = SPEED_SLIDER_CONFIG.step; |
| 580 | slider.value = getSpeedRatio(); |
| 581 | slider.style.cssText = ` |
| 582 | flex: 1; |
| 583 | height: 6px; |
| 584 | border-radius: 3px; |
| 585 | outline: none; |
| 586 | cursor: pointer; |
| 587 | `; |
| 588 | |
| 589 | const valueDisplay = document.createElement('span'); |
| 590 | valueDisplay.className = 'linuxdo-helper-value'; |
| 591 | valueDisplay.textContent = formatSpeedDisplay(getSpeedRatio()); |
| 592 | valueDisplay.style.cssText = 'min-width: 32px; text-align: right; font-size: 14px; font-weight: 500;'; |
| 593 | |
| 594 | const increaseButton = document.createElement('button'); |
no test coverage detected