017017ad63
- Game sign-in kit (game-signin.js): after a fresh email sign-in (never a remembered pass) the kit shows the login ad before the hand-off to /auth?t=, same as the dashboard: sponsor card, Open Ad (a counted click through /api/ads/click), sponsor framed in a full-screen overlay when frameable else a new tab, 10 s countdown (loginDwellSeconds), then Continue to the game. No ad, an error, a non-200 or a 7 s stall all go straight to the game. A game page whose CSP blocks the frame gets a new-tab link instead. mount option loginAd: false switches it off. - GET /api/game/ads/login?game=<slug>: CORS only for that game's GAME_AUTH origins (dev: localhost); the dashboard /api/ads/slot route keeps no CORS. Both share loginAdFor() (ads.serve: impression + lastShownDay as before). Drip Runner and PolyBreak are marked frames: false (their CSP is default-src 'self'), so their ad opens in a new tab; frame checks for games ignore an instantadpay.com-only frame-ancestors allowance. - loginshows.js: every login-ad request tallied per Central day, surface (dashboard or game slug) and kind (member slot, house, none); MySQL table login_shows (created on first use) or DATA_DIR/login-shows.json. GET /api/admin/login-shows + a Login-ad showings card on the admin Traffic pane (dashboard vs games, house, no-ad, by game). - The kit is served no-cache so games pick it up without a tag bump; admin.js tag bumped. - Chatbot fact updated (slot rules + games), KNOWLEDGE_DATE 2026-10-18. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
216 lines
21 KiB
JavaScript
216 lines
21 KiB
JavaScript
/* InstantAdPay in-game sign-in kit (2026-10-03). Served by instantadpay.com, loaded by each game's own /signin page,
|
|
so a player signs in (or opens a free InstantAdPay account) without leaving the game. Talks to /api/game/auth/*
|
|
from the player's browser; the game only ever receives its normal hand-off token, which it opens at /auth.
|
|
Host page sets theme through CSS variables on .iapsi (--si-*). Usage:
|
|
IAPSignin.mount(el, { game: 'driprunner', ref: 'skycash', oneTap: 'https://instantadpay.com/api/my/driprunner' });
|
|
IAPSignin.enter('wallet'); // nudge: opens InstantAdPay in a new tab, already signed in
|
|
After a fresh sign-in (never on a remembered pass) the kit shows the InstantAdPay login ad before the hand-off,
|
|
same as the dashboard: sponsor card, Open Ad (a counted click), 10 s countdown, then Continue. Any ad error,
|
|
or no ad to show, goes straight to the game. mount option loginAd: false switches it off (2026-10-18). */
|
|
(function () {
|
|
var IAP = 'https://instantadpay.com';
|
|
try { var me = document.currentScript && document.currentScript.src; if (me) IAP = new URL(me).origin; } catch (e) {}
|
|
var PASS_KEY = 'iap.gamepass', DEV_KEY = 'iap.gdev';
|
|
function ls(k, v) { try { if (v === undefined) return localStorage.getItem(k); if (v === null) localStorage.removeItem(k); else localStorage.setItem(k, v); } catch (e) { return null; } }
|
|
function devId() { var d = ls(DEV_KEY); if (!/^[a-f0-9]{32}$/.test(d || '')) { d = ''; var a = new Uint8Array(16); (window.crypto || window.msCrypto).getRandomValues(a); for (var i = 0; i < 16; i++) d += ('0' + a[i].toString(16)).slice(-2); ls(DEV_KEY, d); } return d; }
|
|
function getPass() { try { var p = JSON.parse(ls(PASS_KEY) || 'null'); return p && p.p && p.exp > Date.now() ? p : null; } catch (e) { return null; } }
|
|
// the one-tap link carries the inviter's ref too, so a new player who taps it still gets their sponsor (2026-10-05)
|
|
function oneTapUrl(opt) { var u = String(opt.oneTap || ''), r = String(opt.ref || '').toLowerCase().replace(/[^a-z0-9_]/g, '').slice(0, 20); if (!r || /[?&]ref=/.test(u)) return u; return u + (u.indexOf('?') < 0 ? '?' : '&') + 'ref=' + encodeURIComponent(r); }
|
|
function esc(s) { return String(s == null ? '' : s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); }
|
|
function post(path, body) {
|
|
return fetch(IAP + path, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body), credentials: 'omit' })
|
|
.then(function (r) { return r.json().catch(function () { return {}; }).then(function (j) { j._status = r.status; return j; }); })
|
|
.catch(function () { return { _status: 0, error: 'Could not reach InstantAdPay. Check your connection and try again.' }; });
|
|
}
|
|
var CSS = '.iapsi{--a:var(--si-accent,#7c5cff);--ai:var(--si-accent-ink,#fff);--ink:var(--si-ink,#f2efff);--mu:var(--si-muted,#b7b0d6);--fl:var(--si-field,rgba(255,255,255,.06));--ln:var(--si-line,rgba(255,255,255,.18));color:var(--ink);font-family:var(--si-font,system-ui,sans-serif);display:grid;gap:14px}'
|
|
+ '.iapsi h2{margin:0;font-size:22px;line-height:1.2}.iapsi p{margin:0;color:var(--mu);font-size:14.5px;line-height:1.5}.iapsi b{color:var(--ink)}'
|
|
+ '.iapsi label.f{display:grid;gap:6px;font-size:13px;color:var(--mu)}.iapsi input.t{font:inherit;font-size:17px;padding:12px 14px;border-radius:12px;border:1px solid var(--ln);background:var(--fl);color:var(--ink);width:100%;box-sizing:border-box}'
|
|
+ '.iapsi input.t:focus{outline:2px solid var(--a);outline-offset:1px}.iapsi input.code{letter-spacing:.4em;text-align:center;font-size:22px}'
|
|
+ '.iapsi .go{font:inherit;font-weight:700;font-size:16px;padding:13px 16px;border:0;border-radius:12px;background:var(--a);color:var(--ai);cursor:pointer;width:100%}.iapsi .go[disabled]{opacity:.55;cursor:default}'
|
|
+ '.iapsi .lk{background:none;border:0;padding:0;font:inherit;font-size:13.5px;color:var(--mu);text-decoration:underline;cursor:pointer}.iapsi .lk[disabled]{opacity:.5;cursor:default;text-decoration:none}'
|
|
+ '.iapsi form{display:grid;gap:12px;margin:0}.iapsi .row{display:flex;gap:14px;flex-wrap:wrap;justify-content:space-between}.iapsi label.ck{display:flex!important;gap:10px;align-items:flex-start;font-size:13px;color:var(--mu);margin:0}.iapsi .ck input{margin:3px 0 0;width:auto!important;flex:0 0 auto;height:auto;padding:0}.iapsi .ck span{flex:1}.iapsi .err:empty{display:none}'
|
|
+ '.iapsi .err{color:var(--si-bad,#ff8a8a);font-size:14px;min-height:1px}.iapsi .fine{font-size:12px;color:var(--mu)}.iapsi .fine a{color:var(--mu)}'
|
|
+ '.iapsi .hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}.iapsi .chal{display:flex;gap:8px;flex-wrap:wrap}.iapsi .chal button{font-size:26px;width:52px;height:52px;border-radius:12px;border:1px solid var(--ln);background:var(--fl);cursor:pointer}'
|
|
// login-ad gate (full screen, above the game page)
|
|
+ '.iapla{position:fixed;inset:0;z-index:2147483000;display:flex;flex-direction:column;background:var(--si-ground,#0d0b1a);color:var(--si-ink,#f2efff);font-family:var(--si-font,system-ui,sans-serif)}'
|
|
+ '.iapla-bar{display:flex;align-items:center;gap:10px 14px;flex-wrap:wrap;padding:10px 16px;background:var(--si-panel,#17142b);border-bottom:1px solid var(--si-line,rgba(255,255,255,.18))}'
|
|
+ '.iapla-brand{font-weight:800;font-size:15px;white-space:nowrap}.iapla-brand em{color:var(--si-accent,#7c5cff);font-style:normal}.iapla-note{flex:1;min-width:140px;font-size:13px;color:var(--si-muted,#b7b0d6)}'
|
|
+ '.iapla-timer{font-weight:700;font-size:14px;border:1px solid var(--si-line,rgba(255,255,255,.3));border-radius:999px;padding:4px 12px;white-space:nowrap}.iapla-timer.done{color:var(--si-accent,#7c5cff);border-color:var(--si-accent,#7c5cff)}'
|
|
+ '.iapla-btn{font:inherit;font-weight:700;font-size:14px;padding:9px 14px;border:0;border-radius:10px;background:var(--si-accent,#7c5cff);color:var(--si-accent-ink,#fff);cursor:pointer;text-decoration:none;white-space:nowrap}'
|
|
+ '.iapla-btn.sec{background:transparent;color:var(--si-ink,#f2efff);border:1px solid var(--si-line,rgba(255,255,255,.3))}.iapla-btn[disabled]{opacity:.55;cursor:default}.iapla-btn.big{font-size:17px;padding:13px 22px}'
|
|
+ '.iapla-frame{flex:1;border:0;width:100%;background:#fff;min-height:0}.iapla-body{flex:1;display:grid;place-items:center;padding:24px 16px;overflow:auto}'
|
|
+ '.iapla-card{max-width:560px;text-align:center;display:grid;gap:16px;justify-items:center}.iapla-card p{margin:0;font-size:14px;line-height:1.5;color:var(--si-muted,#b7b0d6)}'
|
|
+ '.iapla-eye{font-size:12px;letter-spacing:.12em;text-transform:uppercase}.iapla-card img{max-width:100%;max-height:50vh;border-radius:12px;border:1px solid var(--si-line,rgba(255,255,255,.18))}'
|
|
+ '.iapla-link{display:inline-block;font-size:20px;font-weight:700;color:var(--si-ink,#f2efff);background:var(--si-field,rgba(255,255,255,.06));border:1px solid var(--si-line,rgba(255,255,255,.18));border-radius:14px;padding:18px 22px}'
|
|
+ '.iapla [hidden]{display:none!important}';
|
|
function styleOnce() { if (document.getElementById('iapsiCss')) return; var s = document.createElement('style'); s.id = 'iapsiCss'; s.textContent = CSS; document.head.appendChild(s); }
|
|
|
|
// the login ad after a fresh sign-in. `then` (the hand-off) always runs exactly once: when the gate is done,
|
|
// when there is no ad, or on any error or a slow answer, so an ad can never hold a player out of the game.
|
|
function loginAd(game, then) {
|
|
var over = false; function go() { if (over) return; over = true; try { then(); } catch (e) {} }
|
|
var ctl = null; try { ctl = new AbortController(); } catch (e) {}
|
|
var slow = setTimeout(function () { if (ctl) try { ctl.abort(); } catch (e) {} go(); }, 7000);
|
|
fetch(IAP + '/api/game/ads/login?game=' + encodeURIComponent(game || ''), { credentials: 'omit', signal: ctl ? ctl.signal : undefined })
|
|
.then(function (r) { return r.ok ? r.json() : {}; })
|
|
.then(function (j) { clearTimeout(slow); if (over) return; var ad = j && j.ad; if (!ad || !ad.targetUrl) return go(); gate(ad, go); })
|
|
.catch(function () { clearTimeout(slow); go(); });
|
|
}
|
|
function gate(ad, go) {
|
|
var abs = function (u) { return /^https?:/i.test(u) ? u : IAP + u; };
|
|
var click = abs(ad.targetUrl), site = ad.siteUrl || click, framed = !!ad.frameable, started = false, t = null;
|
|
var g = document.createElement('div'); g.className = 'iapla'; g.setAttribute('role', 'dialog'); g.setAttribute('aria-label', 'Login sponsor');
|
|
g.innerHTML = '<div class="iapla-bar"><span class="iapla-brand">Instant<em>AdPay</em></span>'
|
|
+ '<span class="iapla-note" data-st>Login ad sponsor. Tap "Open Ad" to begin.</span>'
|
|
+ '<span class="iapla-timer" data-tm hidden></span>'
|
|
+ '<a class="iapla-btn sec" data-tab target="_blank" rel="noopener" hidden>Open site in a new tab \u2197</a>'
|
|
+ '<button class="iapla-btn" type="button" data-go hidden>Continue to the game</button></div>'
|
|
+ '<iframe class="iapla-frame" data-fr hidden sandbox="allow-scripts allow-same-origin allow-forms allow-popups" referrerpolicy="no-referrer" title="Sponsor site"></iframe>'
|
|
+ '<div class="iapla-body" data-bd><div class="iapla-card"><p class="iapla-eye">Today\'s login sponsor</p>'
|
|
+ (ad.imageUrl ? '<img src="' + esc(ad.imageUrl) + '" alt="sponsor ad">' : '<span class="iapla-link">' + esc(ad.title || 'Visit today\'s sponsor') + '</span>')
|
|
+ '<button class="iapla-btn big" type="button" data-open>Open Ad</button>'
|
|
+ '<p>' + (framed ? 'The sponsor\'s page opens right here under this bar. When the timer hits zero, your Continue button appears beside it.'
|
|
: 'This sponsor\'s site opens in a new tab. The timer counts down here; come back when it hits zero to continue to the game.') + '</p></div></div>';
|
|
var q = function (k) { return g.querySelector('[data-' + k + ']'); };
|
|
var st = q('st'), tm = q('tm'), tab = q('tab'), btn = q('go'), fr = q('fr'), bd = q('bd'), open = q('open');
|
|
function finish() { clearInterval(t); document.removeEventListener('securitypolicyviolation', csp); try { g.remove(); } catch (e) {} go(); }
|
|
// a game page whose CSP refuses the frame: offer the sponsor in a new tab instead (the timer keeps running)
|
|
function csp(ev) {
|
|
if (!started || !framed || !/frame|child|default/.test(String(ev.violatedDirective || ev.effectiveDirective || ''))) return;
|
|
var b = String(ev.blockedURI || '');
|
|
fr.hidden = true; bd.hidden = true; tab.hidden = false;
|
|
tab.href = (!b || b.indexOf(IAP) === 0) ? click : site; // blocked before our click relay ran: the tab is the counted click
|
|
st.textContent = 'This game cannot show the sponsor here. Open it in a new tab; the timer runs here.';
|
|
}
|
|
document.addEventListener('securitypolicyviolation', csp);
|
|
open.addEventListener('click', function () {
|
|
if (started) return; started = true; open.disabled = true;
|
|
if (framed) {
|
|
fr.src = click; // the click relay counts it, then redirects inside the frame
|
|
fr.hidden = false; bd.hidden = true; tab.href = site; tab.hidden = false;
|
|
st.textContent = 'Today\'s sponsor. Have a look; your Continue button appears when the timer ends.';
|
|
} else {
|
|
try { window.open(click, '_blank'); } catch (e) {} // the click relay counts it
|
|
st.textContent = 'The sponsor opened in a new tab. View it and come back; the timer runs here.';
|
|
}
|
|
var left = Math.max(1, Number(ad.dwell) || 10);
|
|
tm.hidden = false; tm.textContent = 'Time remaining: ' + left + 's';
|
|
t = setInterval(function () {
|
|
left -= 1;
|
|
if (left > 0) { tm.textContent = 'Time remaining: ' + left + 's'; return; }
|
|
clearInterval(t); tm.textContent = 'Time is up'; tm.className = 'iapla-timer done';
|
|
st.textContent = 'Thanks for the look. Your game is ready.'; btn.hidden = false;
|
|
try { btn.focus(); } catch (e) {}
|
|
}, 1000);
|
|
});
|
|
btn.addEventListener('click', finish);
|
|
document.body.appendChild(g);
|
|
}
|
|
|
|
function mount(el, opt) {
|
|
styleOnce(); opt = opt || {};
|
|
var game = opt.game, ref = String(opt.ref || '').toLowerCase().replace(/[^a-z0-9_]/g, '').slice(0, 40), src = String(opt.src || '').toLowerCase().replace(/[^a-z0-9_.-]/g, '').slice(0, 30);
|
|
var fts = Date.now(), email = '', newsletter = true, resendAt = 0, timer = null;
|
|
var onToken = opt.onToken || function (t) { location.href = '/auth?t=' + encodeURIComponent(t); };
|
|
el.classList.add('iapsi');
|
|
function err(m) { var e = el.querySelector('.err'); if (e) e.textContent = m || ''; }
|
|
function busy(on) { var b = el.querySelector('.go'); if (b) { b.disabled = !!on; if (on) b.dataset.l = b.textContent, b.textContent = 'One moment…'; else if (b.dataset.l) b.textContent = b.dataset.l; } }
|
|
function done(r) {
|
|
if (r.pass) ls(PASS_KEY, JSON.stringify({ p: r.pass, exp: Date.now() + 29 * 86400000, email: email }));
|
|
if (r.needUsername) return stepName(r);
|
|
if (r.token) { // a fresh sign-in: the login ad first (fails open to the hand-off)
|
|
if (opt.loginAd === false) return onToken(r.token);
|
|
el.innerHTML = '<h2>You are in</h2><p>One moment\u2026</p>';
|
|
try { return loginAd(game, function () { onToken(r.token); }); } catch (e) { return onToken(r.token); }
|
|
}
|
|
err('Something went wrong. Try again.');
|
|
}
|
|
function stepEmail(msg) {
|
|
el.innerHTML = '<h2>' + esc(opt.title || 'Sign in to play') + '</h2>'
|
|
+ '<p>Use your email. We send you a 6-digit code, no password. New here? This also opens your free <b>InstantAdPay</b> account, the home of every game in the network.</p>'
|
|
+ '<form novalidate><label class="f">Email<input class="t" type="email" name="email" autocomplete="email" inputmode="email" required value="' + esc(email) + '"></label>'
|
|
+ '<input class="hp" type="text" name="hp_field_x9" tabindex="-1" autocomplete="off" aria-hidden="true">'
|
|
+ '<label class="ck"><input type="checkbox" name="nl"' + (newsletter ? ' checked' : '') + '><span>Keep me posted with the InstantAdPay newsletter (tips and updates). You can unsubscribe anytime.</span></label>'
|
|
+ '<div class="err" role="alert"></div><button class="go" type="submit">Send my code</button></form>'
|
|
+ (opt.oneTap ? '<div class="row"><a class="lk" href="' + esc(oneTapUrl(opt)) + '">Already signed in to InstantAdPay here? One tap</a></div>' : '')
|
|
+ '<p class="fine">By continuing you agree to the InstantAdPay <a href="' + IAP + '/terms" target="_blank" rel="noopener">Terms</a> and <a href="' + IAP + '/privacy" target="_blank" rel="noopener">Privacy</a> policy.</p>';
|
|
var f = el.querySelector('form'); if (msg) err(msg);
|
|
f.addEventListener('submit', function (ev) { ev.preventDefault(); send(null); });
|
|
setTimeout(function () { var i = f.email; if (i && !email) try { i.focus(); } catch (e) {} }, 50);
|
|
}
|
|
function send(pick) {
|
|
var f = el.querySelector('form');
|
|
if (f && f.email) { email = String(f.email.value || '').trim(); newsletter = !!(f.nl && f.nl.checked); }
|
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email)) return err('Enter the email you use (or want to use) for InstantAdPay.');
|
|
err(''); busy(true);
|
|
post('/api/game/auth/start', { game: game, email: email, ref: ref, src: src, fts: fts, fage: Date.now() - fts, hp_field_x9: (f && f.hp_field_x9 && f.hp_field_x9.value) || '', pick: pick || '', dev: devId() }).then(function (r) {
|
|
busy(false);
|
|
if (r.challenge) return stepChallenge(r.challenge, r.error);
|
|
if (r.ok) { resendAt = Date.now() + 60000; return stepCode(r.devCode); }
|
|
if (/already sent/i.test(r.error || '')) { resendAt = Date.now() + 60000; return stepCode(null, r.error); }
|
|
err(r.error || 'Could not send the code. Try again.');
|
|
});
|
|
}
|
|
function stepChallenge(ch, msg) {
|
|
el.innerHTML = '<h2>Quick check</h2><p>' + esc(msg || 'Before we send your code:') + ' Tap the <b>' + esc(ch.prompt) + '</b>.</p><div class="chal">'
|
|
+ ch.options.map(function (o) { return '<button type="button" data-o="' + esc(o) + '">' + esc(o) + '</button>'; }).join('') + '</div><div class="err" role="alert"></div>'
|
|
+ '<button class="lk" type="button" data-back>Use a different email</button>';
|
|
el.querySelectorAll('[data-o]').forEach(function (b) { b.addEventListener('click', function () { send(b.getAttribute('data-o')); }); });
|
|
el.querySelector('[data-back]').addEventListener('click', function () { stepEmail(); });
|
|
}
|
|
function stepCode(devCode, msg) {
|
|
el.innerHTML = '<h2>Check your email</h2><p>We sent a 6-digit code to <b>' + esc(email) + '</b>. It can take a minute. Not there? Check spam or promotions.</p>'
|
|
+ '<form novalidate><label class="f">Code<input class="t code" name="code" inputmode="numeric" autocomplete="one-time-code" maxlength="6" pattern="[0-9]*" value="' + esc(devCode || '') + '"></label>'
|
|
+ '<div class="err" role="alert"></div><button class="go" type="submit">Sign in</button></form>'
|
|
+ '<div class="row"><button class="lk" type="button" data-again>Send a new code</button><button class="lk" type="button" data-back>Use a different email</button></div>';
|
|
var f = el.querySelector('form'), again = el.querySelector('[data-again]'); if (msg) err(msg);
|
|
clearInterval(timer);
|
|
function tick() { var s = Math.ceil((resendAt - Date.now()) / 1000); again.disabled = s > 0; again.textContent = s > 0 ? 'Send a new code (' + s + 's)' : 'Send a new code'; if (s <= 0) clearInterval(timer); }
|
|
tick(); timer = setInterval(tick, 1000);
|
|
again.addEventListener('click', function () { clearInterval(timer); send(null); });
|
|
el.querySelector('[data-back]').addEventListener('click', function () { clearInterval(timer); stepEmail(); });
|
|
f.code.addEventListener('input', function () { f.code.value = f.code.value.replace(/\D/g, '').slice(0, 6); if (f.code.value.length === 6) f.requestSubmit ? f.requestSubmit() : verify(); });
|
|
f.addEventListener('submit', function (ev) { ev.preventDefault(); verify(); });
|
|
setTimeout(function () { try { f.code.focus(); } catch (e) {} }, 50);
|
|
}
|
|
function verify() {
|
|
var f = el.querySelector('form'); var code = String((f && f.code && f.code.value) || '').trim();
|
|
if (!/^\d{6}$/.test(code)) return err('Enter the 6 digits from the email.');
|
|
err(''); busy(true);
|
|
post('/api/game/auth/verify', { game: game, email: email, code: code, ref: ref, src: src, newsletter: newsletter, dev: devId() }).then(function (r) {
|
|
busy(false);
|
|
if (r.ok) { clearInterval(timer); return done(r); }
|
|
if (/expired|too many/i.test(r.error || '')) { clearInterval(timer); return stepEmail(r.error); }
|
|
err(r.error || 'That did not work. Try again.');
|
|
});
|
|
}
|
|
function stepName(r) {
|
|
el.innerHTML = '<h2>Pick your username</h2><p>This is your name in every game, on the leaderboards and in your invite link. Choose carefully: it cannot be changed later.</p>'
|
|
+ '<form novalidate><label class="f">Username<input class="t" name="u" autocomplete="username" autocapitalize="none" spellcheck="false" maxlength="20" placeholder="3 to 20 letters, numbers or _"></label>'
|
|
+ '<div class="err" role="alert"></div><button class="go" type="submit">Save and play</button></form>';
|
|
var f = el.querySelector('form');
|
|
f.u.addEventListener('input', function () { f.u.value = f.u.value.replace(/[^A-Za-z0-9_]/g, '').slice(0, 20); });
|
|
f.addEventListener('submit', function (ev) {
|
|
ev.preventDefault(); var name = f.u.value.trim();
|
|
if (!/^[A-Za-z0-9_]{3,20}$/.test(name)) return err('Usernames are 3 to 20 letters, numbers, or underscores.');
|
|
if (/^\d+$/.test(name)) return err('Usernames need at least one letter.');
|
|
var pass = getPass(); if (!pass) return stepEmail('Your sign-in expired. Start again with your email.');
|
|
err(''); busy(true);
|
|
post('/api/game/auth/username', { game: game, pass: pass.p, username: name }).then(function (x) { busy(false); if (x.ok) return done(x); err(x.error || 'That name did not work. Try another.'); });
|
|
});
|
|
setTimeout(function () { try { f.u.focus(); } catch (e) {} }, 50);
|
|
}
|
|
stepEmail();
|
|
}
|
|
|
|
// nudge: open InstantAdPay in a new tab already signed in (the pass posts in a form, never in a URL)
|
|
function enter(to) {
|
|
var pass = getPass();
|
|
if (!pass) { window.open(IAP + '/my' + (to ? '#' + to : ''), '_blank', 'noopener'); return; }
|
|
var f = document.createElement('form'); f.method = 'POST'; f.action = IAP + '/api/game/enter'; f.target = '_blank'; f.style.display = 'none';
|
|
[['p', pass.p], ['to', to || 'overview']].forEach(function (kv) { var i = document.createElement('input'); i.type = 'hidden'; i.name = kv[0]; i.value = kv[1]; f.appendChild(i); });
|
|
document.body.appendChild(f); f.submit(); setTimeout(function () { f.remove(); }, 1000);
|
|
}
|
|
window.IAPSignin = { mount: mount, enter: enter, hasPass: function () { return !!getPass(); }, forget: function () { ls(PASS_KEY, null); }, origin: IAP };
|
|
})();
|