From ef8b256172fc5aa56b65ad7b3c751659c63f6a6b Mon Sep 17 00:00:00 2001 From: martbost Date: Tue, 6 Oct 2026 08:16:12 -0500 Subject: [PATCH] Promo tools: one Games tab (picker for all 7 games; PolHunter and Spooky Doors kits live inside it; link, share image, posts and 10 banner sizes per game); SpellWheel link fixed to spellwheel.com Co-Authored-By: Claude Opus 5.5 --- public/assets/my.js | 3 +- public/assets/promo.js | 78 +++++++++++++++++++++++++++++++----------- public/my.html | 43 ++++++++++++++--------- 3 files changed, 86 insertions(+), 38 deletions(-) diff --git a/public/assets/my.js b/public/assets/my.js index 6bc3f22..d09dd15 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -2189,7 +2189,8 @@ if ($('tkGo')) { $('tkGo').addEventListener('click', tkGenerate); $('tkAgain').addEventListener('click', tkGenerate); $('tkCopy').addEventListener('click', async () => { try { await navigator.clipboard.writeText($('tkText').value); IAP.status('Copied.', 'ok'); } catch (e) { $('tkText').select(); } }); $('tkSendBc').addEventListener('click', tkSendBroadcast); } // promo tools: pill menu switches between posts / swipes / banners / wall / videos function setPromoSub(name) { - const ids = ['toolkit', 'posts', 'text', 'swipe', 'banners', 'wall', 'objections', 'videos', 'viral', 'polhunter', 'gamebanners', 'spookydoors']; + const ids = ['toolkit', 'posts', 'text', 'swipe', 'banners', 'wall', 'objections', 'videos', 'viral', 'games']; + if (['polhunter', 'spookydoors', 'gamebanners'].includes(name)) name = 'games'; // those tabs live inside Games now (2026-10-06) if (name === 'toolkit') loadToolkit(); const pill = document.querySelector('.promo-pills [data-promo="' + name + '"]'); if (!ids.includes(name) || !pill || pill.hidden) name = 'posts'; diff --git a/public/assets/promo.js b/public/assets/promo.js index fe012d1..def1aea 100644 --- a/public/assets/promo.js +++ b/public/assets/promo.js @@ -273,30 +273,68 @@ window.IAPPromo = (function () { const d = document.createElement('div'); d.className = 'promo-block'; d.innerHTML = '
' + s + ' ' + esc(n) + '
' + s + '
' + esc(code) + '
'; const row = document.createElement('div'); row.className = 'pb-actions'; row.appendChild(copyBtn(code, 'Copy embed code')); row.appendChild(linkBtn(src, 'Open image')); d.appendChild(row); bg.appendChild(d); } } - // Game banners (2026-10-06): every network game in 10 standard sizes, hosted on banners.adrotate.xyz, each embed linked to - // the member (PolHunter takes ?r=, the other games ?ref=). Seasonal games stay listed; their banners carry no dates. - const gbs = $('promo-gamebanners'); - if (gbs && token && gbs.dataset.filled !== token) { - gbs.dataset.filled = token; + // Games (2026-10-06, Marty: one tab for every game instead of a pill each). A picker drives one panel: games with their own + // kit (PolHunter, Spooky Doors) show it; the rest get link, share image and posts. Every game gets the 10 standard banners + // from banners.adrotate.xyz, each embed linked to the member (PolHunter takes ?r=, the other games ?ref=). + const gms = $('promo-games'); + if (gms && token && gms.dataset.filled !== token) { + gms.dataset.filled = token; const enc = encodeURIComponent, CDN = 'https://banners.adrotate.xyz/game-banners/'; + const preLaunch = (y, m, d) => Date.now() < Date.UTC(y, m - 1, d, 5); // before midnight Central on that day const GAMES = [ - { slug: 'polywarriors', name: 'PolyWarriors', link: 'https://www.polywarriors.com/?ref=' }, { slug: 'gemkingdom', name: 'Gem Kingdom', link: 'https://gemkingdom.app/?ref=' }, - { slug: 'driprunner', name: 'Drip Runner', link: 'https://driprunner.app/?ref=' }, { slug: 'clutterhunt', name: 'ClutterHunt', link: 'https://clutterhunt.com/?ref=' }, - { slug: 'spellwheel', name: 'SpellWheel', link: 'https://spellwheel.app/?ref=' }, { slug: 'spookydoors', name: 'Spooky Doors', link: 'https://spookydoors.com/?ref=' }, - { slug: 'polhunter', name: 'PolHunter', link: 'https://polhunter.com/?r=' }]; + { slug: 'polywarriors', name: 'PolyWarriors', link: 'https://www.polywarriors.com/?ref=', img: 'https://www.polywarriors.com/og-polywarriors.jpg', sub: 'cyberpunk battler with NFT warrior cards', + posts: [ + { name: 'Short post', text: 'PolyWarriors is a free cyberpunk battler. Recruit warriors that are each born with their own traits, fight 12 rivals, and challenge other members. Your first warrior mints to your wallet as an NFT, free.' + (preLaunch(2026, 10, 12) ? ' Opens Monday Oct 12.' : '') + ' {L}' }, + { name: 'Friendly post', text: 'I have been playing PolyWarriors, a turn-based fighting game with a cyberpunk look. Every warrior is one of a kind, and you can mint yours and battle other members. Free to play: {L}' }] }, + { slug: 'gemkingdom', name: 'Gem Kingdom', link: 'https://gemkingdom.app/?ref=', img: 'https://gemkingdom.app/fantasy/og-gemkingdom.jpg', sub: 'fantasy match-3 with boss battles', + posts: [ + { name: 'Short post', text: 'Gem Kingdom is a free fantasy match-3. Lead three heroes, beat the Goblin Kingโ€™s bosses and rebuild your village. Boss wins come with POL rewards. Play here: {L}' }, + { name: 'Friendly post', text: 'Looking for a game to unwind with? Gem Kingdom is match-3 with a story: forge weapons, collect stars and climb the leaderboard. Free in your browser: {L}' }] }, + { slug: 'driprunner', name: 'Drip Runner', link: 'https://driprunner.app/?ref=', img: 'https://driprunner.app/og-driprunner.jpg', sub: 'quick runner game', + posts: [ + { name: 'Short post', text: 'Drip Runner is a quick free runner game. Hop the network, dodge the drones, clear chapters and refuel for POL rewards. Play in your browser: {L}' }, + { name: 'Friendly post', text: 'Got two minutes? Drip Runner is a fast little runner game I keep coming back to. See how far you get: {L}' }] }, + { slug: 'clutterhunt', name: 'ClutterHunt', link: 'https://clutterhunt.com/?ref=', img: 'https://clutterhunt.com/og-clutterhunt.jpg', sub: 'seasonal hidden-object game', + posts: [ + { name: 'Short post', text: 'ClutterHunt is a free hidden-object game. Six rooms to search, a clock running, and everything moves each time you play. Can you three-star Expert? {L}' }, + { name: 'Friendly post', text: 'If you like spot-the-object puzzles, try ClutterHunt. Free in your browser, with POL rewards for clearing rooms: {L}' }] }, + { slug: 'spellwheel', name: 'SpellWheel', link: 'https://spellwheel.com/?ref=', img: 'https://spellwheel.com/og-spellwheel.jpg', sub: 'letter-wheel word game', + posts: [ + { name: 'Short post', text: 'SpellWheel is a free word game. Swipe the letters on the wheel to fill the grid, one place at a time.' + (preLaunch(2026, 10, 10) ? ' Opens Saturday Oct 10.' : '') + ' {L}' }, + { name: 'Friendly post', text: 'Word game fans, this one is for you. SpellWheel: swipe letters, fill the grid, and earn POL rewards as you clear levels. Free in your browser: {L}' }] }, + { slug: 'spookydoors', name: 'Spooky Doors', link: 'https://spookydoors.com/?ref=', kit: 'promo-spookydoors', seasonal: true }, + { slug: 'polhunter', name: 'PolHunter', link: 'https://polhunter.com/?r=', kit: 'promo-polhunter' }]; const SIZES = [['728x90', 'Leaderboard'], ['468x60', 'Banner'], ['320x50', 'Mobile banner'], ['300x250', 'Medium rectangle'], ['336x280', 'Large rectangle'], ['250x250', 'Square'], ['125x125', 'Button'], ['160x600', 'Wide skyscraper'], ['120x600', 'Skyscraper'], ['300x600', 'Half page']]; - let cur = GAMES[0]; + const avail = { spookydoors: false }; // seasonal: the Spooky Doors kit says whether its season is showing + const list = () => GAMES.filter(g => avail[g.slug] !== false); + let cur = null; try { cur = localStorage.getItem('iap.gmGame'); } catch (e) {} const draw = () => { - const link = cur.link + enc(token); $('gbLink').textContent = link; - $('gbLinkCopy').onclick = async () => { try { await navigator.clipboard.writeText(link); status('Link copied.', 'ok'); } catch (e) { status('Copy failed.', 'bad'); } }; - $('gbGames').innerHTML = GAMES.map(g => '').join(''); + const L = list(); const g = L.find(x => x.slug === cur) || L[0]; cur = g.slug; + try { localStorage.setItem('iap.gmGame', cur); } catch (e) {} + $('gmPick').innerHTML = L.map(x => '').join(''); + const link = g.link + enc(token); + GAMES.forEach(x => { if (x.kit && $(x.kit)) $(x.kit).hidden = x !== g; }); + $('gmGeneric').hidden = !!g.kit; + if (!g.kit) { + $('gmTitle').textContent = g.name; $('gmSub').textContent = g.sub || ''; + $('gmLink').textContent = link; + $('gmLinkCopy').onclick = async () => { try { await navigator.clipboard.writeText(link); status('Link copied.', 'ok'); } catch (e) { status('Copy failed.', 'bad'); } }; + const posts = g.posts.map(p => ({ name: p.name, text: p.text.replace('{L}', link) })), hook = posts[0].text.replace(link, '').trim(); + const sh = $('gmShare'); sh.innerHTML = ''; + [linkBtn('https://x.com/intent/tweet?text=' + enc(posts[0].text), 'X'), linkBtn('https://www.facebook.com/sharer/sharer.php?u=' + enc(link), 'Facebook'), linkBtn('https://t.me/share/url?url=' + enc(link) + '&text=' + enc(hook), 'Telegram'), linkBtn('https://wa.me/?text=' + enc(posts[0].text), 'WhatsApp')].forEach(b => sh.appendChild(b)); + const gi = $('gmImg'); gi.hidden = true; gi.onload = () => { if (gi.dataset.want === g.img) gi.hidden = false; }; gi.onerror = () => { gi.hidden = true; }; gi.dataset.want = g.img; gi.src = g.img; // hidden until the new game's image loads (no stale picture) $('gmImg').alt = g.name; $('gmImgOpen').href = g.img; + $('gmImgCopy').onclick = async () => { try { await navigator.clipboard.writeText(g.img); status('Image URL copied.', 'ok'); } catch (e) { status('Copy failed.', 'bad'); } }; + const pp = $('gmPosts'); pp.innerHTML = ''; + for (const p of posts) pp.appendChild(block(p.text, '' + esc(p.name) + '', [linkBtn('https://x.com/intent/tweet?text=' + enc(p.text), 'X'), linkBtn('https://t.me/share/url?url=' + enc(link) + '&text=' + enc(p.text.replace(link, '').trim()), 'Telegram'), linkBtn('https://wa.me/?text=' + enc(p.text), 'WhatsApp')])); + } const grid = $('gbGrid'); grid.innerHTML = ''; - for (const [s, n] of SIZES) { const w = s.split('x')[0], h = s.split('x')[1], src = CDN + cur.slug + '/' + cur.slug + '-' + s + '.png'; - const code = '' + cur.name + ''; - const d = document.createElement('div'); d.className = 'promo-block'; d.innerHTML = '
' + s + ' ' + esc(n) + '
' + esc(cur.name) + ' ' + s + '
' + esc(code) + '
'; + for (const [s, n] of SIZES) { const w = s.split('x')[0], h = s.split('x')[1], src = CDN + g.slug + '/' + g.slug + '-' + s + '.png'; + const code = '' + g.name + ''; + const d = document.createElement('div'); d.className = 'promo-block'; d.innerHTML = '
' + s + ' ' + esc(n) + '
' + esc(g.name) + ' ' + s + '
' + esc(code) + '
'; const row = document.createElement('div'); row.className = 'pb-actions'; row.appendChild(copyBtn(code, 'Copy embed code')); row.appendChild(copyBtn(src, 'Copy image URL')); row.appendChild(linkBtn(src, 'Open image')); d.appendChild(row); grid.appendChild(d); } }; - $('gbGames').addEventListener('click', e => { const b = e.target.closest('[data-gb]'); if (!b) return; cur = GAMES.find(g => g.slug === b.dataset.gb) || cur; draw(); }); + window.__gmAvail = (slug, on) => { avail[slug] = !!on; draw(); }; + $('gmPick').addEventListener('click', e => { const b = e.target.closest('[data-gm]'); if (!b) return; cur = b.dataset.gm; draw(); }); draw(); } // Spooky Doors (Halloween season, 2026-10-02): the member's game link, the share image and two short posts. Shown on the @@ -305,9 +343,9 @@ window.IAPPromo = (function () { if (sdp && token && sdp.dataset.filled !== token) { sdp.dataset.filled = token; fetch('/api/my/spookydoors/promo').then(r => r.json()).then(s => { - const pill = document.querySelector('.promo-pills [data-promo="spookydoors"]'); - if (!s || !s.show) { if (pill) pill.hidden = true; sdp.hidden = true; return; } - if (pill) pill.hidden = false; + // the Games tab's picker lists Spooky Doors only while its season shows (the server decides) + if (!s || !s.show) { sdp.hidden = true; if (window.__gmAvail) window.__gmAvail('spookydoors', false); return; } + if (window.__gmAvail) window.__gmAvail('spookydoors', true); const enc = encodeURIComponent, sl = String(s.base || 'https://spookydoors.com') + '/?ref=' + enc(token), img = s.image || 'https://spookydoors.com/og-spookydoors.jpg'; const day = (d, back) => { const t = new Date(d + 'T12:00:00Z'); if (back) t.setUTCDate(t.getUTCDate() - 1); return t.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' }); }; const ends = s.season && s.season.end ? day(s.season.end, true) : 'Oct 31'; diff --git a/public/my.html b/public/my.html index 21cf7a0..84f15cb 100644 --- a/public/my.html +++ b/public/my.html @@ -775,11 +775,23 @@ - - - + - - - + +