|
| 1 | +<!doctype html> |
| 2 | +<html lang="zh-CN"> |
| 3 | +<head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | + <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'"> |
| 7 | + <style> |
| 8 | + :root { |
| 9 | + color-scheme: light dark; |
| 10 | + --line: color-mix(in srgb, CanvasText 16%, transparent); |
| 11 | + --secondary: color-mix(in srgb, CanvasText 68%, Canvas); |
| 12 | + } |
| 13 | + [hidden] { display: none !important; } |
| 14 | + body { |
| 15 | + margin: 0; min-height: 100vh; display: flex; flex-direction: column; |
| 16 | + background: Canvas; color: CanvasText; font: 14px/1.5 system-ui, sans-serif; |
| 17 | + } |
| 18 | + header { |
| 19 | + box-sizing: border-box; height: 52px; flex: none; padding: 0 12px; |
| 20 | + display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); |
| 21 | + } |
| 22 | + .page { flex: 1; min-width: 0; line-height: 1.25; } |
| 23 | + .page > * { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } |
| 24 | + h1 { font-size: 14px; font-weight: 500; } |
| 25 | + #context { margin-top: 3px; color: var(--secondary); font-size: 12px; } |
| 26 | + main { flex: 1; display: grid; place-items: center; } |
| 27 | + .feedback { box-sizing: border-box; padding: 24px; max-width: 420px; text-align: center; } |
| 28 | + [role="status"] { margin: 0; } |
| 29 | + #spinner { |
| 30 | + box-sizing: border-box; width: 24px; height: 24px; margin: 0 auto 14px; |
| 31 | + border: 2px solid color-mix(in srgb, CanvasText 20%, transparent); |
| 32 | + border-top-color: CanvasText; border-radius: 50%; animation: spin 900ms linear infinite; |
| 33 | + } |
| 34 | + button { |
| 35 | + padding: 4px 12px; min-height: 32px; font: inherit; white-space: nowrap; |
| 36 | + background: Canvas; color: CanvasText; border: 1px solid var(--line); |
| 37 | + border-radius: 8px; cursor: pointer; |
| 38 | + } |
| 39 | + button:hover { background: color-mix(in srgb, CanvasText 8%, Canvas); } |
| 40 | + button:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; } |
| 41 | + .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; } |
| 42 | + .actions button { margin-top: 16px; } |
| 43 | + @keyframes spin { to { transform: rotate(360deg); } } |
| 44 | + @media (prefers-reduced-motion: reduce) { #spinner { animation: none; } } |
| 45 | + </style> |
| 46 | +</head> |
| 47 | +<body> |
| 48 | + <header aria-label="登录浏览器"> |
| 49 | + <button id="leave" type="button">返回运营台</button> |
| 50 | + <div class="page"> |
| 51 | + <h1 id="platform">平台账号登录</h1> |
| 52 | + <p id="context" aria-live="polite"></p> |
| 53 | + </div> |
| 54 | + <button id="back" type="button" hidden>返回登录页</button> |
| 55 | + <button id="reload" type="button" hidden>重新加载</button> |
| 56 | + <button id="direct-toolbar" type="button" hidden>直连重试</button> |
| 57 | + </header> |
| 58 | + <main id="feedback"> |
| 59 | + <div class="feedback"> |
| 60 | + <div id="spinner" aria-hidden="true"></div> |
| 61 | + <p id="message" role="status">正在加载平台登录页…</p> |
| 62 | + <div class="actions"> |
| 63 | + <button id="retry" type="button" hidden>重试</button> |
| 64 | + <button id="direct" type="button" hidden>直连重试</button> |
| 65 | + </div> |
| 66 | + </div> |
| 67 | + </main> |
| 68 | + <script> |
| 69 | + const elements = Object.fromEntries( |
| 70 | + ['leave', 'platform', 'context', 'back', 'reload', 'feedback', 'spinner', 'message', 'retry', 'direct', 'direct-toolbar'] |
| 71 | + .map(id => [id, document.getElementById(id)]) |
| 72 | + ) |
| 73 | + for (const [id, action] of [['leave', 'leave'], ['back', 'back'], ['reload', 'retry'], ['retry', 'retry'], ['direct', 'direct'], ['direct-toolbar', 'direct']]) { |
| 74 | + elements[id].addEventListener('click', () => { |
| 75 | + history.replaceState(null, '', location.href.split('#')[0]) |
| 76 | + location.hash = action |
| 77 | + }) |
| 78 | + } |
| 79 | + globalThis.renderSocialLogin = ({ label, hostname, authorization, notice, message, retry, directRetry }) => { |
| 80 | + document.title = label |
| 81 | + elements.platform.textContent = label |
| 82 | + elements.context.textContent = notice || hostname |
| 83 | + elements.context.title = notice || hostname |
| 84 | + elements.back.hidden = !authorization |
| 85 | + elements.reload.hidden = Boolean(message || authorization) |
| 86 | + elements['direct-toolbar'].hidden = Boolean(message || authorization || !directRetry) |
| 87 | + elements.feedback.hidden = !message |
| 88 | + elements.message.textContent = message || '' |
| 89 | + elements.spinner.hidden = retry |
| 90 | + elements.retry.hidden = !retry |
| 91 | + elements.direct.hidden = !retry || !directRetry || authorization |
| 92 | + } |
| 93 | + </script> |
| 94 | +</body> |
| 95 | +</html> |
0 commit comments