// Fuel Your Offers (2026-10-24), LinkSpin: the Monthly Refuel panel on Credits and Ads. The streak lives on InstantAdPay // and is shared by both sites; /api/my/refuel relays InstantAdPay's view. Hidden while the refuelStreak switch is off. (function () { const $ = id => document.getElementById(id); const esc = s => String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); const n = v => Number(v || 0).toLocaleString('en-US'); window.FUEL = window.FUEL || {}; const HOW = '

How the Refuel streak works

'; // the member guide (2026-10-24) function site(name, s, minUsd) { const row = '
' + name + ': '; // own spacing: the Ads screen has no .row rule (2026-10-24) return s && s.refueled ? row + '+' + s.pct + '% · ' + n(s.bonus) + ' bonus credits
' : row + 'not yet ($' + minUsd + '+ counts)'; } function body(v) { if (v.error) return '

' + esc(v.error) + '

'; if (!v.active) { return '

' + (v.started ? 'Your last streak ended. ' : '') + 'A package of $' + v.minUsd.linkspin + ' or more here, or $' + v.minUsd.iap + '+ on InstantAdPay, ' + (v.started ? 'starts it again' : 'starts your monthly refuel streak and sets your own refuel day') + '.

' + '

Bonus ad credits: month 1 +' + v.ladder.single[0] + '%, then +' + v.ladder.single.slice(1).join('%, +') + '%. Refuel both sites in the same cycle and each gets +' + v.ladder.both.join('%, +') + '%.

' + 'Start my streak' + HOW; } const c = v.cycle || {}; let h = v.windowOpen ? '

Your refuel window is open. Refuel day ' + esc(v.refuelDayLabel) + ', grace to ' + esc(v.graceLabel) + ' (Central). Next refuel: +' + v.next.single + '%, or +' + v.next.both + '% on each site with both.

' : '

Next refuel day ' + esc(v.refuelDayLabel) + ' (Central). Window opens ' + esc(v.opensLabel) + ', grace to ' + esc(v.graceLabel) + '.

'; if (c.month) h += '
' + site('InstantAdPay', c.iap, v.minUsd.iap) + site('LinkSpin', c.linkspin, v.minUsd.linkspin) + '
'; if (!v.windowOpen && c.month && !c.both) h += '

Refuel ' + (c.linkspin && c.linkspin.refueled ? 'InstantAdPay ($' + v.minUsd.iap + '+)' : 'LinkSpin ($' + v.minUsd.linkspin + '+)') + ' before ' + esc(v.opensLabel) + ' and both sites move to +' + v.next.secondEngine + '%.

'; if (v.pitStop && (v.pitStop.linkspin || v.pitStop.usedLinkspin)) h += '

Pit Stop ' + (v.pitStop.linkspin ? 'available here: +' + v.pitStop.pct + '% on a $' + v.minUsd.linkspin + '+ top-up, once this cycle. It does not count as your refuel.' : 'used here this cycle.') + '

'; h += '

' + (v.freeMiss.available ? 'One free miss left this year.' : 'Free miss for this year used.') + '

'; return h + '' + (v.windowOpen ? 'Refuel now' : 'Buy a package') + '' + HOW; } async function load() { const panel = $('rfPanel'); if (!panel) return; try { const v = await (await fetch('/api/my/refuel', { cache: 'no-store' })).json(); window.FUEL.refuel = v; if (!v || !v.on) { panel.hidden = true; return; } $('rfMeta').textContent = v.active ? 'streak: ' + v.streak + ' month' + (v.streak === 1 ? '' : 's') : 'shared with InstantAdPay'; $('rfBody').innerHTML = body(v); panel.hidden = false; } catch (e) { panel.hidden = true; } } window.FUEL.loadRefuel = load; load(); setInterval(load, 300000); // ---- the Refuel Kit: members-only LinkSpin banners with your @name and a QR to your link ---- const post = async (url, body) => { const r = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body || {}) }); const j = await r.json().catch(() => ({})); if (!r.ok || j.error) throw new Error(j.error || ('HTTP ' + r.status)); return j; }; const note = (el, m) => { if (el) el.textContent = m; }; // Banner Spin sizes to load (2026-10-24): each size needs its own Banner Spin, and a Starter tier holds 2, so the sizes that // fit are ticked first (728x90 and 300x250 when nothing is set up yet) and the panel says why before the member presses Load function spinPick(k, d) { const R = d.spinRoom; const sizes = k.sizes.filter(s => s.ready && (!R || !R.sizes || R.sizes.includes(s.size))).map(s => s.size).filter(z => z !== '1200x630'); if (!sizes.length) return ''; const pick = R && R.ok && R.suggested ? R.suggested : sizes; const note = R && R.ok && !R.all ? '

