SeaWolf-AI commited on
Commit
4464590
ยท
verified ยท
1 Parent(s): fccc0d5

Sign-in opens in a new tab when the page runs inside the HF frame

Browse files
Files changed (1) hide show
  1. challenge.html +7 -1
challenge.html CHANGED
@@ -360,4 +360,10 @@ document.getElementById('f').onsubmit=async e=>{e.preventDefault();const d=Objec
360
  try{const r=await fetch('/api/rt/submit',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json'},body:JSON.stringify(d)});const j=await r.json();
361
  if(j.relogin){m.innerHTML=T('Please sign in again before submitting. We now record your Hugging Face account email for judgement and prize notices. ','์ œ์ถœ ์ „์— ๋‹ค์‹œ ๋กœ๊ทธ์ธํ•ด ์ฃผ์„ธ์š”. ํŒ์ •๊ณผ ์ƒ๊ธˆ ์•ˆ๋‚ด๋ฅผ ์œ„ํ•ด Hugging Face ๊ณ„์ • ์ด๋ฉ”์ผ์„ ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค. ')+'<a href="/login" target="_top">'+T('Sign in again','๋‹ค์‹œ ๋กœ๊ทธ์ธ')+'</a>';return}m.textContent=r.ok?(T('Received: ','์ ‘์ˆ˜๋จ: ')+j.id+T(' ยท left today ',' ยท ์˜ค๋Š˜ ๋‚จ์€ ์ œ์ถœ ')+j.left_today):(j.error||'error');if(r.ok)e.target.reset()}catch(x){m.textContent='error'}};
362
  render();
363
- </script></body></html>
 
 
 
 
 
 
 
360
  try{const r=await fetch('/api/rt/submit',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json'},body:JSON.stringify(d)});const j=await r.json();
361
  if(j.relogin){m.innerHTML=T('Please sign in again before submitting. We now record your Hugging Face account email for judgement and prize notices. ','์ œ์ถœ ์ „์— ๋‹ค์‹œ ๋กœ๊ทธ์ธํ•ด ์ฃผ์„ธ์š”. ํŒ์ •๊ณผ ์ƒ๊ธˆ ์•ˆ๋‚ด๋ฅผ ์œ„ํ•ด Hugging Face ๊ณ„์ • ์ด๋ฉ”์ผ์„ ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค. ')+'<a href="/login" target="_top">'+T('Sign in again','๋‹ค์‹œ ๋กœ๊ทธ์ธ')+'</a>';return}m.textContent=r.ok?(T('Received: ','์ ‘์ˆ˜๋จ: ')+j.id+T(' ยท left today ',' ยท ์˜ค๋Š˜ ๋‚จ์€ ์ œ์ถœ ')+j.left_today):(j.error||'error');if(r.ok)e.target.reset()}catch(x){m.textContent='error'}};
362
  render();
363
+ </script><script>/* HF shows this Space inside a frame that cannot navigate the whole page. Sign-in then opens in a new tab. */
364
+ (function(){var inF;try{inF=window.self!==window.top}catch(e){inF=true}if(!inF)return;
365
+ document.addEventListener("click",function(e){var a=e.target.closest&&e.target.closest('a[href="/login"],a[href="/logout"]');if(!a)return;
366
+ e.preventDefault();window.open(location.origin+a.getAttribute("href"),"_blank");
367
+ var n=document.getElementById("loginNewTab");if(!n){n=document.createElement("div");n.id="loginNewTab";n.style.cssText="position:fixed;left:50%;top:14px;transform:translateX(-50%);z-index:99;background:#111827;color:#fff;padding:9px 14px;border-radius:10px;font:600 13px system-ui,sans-serif";document.body.appendChild(n)}
368
+ n.textContent=(document.documentElement.lang==="ko")?"๋กœ๊ทธ์ธ ์ฐฝ์ด ์ƒˆ ํƒญ์—์„œ ์—ด๋ ธ์Šต๋‹ˆ๋‹ค. ๊ทธ ํƒญ์—์„œ ์ด์–ด ํ•˜์„ธ์š”.":"Sign-in opened in a new tab. Continue there.";},true);})();</script>
369
+ </body></html>