Campaign form: show the banner size and image rows at load (banner is the default type), not only after a type change

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-11 15:25:46 -05:00
parent 63bedddc94
commit 024027a2da
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -599,6 +599,7 @@
// populate the banner-size dropdown once (ids map to NAS width/height) // populate the banner-size dropdown once (ids map to NAS width/height)
if (r.bannerSizes && $('cSize') && !$('cSize').options.length) if (r.bannerSizes && $('cSize') && !$('cSize').options.length)
$('cSize').innerHTML = r.bannerSizes.map(s => '<option value="' + s.id + '">' + s.label + '</option>').join(''); $('cSize').innerHTML = r.bannerSizes.map(s => '<option value="' + s.id + '">' + s.label + '</option>').join('');
applyType(); // the default type is banner: show its size + image rows now that the sizes exist
soloHint(); soloHint();
if ($('spendBanner')) { if ($('spendBanner')) {
$('spendBanner').hidden = false; $('spendBanner').hidden = false;
@@ -709,7 +710,8 @@
visits: 'A distinct member opens your site in a new tab, stays eight seconds and passes a check. Nobody counts twice.' }; visits: 'A distinct member opens your site in a new tab, stays eight seconds and passes a check. Nobody counts twice.' };
const whereHint = () => { const el = $('cWhere'); if (el) el.textContent = WHERE[$('cType').value] || ''; }; const whereHint = () => { const el = $('cWhere'); if (el) el.textContent = WHERE[$('cType').value] || ''; };
whereHint(); whereHint();
$('cType').addEventListener('change', () => { // runs on every type change AND once at load, so the default type (banner) shows its size + image rows immediately
function applyType() { // hoisted: loadCampaigns may run before this line is reached
whereHint(); whereHint();
const t = $('cType').value; const t = $('cType').value;
$('cImageRow').hidden = t !== 'banner'; // only banners carry a creative; login frames its URL $('cImageRow').hidden = t !== 'banner'; // only banners carry a creative; login frames its URL
@@ -734,7 +736,8 @@
soloHint(); soloHint();
if (t === 'video') videoHint(); if (t === 'video') videoHint();
if (t === 'featured') featHint(); if (t === 'featured') featHint();
}); }
$('cType').addEventListener('change', applyType);
let featStartDay = 0; // selected start-day offset (0 = today) let featStartDay = 0; // selected start-day offset (0 = today)
async function featHint() { async function featHint() {
if (!lastRates || !lastRates.featuredDurations) return; if (!lastRates || !lastRates.featuredDurations) return;
+1 -1
View File
@@ -909,7 +909,7 @@
<script src="/assets/common.js?v=20260911c"></script> <script src="/assets/common.js?v=20260911c"></script>
<script src="/assets/wallet.js?v=20260911a"></script> <script src="/assets/wallet.js?v=20260911a"></script>
<script src="/assets/promo.js?v=20260911a"></script> <script src="/assets/promo.js?v=20260911a"></script>
<script src="/assets/my.js?v=20260911w"></script> <script src="/assets/my.js?v=20260911x"></script>
<script src="/assets/chat.js?v=20260907l"></script> <script src="/assets/chat.js?v=20260907l"></script>
</body> </body>
</html> </html>