Promo tools: Game banners section (7 games x 10 standard sizes on banners.adrotate.xyz, embed code linked to the member)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-06 07:52:17 -05:00
parent 9142efef01
commit 5a39b2599f
3 changed files with 37 additions and 3 deletions
+26
View File
@@ -273,6 +273,32 @@ window.IAPPromo = (function () {
const d = document.createElement('div'); d.className = 'promo-block'; d.innerHTML = '<div class="pb-head"><span class="lab">' + s + '</span> <span class="muted small">' + esc(n) + '</span></div><div style="overflow:auto;margin:8px 0"><img src="' + src + '" alt="' + s + '" style="max-width:100%;height:auto;border-radius:8px"></div><div class="pb-text mono small" style="overflow-wrap:anywhere">' + esc(code) + '</div>';
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;
const enc = encodeURIComponent, CDN = 'https://banners.adrotate.xyz/game-banners/';
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=' }];
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 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 => '<button class="chip-t' + (g === cur ? ' on' : '') + '" type="button" data-gb="' + g.slug + '">' + esc(g.name) + '</button>').join('');
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 = '<a href="' + link + '" target="_blank" rel="noopener"><img src="' + src + '" width="' + w + '" height="' + h + '" alt="' + cur.name + '"></a>';
const d = document.createElement('div'); d.className = 'promo-block'; d.innerHTML = '<div class="pb-head"><span class="lab">' + s + '</span> <span class="muted small">' + esc(n) + '</span></div><div style="overflow:auto;margin:8px 0"><img loading="lazy" src="' + src + '" alt="' + esc(cur.name) + ' ' + s + '" style="max-width:100%;height:auto;border-radius:6px"></div><div class="pb-text mono small" style="overflow-wrap:anywhere">' + esc(code) + '</div>';
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(); });
draw();
}
// Spooky Doors (Halloween season, 2026-10-02): the member's game link, the share image and two short posts. Shown on the
// season window the Games card uses (the server decides; the admin gets a preview before the start), hidden after it.
const sdp = $('promo-spookydoors');