Login ad: frame the sponsor's page inside the gate under the timer bar (open-in-tab link, dashboard button), new-tab fallback only when the site refuses framing (Brian Holland: no timer, no way out on the ad tab)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-09 09:16:51 -05:00
parent efb6020e40
commit 7d20cd2c35
3 changed files with 52 additions and 11 deletions
+29 -7
View File
@@ -2994,11 +2994,12 @@
if (r.account) fillLineBanner(r.account);
}));
// ── login ad interstitial (ClickBaitPays pattern): after a successful
// sign-in the sponsor card appears; "Open Ad" opens the CTA link in a NEW
// tab (a real, counted click) while the timer counts down on THIS page —
// deliberately not paused, the member is expected to be in the ad tab.
// At zero, "Go to dashboard" appears.
// ── login ad interstitial: after a successful sign-in the sponsor card
// appears; "Open Ad" loads the sponsor's page INSIDE the gate, under our bar
// (countdown, open-in-new-tab, dashboard button), so the timer and the way
// out sit on the ad itself (Brian Holland, 2026-10-09: "no timer, no X").
// Sites that refuse framing open in a new tab instead, with the bar saying
// so; the timer is not paused, the member is expected to be on the ad.
async function showLoginAd() {
try {
const { ad } = await (await fetch('/api/ads/slot?type=login')).json();
@@ -3007,19 +3008,38 @@
const openBtn = $('lgOpen');
const goBtn = $('lgContinue');
const timer = $('lgTimer');
const frame = $('lgFrame');
const tab = $('lgOpenTab');
const body = gate.querySelector('.lgate-body');
const framed = !!(ad.frameable && frame);
$('lgCreative').innerHTML = ad.imageUrl
? '<img src="' + ad.imageUrl + '" alt="sponsor ad">'
: '<span class="lg-linkcard">' + (ad.title ? String(ad.title).replace(/[&<>]/g, '') : 'Visit today\'s sponsor') + '</span>';
$('lgStatus').textContent = 'Login ad sponsor — click "Open Ad" to begin.';
const how = $('lgHow');
if (how) how.textContent = framed
? 'The sponsor\'s page opens right here under this bar. The timer counts down at the top; when it hits zero, your dashboard button appears beside it.'
: 'This sponsor\'s site does not allow loading inside a frame, so it opens in a new tab. The timer counts down here; come back to this tab when it hits zero for your dashboard button.';
timer.hidden = true;
goBtn.hidden = true;
if (tab) tab.hidden = true;
if (frame) { frame.hidden = true; frame.src = 'about:blank'; }
if (body) body.hidden = false;
openBtn.disabled = false;
gate.hidden = false;
await new Promise(done => {
openBtn.onclick = () => {
window.open(ad.targetUrl, '_blank'); // the click relay counts it
openBtn.disabled = true;
$('lgStatus').textContent = 'Ad open in a new tab. View it and come back — the timer runs here.';
if (framed) {
frame.src = ad.targetUrl; // the click relay counts it, then redirects inside the frame
frame.hidden = false;
if (body) body.hidden = true;
if (tab) { tab.href = ad.siteUrl || ad.targetUrl; tab.hidden = false; }
$('lgStatus').textContent = 'Today\'s sponsor. Have a look; your dashboard button appears when the timer ends.';
} else {
window.open(ad.targetUrl, '_blank'); // the click relay counts it
$('lgStatus').textContent = 'The sponsor opened in a new tab (that site does not allow framing). View it and come back; the timer runs here.';
}
let left = ad.dwell || 10;
timer.hidden = false;
timer.textContent = 'Time remaining: ' + left + 's';
@@ -3036,6 +3056,8 @@
};
});
gate.hidden = true;
if (frame) { frame.src = 'about:blank'; frame.hidden = true; }
if (body) body.hidden = false;
$('lgTimer').classList.remove('done');
} catch (e) {}
}
+5 -3
View File
@@ -66,15 +66,17 @@
<span class="lg-brand">Instant<em>AdPay</em></span>
<span class="lgate-note small muted" id="lgStatus">Login ad sponsor — click "Open Ad" to begin.</span>
<span class="lg-timer mono" id="lgTimer" hidden>…</span>
<a class="btn small sec" id="lgOpenTab" target="_blank" rel="noopener" hidden title="Signing up is easier in a full tab">Open site in a new tab ↗</a>
<button class="btn small" id="lgContinue" type="button" hidden>Go to dashboard</button>
</div>
<iframe class="lgate-frame" id="lgFrame" hidden sandbox="allow-scripts allow-same-origin allow-forms allow-popups" referrerpolicy="no-referrer" title="Sponsor site"></iframe>
<div class="lgate-body">
<div class="lgate-card">
<p class="eyebrow">Today's login sponsor</p>
<div id="lgCreative"></div>
<p style="margin-top:18px"><button class="btn" id="lgOpen" type="button">Open Ad</button></p>
<p class="small muted">The ad opens in a new tab. The timer counts down right here —
when it hits zero, your dashboard button appears above.</p>
<p class="small muted" id="lgHow">The sponsor's page opens right here under this bar. The timer counts down at the top;
when it hits zero, your dashboard button appears beside it.</p>
<p class="small muted" style="margin-top:10px;opacity:.85">Why you are seeing this again:
to keep resources optimised we do not keep anyone signed in for longer than
<strong>4 hours</strong>. After that your session ends and you re-authenticate here.
@@ -1149,7 +1151,7 @@
<script src="/assets/common.js?v=20261007a"></script><script src="/assets/welcome.js?v=20260923b"></script>
<script src="/assets/wallet.js?v=20260911a"></script>
<script src="/assets/promo.js?v=20261007ra"></script>
<script src="/assets/my.js?v=20261009b"></script>
<script src="/assets/my.js?v=20261009c"></script>
<script src="/assets/chat.js?v=20260907l"></script>
</body>
</html>