Dwell timers no longer stall on phones: a focused ad frame or a touch device counts as an active tab (Brian Holland 2026-10-09: no timer, no close on the welcome tour and verified ads on mobile)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+4
-2
@@ -3,6 +3,8 @@
|
||||
(async function () {
|
||||
// back-office shell: no marketing nav here; rehearsal notice lives in the top bar
|
||||
const $ = IAP.$;
|
||||
// dwell timers pause when the tab is away; a focused ad frame or a touch device counts as active (phones never report hasFocus reliably)
|
||||
const tabActive = () => document.visibilityState === 'visible' && (document.hasFocus() || !!(document.activeElement && document.activeElement.tagName === 'IFRAME') || (window.matchMedia && window.matchMedia('(pointer: coarse)').matches));
|
||||
try {
|
||||
const c = await IAP.getConfig();
|
||||
if (c.rehearsal && $('boRehearsal')) {
|
||||
@@ -2281,7 +2283,7 @@
|
||||
refresh();
|
||||
// countdown pauses off-tab; the server separately enforces the dwell on its own clock
|
||||
ibTimer = setInterval(() => {
|
||||
if (document.visibilityState !== 'visible' || !document.hasFocus()) return;
|
||||
if (!tabActive()) return;
|
||||
left -= 1;
|
||||
if (left > 0) { refresh(); return; }
|
||||
clearInterval(ibTimer);
|
||||
@@ -2849,7 +2851,7 @@
|
||||
$('ggTimer').textContent = left + 's';
|
||||
await new Promise(done => {
|
||||
const t = setInterval(() => {
|
||||
if (document.visibilityState !== 'visible' || !document.hasFocus()) return;
|
||||
if (!tabActive()) return;
|
||||
left -= 1;
|
||||
$('ggTimer').textContent = Math.max(0, left) + 's';
|
||||
if (left <= 0) { clearInterval(t); done(); }
|
||||
|
||||
Reference in New Issue
Block a user