diff --git a/public/assets/banner-spin.js b/public/assets/banner-spin.js index 9d3875c..f1126c3 100644 --- a/public/assets/banner-spin.js +++ b/public/assets/banner-spin.js @@ -65,6 +65,10 @@ $('bsHoursChip').textContent = LSHours.chip(s.hours, s.tz); $('bsHoursChip').classList.toggle('set', !!s.hours); $('bsOffNote').hidden = !s.adminOff; if (s.adminOff) $('bsOffNote').textContent = 'LinkSpin took this Banner Spin offline' + (s.adminNote ? ' (' + s.adminNote + ')' : '') + '. Placements show a blank image and clicks go to the fallback. Ask on Help if you think this is a mistake.'; renderTiles(s, STATS[id]); renderBanners(s); renderSettings(s); renderCodes(s); renderAddLimit(s); + // the Add a banner frame follows the selected spin's size (Marty 11-05: it kept the first spin's 728x90); a pick made + // for another spin is dropped so it is never checked or uploaded against the wrong size + if (PEND && PEND.spin !== id) { PEND = null; $('bsFile').value = ''; $('bsImgUrl').value = ''; } + if (!PEND) preview($('bsPrev'), s, null); if (!quiet) window.scrollTo({ top: 0 }); loadStats(id); } @@ -151,8 +155,8 @@ if (r.error) throw new Error(r.error); return r; } // add a banner: upload first when a file is chosen, then save - $('bsFile').addEventListener('change', () => { const s = cur(); if (!s) return; $('bsImgUrl').value = ''; PEND = PEND || {}; pickFile($('bsFile'), $('bsPrev'), s, PEND); }); - $('bsImgUrl').addEventListener('change', async () => { const s = cur(); if (!s) return; $('bsFile').value = ''; PEND = { url: $('bsImgUrl').value.trim() }; PEND.d = await preview($('bsPrev'), s, PEND.url || null); PEND.ok = !!PEND.d; }); + $('bsFile').addEventListener('change', () => { const s = cur(); if (!s) return; $('bsImgUrl').value = ''; PEND = PEND || {}; PEND.spin = s.id; pickFile($('bsFile'), $('bsPrev'), s, PEND); }); + $('bsImgUrl').addEventListener('change', async () => { const s = cur(); if (!s) return; $('bsFile').value = ''; PEND = { url: $('bsImgUrl').value.trim(), spin: s.id }; PEND.d = await preview($('bsPrev'), s, PEND.url || null); PEND.ok = !!PEND.d; }); $('bsTgtKind').addEventListener('change', () => { $('bsTgtUrlWrap').hidden = $('bsTgtKind').value !== 'url'; }); $('bsAddBtn').addEventListener('click', async () => { const s = cur(); if (!s) return; const P = PEND || {}; diff --git a/public/links.html b/public/links.html index 27b19cd..4289829 100644 --- a/public/links.html +++ b/public/links.html @@ -272,6 +272,6 @@ - +