Your links: collapsed band per angle; Share button only where a share sheet exists
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -113,19 +113,19 @@ window.IAPPromo = (function () {
|
||||
for (const a of ANGLES) {
|
||||
const url = angleLink(link, a.angle);
|
||||
const hasVideo = VIDEOS.some(v => v.angle === a.angle);
|
||||
const row = document.createElement('div');
|
||||
row.className = 'angle-row';
|
||||
row.innerHTML = '<div class="angle-txt"><div class="angle-head"><span class="angle-name">' + esc(a.name) + '</span><span class="angle-hook">' + esc(a.hook) + '</span>'
|
||||
+ (hasVideo ? '<span class="angle-tag">video</span>' : '') + '</div>'
|
||||
// one collapsed band per angle, like the banner kit: open the one you want
|
||||
const row = document.createElement('details');
|
||||
row.className = 'angle-row pb-acc';
|
||||
row.innerHTML = '<summary><span><span class="angle-name">' + esc(a.name) + '</span> <span class="angle-hook">' + esc(a.hook) + '</span></span>'
|
||||
+ (hasVideo ? '<span class="angle-tag">video</span>' : '') + '</summary>'
|
||||
+ '<div class="angle-body"><div class="angle-txt">'
|
||||
+ '<div class="muted small">' + esc(a.use) + '</div>'
|
||||
+ '<a class="mono small angle-url" href="' + esc(url) + '" target="_blank" rel="noopener">' + esc(url) + '</a></div>'
|
||||
+ '<div class="angle-btns"><a class="btn small sec" href="' + esc(url) + '" target="_blank" rel="noopener">Open</a><button class="btn small" type="button">Copy</button><button class="btn small sec" type="button">Share</button></div>';
|
||||
+ '<div class="angle-btns"><a class="btn small sec" href="' + esc(url) + '" target="_blank" rel="noopener">Open</a><button class="btn small" type="button">Copy</button>'
|
||||
+ (navigator.share ? '<button class="btn small sec" type="button">Share</button>' : '') + '</div></div>'; // Share = the phone's share sheet; desktops have none, so no button
|
||||
const [copyBtn, shareBtn] = row.querySelectorAll('button');
|
||||
copyBtn.onclick = async () => { try { await navigator.clipboard.writeText(url); status((a.name === 'General' ? 'Invite' : a.name) + ' link copied.', 'ok'); } catch (e) { status('Copy failed.', 'bad'); } };
|
||||
shareBtn.onclick = async () => {
|
||||
if (navigator.share) { try { await navigator.share({ title: 'InstantAdPay', text: a.hook, url }); return; } catch (e) { if (e && e.name === 'AbortError') return; } }
|
||||
try { await navigator.clipboard.writeText(url); status('No share sheet here, so the link is copied.', 'ok'); } catch (e) { status('Copy failed.', 'bad'); }
|
||||
};
|
||||
if (shareBtn) shareBtn.onclick = async () => { try { await navigator.share({ title: 'InstantAdPay', text: a.hook, url }); } catch (e) { if (!(e && e.name === 'AbortError')) status('Could not open the share sheet.', 'bad'); } };
|
||||
al.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user