Each size goes into its own Banner Spin. Your ' + esc(R.tier) + ' tier holds ' + R.spins + ' (' + R.used + ' in use), so the sizes that fit are ticked. Untick one to load another instead' + (R.next ? ', or reach ' + esc(R.next.label) + ' (' + esc(R.next.need) + ') for ' + R.next.spins : '') + '.

' : ''; return note + '
' + sizes.map(z => '').join('') + '
'; } function kitHtml(k, d) { const head = '
' + esc(k.label) + (k.theme ? ' · ' + esc(k.theme) : '') + '' + (k.unlocked ? 'yours' : 'locked') + '
'; if (!k.unlocked) return head + '

Your next counted refuel unlocks it: $25+ here or $20+ on InstantAdPay' + (d.nextRefuel ? ' (refuel day ' + esc(d.nextRefuel) + ')' : '') + '.

'; return head + '

Your ' + esc(d.name || 'name') + ' and a QR to your link on every banner. Yours to keep after the month.

' + spinPick(k, d) + '
' + (k.gif ? '' : '') + '
' + '
' + '
' + k.sizes.filter(s => s.ready).map(s => '
' + '
' + s.size + '
').join('') + '
'; } async function loadKits() { const panel = $('rkPanel'); if (!panel) return; try { const d = await (await fetch('/api/my/kits', { cache: 'no-store' })).json(); if (!d || !d.on || !d.kits || !d.kits.length) { panel.hidden = true; return; } $('rkBody').innerHTML = d.kits.slice(0, 3).map(k => '
' + kitHtml(k, d) + '
').join('') + (d.customNote ? '

Custom banners credit: ' + esc(d.customNote) + '

' : '') + '

Ad credits buy delivery only. No banner may promise income.

'; panel.hidden = false; panel.querySelectorAll('[data-kbs]').forEach(b => b.addEventListener('click', async () => { const m = b.dataset.kbs; const out = panel.querySelector('[data-kres="' + m + '"]'); const g = panel.querySelector('[data-kgif="' + m + '"]'); b.disabled = true; note(out, 'Drawing your banners and loading them...'); try { const boxes = panel.querySelectorAll('[data-ksize="' + m + '"]'); const sizes = Array.prototype.filter.call(boxes, c => c.checked).map(c => c.value); if (boxes.length && !sizes.length) { note(out, 'Tick at least one size to load.'); b.disabled = false; return; } const r = await post('/api/my/kits/bannerspin', Object.assign({ month: m, variant: g && g.checked ? 'gif' : 'still' }, boxes.length ? { sizes } : {})); note(out, (r.message || r.results.map(x => x.size + ': ' + (x.error ? x.error : x.already ? 'already in "' + x.spin + '"' : (x.created ? 'new Banner Spin "' : 'added to "') + x.spin + '"')).join(' | ')) + ' See Banner Spin under Links.'); } catch (e) { note(out, e.message); } b.disabled = false; })); panel.querySelectorAll('[data-kmake]').forEach(b => b.addEventListener('click', async () => { const cell = b.closest('[data-kcell]'); b.disabled = true; try { const g = panel.querySelector('[data-kgif="' + cell.dataset.month + '"]'); const r = await post('/api/my/kits/render', { month: cell.dataset.month, size: cell.dataset.size, variant: g && g.checked && cell.dataset.size !== '1200x630' ? 'gif' : 'still' }); cell.querySelector('[data-kimg]').innerHTML = 'Your ' + esc(r.size) + ' Refuel Kit banner
Download
'; const c = cell.querySelector('[data-kcopy]'); c.addEventListener('click', () => { try { navigator.clipboard.writeText(c.dataset.kcopy); c.textContent = 'Copied'; } catch (e) {} }); } catch (e) { cell.querySelector('[data-kimg]').textContent = e.message; } b.disabled = false; })); } catch (e) { panel.hidden = true; } } window.FUEL.loadKits = loadKits; loadKits(); })();