No native dialogs: Shorts report prompt -> inline reason buttons; admin drip confirms -> IAP.confirmBox
Same class of bug as the campaign #27 false report: the Shorts report was a prompt() pre-filled with 'inappropriate'. Members now tap a reason button on purpose or cancel. Script tags bumped. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+14
-4
@@ -55,12 +55,22 @@
|
||||
$('shNext').hidden = false;
|
||||
}
|
||||
$('shNext').addEventListener('click', load);
|
||||
// 2026-09-16: was a native prompt() pre-filled with 'inappropriate' (one stray OK = a false report).
|
||||
// Now an inline row of reason buttons: the member picks one on purpose, or cancels.
|
||||
$('shReport').addEventListener('click', e => {
|
||||
e.preventDefault(); if (!st.adId) return;
|
||||
const reason = (prompt('Report this short: broken, inappropriate, spam, scam, or other', 'inappropriate') || '').trim().toLowerCase();
|
||||
if (!reason) return;
|
||||
fetch('/api/report-ad', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ campaignId: st.adId, reason }) })
|
||||
.then(() => { $('shReport').textContent = '✓ reported — thanks'; }).catch(() => {});
|
||||
let row = document.getElementById('shReasons');
|
||||
if (row) { row.remove(); return; }
|
||||
row = document.createElement('div'); row.id = 'shReasons';
|
||||
row.style.cssText = 'display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;align-items:center';
|
||||
row.innerHTML = '<span class="muted small">What is wrong?</span>' + ['broken', 'inappropriate', 'spam', 'scam', 'other'].map(r => '<button type="button" class="btn small sec" data-reason="' + r + '">' + r + '</button>').join('') + '<button type="button" class="btn small sec" data-reason="">cancel</button>';
|
||||
$('shReport').insertAdjacentElement('afterend', row);
|
||||
row.addEventListener('click', ev => {
|
||||
const b = ev.target.closest('button[data-reason]'); if (!b) return;
|
||||
const reason = b.dataset.reason; row.remove(); if (!reason) return;
|
||||
fetch('/api/report-ad', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ campaignId: st.adId, reason }) })
|
||||
.then(() => { $('shReport').textContent = '✓ reported — thanks'; }).catch(() => {});
|
||||
});
|
||||
});
|
||||
// presence enforcement: pause when the tab/window loses focus, resume on return
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
|
||||
Reference in New Issue
Block a user