diff --git a/ads.js b/ads.js index 915b9e2..0f79f88 100644 Binary files a/ads.js and b/ads.js differ diff --git a/db.js b/db.js index 3cfa815..a0adb21 100644 --- a/db.js +++ b/db.js @@ -105,6 +105,8 @@ async function bootstrap() { // solo message bodies are sanitized rich text; TEXT gives them room await alterSafe('ALTER TABLE campaigns MODIFY body TEXT NULL'); await alterSafe('ALTER TABLE campaigns ADD COLUMN cta_label VARCHAR(40) NULL'); + await alterSafe('ALTER TABLE campaigns ADD COLUMN width INT NULL'); // banner size (IAB) → also NAS width + await alterSafe('ALTER TABLE campaigns ADD COLUMN height INT NULL'); // banner size (IAB) → also NAS height await q(`CREATE TABLE IF NOT EXISTS burns ( id VARCHAR(32) PRIMARY KEY, member_id INT NOT NULL, diff --git a/public/assets/my.js b/public/assets/my.js index 5419ec8..cee9f3a 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -323,6 +323,9 @@ const r = await (await fetch('/api/my/campaigns')).json(); if (r.error) return; lastRates = r.rates; + // populate the banner-size dropdown once (ids map to NAS width/height) + if (r.bannerSizes && $('cSize') && !$('cSize').options.length) + $('cSize').innerHTML = r.bannerSizes.map(s => '').join(''); soloHint(); $('rateLine').textContent = 'Available to spend: ' + r.availableCredits.toLocaleString() + (r.earnedCredits ? ' (' + r.purchasedCredits.toLocaleString() + ' purchased + ' + r.earnedCredits + ' earned)' : '') @@ -337,7 +340,8 @@ tbl.className = 'tablewrap'; tbl.innerHTML = '
| Name | Type | Views | Clicks | ' + 'Spent | Budget | Status | |
|---|---|---|---|---|---|---|---|
| ' + c.name + ' | ' + c.type + ' | ' + + r.campaigns.map(c => '||||||
| ' + c.name + ' | ' + + '' + c.type + (c.type === 'banner' && c.width ? ' ' + c.width + '×' + c.height + '' : '') + ' | ' + '' + c.imps.toLocaleString() + ' | ' + c.clicks + ' | ' + '' + c.spent + ' | ' + c.budget + ' | ' + '' + (c.status === 'out' ? 'budget spent' : c.status) + ' | ' @@ -405,6 +409,7 @@ $('cType').addEventListener('change', () => { const t = $('cType').value; $('cImageRow').hidden = t !== 'banner'; // only banners carry a creative; login frames its URL + $('cSizeRow').hidden = t !== 'banner'; $('cTitleRow').hidden = t !== 'text' && t !== 'solo'; $('cBodyRow').hidden = t !== 'text'; $('cSoloRow').hidden = t !== 'solo'; @@ -417,7 +422,7 @@ let soloBody = $('cSoloEd').innerHTML; if ($('cSoloRaw') && !$('cSoloRaw').hidden) soloBody = $('cSoloRaw').value; await api('/api/my/campaigns', { type: $('cType').value, name: $('cName').value, - targetUrl: $('cTarget').value, imageUrl: $('cImage').value, + targetUrl: $('cTarget').value, imageUrl: $('cImage').value, size: $('cSize').value, title: $('cTitle').value, body: $('cType').value === 'solo' ? soloBody : $('cBody').value, ctaLabel: $('cCtaLabel').value, diff --git a/public/contract.html b/public/contract.html index 6ae6db0..911a3fa 100644 --- a/public/contract.html +++ b/public/contract.html @@ -5,7 +5,7 @@