export function renderMarketAuthGate( document: Document, currentWindow: Window, message = "请先登录插件" ): HTMLElement { const existingGate = document.querySelector( '[data-market-auth-gate="root"]' ) as HTMLElement | null; if (existingGate) { return existingGate; } const root = document.createElement("section"); root.dataset.marketAuthGate = "root"; root.innerHTML = `
打开扩展弹窗完成登录后刷新本页
`; const title = root.querySelector("strong"); if (title) { title.textContent = message; } root .querySelector('[data-market-auth-help="button"]') ?.addEventListener("click", () => { currentWindow.alert("请点击浏览器工具栏中的扩展图标完成登录"); }); document.body.prepend(root); return root; }