页面采集宽度默认使用当前窗口宽度,可输入 320-3840px 触发响应式布局后采集。
(function () { "use strict"; const ROOT_ID = "__web_to_pixso_panel_root__"; const SETTINGS_KEY = "webToPixsoSettings"; const MIN_CAPTURE_WIDTH = 320; const MAX_CAPTURE_WIDTH = 3840; const DEFAULT_SETTINGS = { useProxy: false, concurrency: "8", captureMode: "mixed", captureWidth: null }; function normalizeCaptureWidth(value, fallback = null) { const number = Number.parseInt(String(value || "").replace(/\D+/g, ""), 10); if (!Number.isFinite(number)) return fallback; return Math.max(MIN_CAPTURE_WIDTH, Math.min(MAX_CAPTURE_WIDTH, number)); } function normalizeSettings(value = {}) { const concurrency = String(value.concurrency || DEFAULT_SETTINGS.concurrency); return { useProxy: Boolean(value.useProxy), concurrency: ["4", "6", "8", "10", "12", "16", "20", "infinite"].includes(concurrency) ? concurrency : DEFAULT_SETTINGS.concurrency, captureMode: value.captureMode === "editable" ? "editable" : "mixed", captureWidth: normalizeCaptureWidth(value.captureWidth, null) }; } function css() { return ` :host { all: initial; color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; } .backdrop { background: transparent; inset: 0; pointer-events: none; position: fixed; z-index: 2147483647; } .panel { background: #fff; border: 1px solid rgba(10, 10, 18, 0.14); border-radius: 22px; box-shadow: 0 18px 46px rgba(10, 10, 18, 0.18); box-sizing: border-box; color: #1a1a2e; overflow: hidden; pointer-events: auto; position: fixed; right: 28px; top: 24px; width: 320px; } .header { align-items: center; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; padding: 16px 20px 15px; } .logo-title { align-items: center; display: flex; gap: 10px; } .logo { border-radius: 10px; box-shadow: 0 4px 12px rgba(10, 10, 18, 0.12); display: block; height: 28px; object-fit: cover; width: 28px; } .title { color: #1a1a2e; font-size: 16px; font-weight: 650; line-height: 1; } .version-badge { background: #f2f4ff; border: 1px solid #dfe5ff; border-radius: 999px; color: #2450ff; font-size: 10px; font-weight: 600; line-height: 1; padding: 3px 6px; white-space: nowrap; } button, select, input { font: inherit; } .close-btn { align-items: center; background: transparent; border: 0; border-radius: 12px; color: #999; cursor: pointer; display: flex; font-size: 22px; height: 28px; justify-content: center; line-height: 1; transition: background 0.2s, color 0.2s; width: 28px; } .close-btn:hover { background: #f4f4f6; color: #666; } .content { padding: 20px; } .setting-row { align-items: center; display: flex; justify-content: space-between; margin-bottom: 16px; } .setting-label { color: #1a1a2e; font-size: 14px; } .setting-select { appearance: none; background: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-position: right 10px center; background-repeat: no-repeat; border: 1px solid #e4e4e4; border-radius: 12px; color: #1a1a2e; cursor: pointer; font-size: 14px; min-width: 80px; outline: none; padding: 8px 30px 8px 13px; } .mode-select { min-width: 116px; } .toggle-switch { display: inline-block; height: 26px; position: relative; width: 48px; } .toggle-switch input { height: 0; opacity: 0; width: 0; } .toggle-slider { background-color: #e4e4e4; border-radius: 999px; bottom: 0; cursor: pointer; left: 0; position: absolute; right: 0; top: 0; transition: 0.3s; } .toggle-slider::before { background-color: #fff; border-radius: 50%; bottom: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); content: ""; height: 20px; left: 3px; position: absolute; transition: 0.3s; width: 20px; } input:checked + .toggle-slider { background-color: #1a1a2e; } input:checked + .toggle-slider::before { transform: translateX(22px); } .width-input-wrap { align-items: center; background: #fff; border: 1px solid #e4e4e4; border-radius: 12px; display: flex; height: 36px; min-width: 116px; padding: 0 10px 0 12px; } .width-input { background: transparent; border: 0; color: #1a1a2e; font-size: 14px; min-width: 0; outline: none; text-align: right; width: 68px; } .width-input.invalid { color: #ef4444; } .width-unit { color: #999; font-size: 12px; margin-left: 5px; } .description { color: #999; font-size: 12px; line-height: 1.6; margin-bottom: 20px; } .capture-btn, .select-btn { border: 0; border-radius: 12px; cursor: pointer; font-size: 15px; font-weight: 600; padding: 14px 24px; transition: background 0.2s, transform 0.2s; width: 100%; } .capture-btn { background: #1a1a2e; color: #fff; } .capture-btn:hover { background: #2d2d44; transform: translateY(-1px); } .select-btn { background: #f4f4f6; color: #1a1a2e; margin-top: 10px; } .select-btn:hover { background: #ececf1; transform: translateY(-1px); } .capture-btn:disabled, .select-btn:disabled { cursor: not-allowed; opacity: 0.6; transform: none; } .capture-btn.success { background: #10b981; } .capture-btn.error { background: #ef4444; } .status { margin-top: 16px; padding: 12px 0 0; } .progress-bar { background: #f0f0f0; border-radius: 999px; height: 4px; margin-bottom: 8px; overflow: hidden; } .progress-fill { background: linear-gradient(90deg, #00d2ff, #7c3aed); border-radius: 999px; height: 100%; transition: width 0.3s ease; width: 0; } .status-text { color: #666; font-size: 12px; } .help-link { align-items: center; border: 1px solid #e6e8f2; border-radius: 12px; color: #2450ff; display: flex; font-size: 12px; font-weight: 600; justify-content: center; margin-top: 16px; padding: 10px 12px; text-decoration: none; transition: background 0.18s, border-color 0.18s, color 0.18s; width: 100%; } .help-link:hover { background: #f6f8ff; border-color: #dfe5ff; } .footer { align-items: center; background: #fff; border-top: 1px solid #f0f0f0; color: #666; display: flex; font-size: 12px; gap: 8px; justify-content: space-between; padding: 12px 20px; } .support-email { color: #888; font-size: 10px; line-height: 1.35; min-width: 0; text-align: right; text-decoration: none; } .support-email:hover { color: #2450ff; } `; } function panelHtml() { return `