Presentation page + Build Wide 'wide' join angle
- /presentation: the narrated InstantAdPay presentation (video on Spaces
training/iap-presentation.mp4, poster .jpg), caption pills for
en/it/fr/es/de/pt (VTTs served from /captions, text/vtt MIME added),
sponsor card from /api/sponsor ("Shared with you by @name" + Join to
/join/<ref>?v=wide, or the plain join link). Works framed: join and
sign-in open a new tab, internal links carry ?ref.
- Site menu + footer: Presentation. Sitemap, Traffic pages and the viral
page list include it. Promo tools: "Share the presentation" strip copies
instantadpay.com/presentation?ref=<username>.
- 'wide' join angle (Width unlocks depth.): server JOIN_ANGLES with the
buildwide poster as og:image, join.js angle (portrait video on phones,
16:9 otherwise, files promo/buildwide*), link stats row, promo VIDEOS
first entry with a per-entry file override, front-door list entry.
- Chatbot: presentation canned answer + facts, ?v=wide in the angle lists,
KNOWLEDGE_DATE 2026-10-15.
- common.js/my.js/promo.js/join.js cache tags bumped; qa/walk.mjs PUBLIC
gains /presentation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
// /presentation (2026-10-15): the narrated Build Wide presentation, caption language pills, and a
|
||||
// sponsor card for whoever shared the link. Public, no sign-in. Works framed (traffic exchanges):
|
||||
// join and sign-in open in a new tab and every internal link carries the sharer's ?ref, because a
|
||||
// cross-site frame usually cannot keep the sponsor cookie.
|
||||
(async function () {
|
||||
const $ = id => document.getElementById(id);
|
||||
const esc = t => String(t || '').replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||
const framed = (() => { try { return window.top !== window.self; } catch (e) { return true; } })();
|
||||
const ref = String(new URLSearchParams(location.search).get('ref') || '').trim().toLowerCase().replace(/[^a-z0-9_]/g, '').slice(0, 20);
|
||||
try { await IAP.renderNav('presentation'); } catch (e) {}
|
||||
|
||||
// ---- caption pills: Off + one per track; a non-English browser starts in its own language
|
||||
const v = $('prVideo'), bar = $('prCaps');
|
||||
const NAMES = { en: 'English', it: 'Italiano', fr: 'Français', es: 'Español', de: 'Deutsch', pt: 'Português' };
|
||||
const tracks = () => [...(v.textTracks || [])].filter(t => t.kind === 'captions' || t.kind === 'subtitles');
|
||||
function show(lang) {
|
||||
tracks().forEach(t => { t.mode = lang && String(t.language).toLowerCase() === lang ? 'showing' : 'disabled'; });
|
||||
bar.querySelectorAll('button').forEach(b => b.setAttribute('aria-pressed', b.dataset.lang === (lang || '') ? 'true' : 'false'));
|
||||
try { localStorage.setItem('iap.capLang', lang || 'off'); } catch (e) {}
|
||||
}
|
||||
if (v && bar) {
|
||||
bar.innerHTML = '<span class="lab">Captions</span>' + ['', 'en', 'it', 'fr', 'es', 'de', 'pt'].map(l => '<button type="button" data-lang="' + l + '" aria-pressed="false">' + (l ? NAMES[l] : 'Off') + '</button>').join('');
|
||||
bar.querySelectorAll('button').forEach(b => b.addEventListener('click', () => show(b.dataset.lang)));
|
||||
let start = '';
|
||||
try { start = localStorage.getItem('iap.capLang') || ''; } catch (e) {}
|
||||
if (!start) { const nav = String(navigator.language || '').slice(0, 2).toLowerCase(); start = NAMES[nav] && nav !== 'en' ? nav : 'off'; }
|
||||
show(start === 'off' ? '' : start);
|
||||
}
|
||||
|
||||
// ---- links: join / sign-in open a new tab when framed; internal links carry ?ref
|
||||
function decorate(root) {
|
||||
root.querySelectorAll('a[href]').forEach(a => {
|
||||
const h = a.getAttribute('href');
|
||||
if (!h || !h.startsWith('/') || h.startsWith('//') || h.startsWith('/api/')) return;
|
||||
if (framed && /^\/(my|join)(\/|$|\?|#)/.test(h)) { a.target = '_blank'; a.rel = 'noopener'; }
|
||||
if (ref && !/^\/join\//.test(h) && !/[?&]ref=/.test(h)) { const [p, hash] = h.split('#'); a.setAttribute('href', p + (p.includes('?') ? '&' : '?') + 'ref=' + ref + (hash ? '#' + hash : '')); }
|
||||
});
|
||||
}
|
||||
|
||||
// ---- sponsor card: the link's owner (?ref) first, then the visitor's sponsor cookie
|
||||
try {
|
||||
const sp = await (await fetch('/api/sponsor' + (ref ? '?ref=' + encodeURIComponent(ref) : ''))).json();
|
||||
const tok = ref || (sp && sp.ref) || '';
|
||||
if (sp && sp.name && tok && !sp.own) {
|
||||
$('prHead').innerHTML = 'Shared with you by <b>' + esc(sp.name) + '</b>';
|
||||
$('prText').textContent = sp.bio ? sp.bio : 'They can help you get set up in a few minutes, and they will be your sponsor on every platform in the network.';
|
||||
$('prJoin').textContent = 'Join with ' + sp.name;
|
||||
$('prJoin').href = '/join/' + encodeURIComponent(tok) + '?v=wide';
|
||||
$('prIni').textContent = String(sp.name).replace(/^@/, '').slice(0, 1).toUpperCase() || '?';
|
||||
if (sp.avatarUrl && /^https:\/\//.test(sp.avatarUrl)) { const im = $('prImg'); im.src = sp.avatarUrl; im.alt = sp.name; im.hidden = false; $('prIni').hidden = true; im.onerror = () => { im.hidden = true; $('prIni').hidden = false; }; }
|
||||
} else if (sp && sp.own) {
|
||||
$('prHead').textContent = 'This is your presentation link';
|
||||
$('prText').textContent = 'Anyone who opens it sees you here, with a Join button that puts them on your line. Copy it from Promo tools.';
|
||||
$('prJoin').textContent = 'Open Promo tools'; $('prJoin').href = '/my#promo';
|
||||
} else {
|
||||
$('prJoin').href = '/join';
|
||||
}
|
||||
} catch (e) {}
|
||||
if (framed) { $('prJoin').target = '_blank'; $('prJoin').rel = 'noopener'; }
|
||||
decorate(document);
|
||||
setTimeout(() => decorate(document), 1500); // the nav's sign-in link arrives after /api/me
|
||||
})();
|
||||
Reference in New Issue
Block a user