Video Spin zone (/vz/<code>): a rotating player for any web page; house Video Spin admin route

/vz/<code> sends a frame to Social Tube's small player for one of the spin's videos on each page view; no click is recorded for a view
(rotator.peek), plays and taps are counted by Video App Income under the spin's code. Embed code on the Video Spin screen.
vsCreate / vsAdd shared by the member routes and POST /api/admin/house-videospin (admin key, house account, admin action log).
Chatbot lines updated (Marty 2026-11-22).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-22 12:56:38 -06:00
parent bca3666ee2
commit 994a2054d8
5 changed files with 75 additions and 29 deletions
+3
View File
@@ -10,6 +10,7 @@
const mark = () => { if (!$('vsWs').hidden) history.replaceState(null, '', '#v' + (SEL || '')); };
const base = () => 'https://' + (HOST || location.host), linkOf = s => base() + '/r/' + s.code;
const clicks7 = s => s.hits7 || 0;
const zoneCode = s => '<iframe src="' + base() + '/vz/' + s.code + '" width="315" height="560" style="border:0;border-radius:14px;max-width:100%" allow="fullscreen" allowfullscreen loading="lazy" title="Videos"></iframe>';
const state = s => s.paused ? { cls: 'warn', t: 'PAUSED' } : !s.destinations.some(d => d.active) ? { cls: 'bad', t: 'NO LIVE VIDEO' } : { cls: 'ok', t: 'LIVE' };
// ── view switch: this script only owns the Video Spins view; banner-spin.js keeps switching the other two ──
@@ -75,6 +76,7 @@
box.innerHTML = '<div class="vsp"><div class="vshead"><h2>' + esc(s.name) + '</h2><span class="tag ' + state(s).cls + '">' + state(s).t + '</span></div>'
+ '<div class="vsrow"><input class="field mono" id="vsLink" readonly value="' + esc(linkOf(s)) + '"><button class="btn pri" type="button" id="vsCopy">Copy link</button><button class="btn" type="button" id="vsPause">' + (s.paused ? 'Resume' : 'Pause') + '</button><button class="btn" type="button" id="vsDel">Delete</button></div>'
+ '<p class="muted" style="margin:8px 0 0">' + fmt(s.hits || 0) + ' clicks in all, ' + fmt(s.hits7 || 0) + ' in the last 7 days' + (s.conversions ? ', ' + s.conversions + ' conversion' + (s.conversions === 1 ? '' : 's') : '') + '. Each open goes to one of the videos below.</p>'
+ '<details class="vsz"><summary>Put it on a web page (rotating player)</summary><p class="muted" style="margin:8px 0">Paste this code into any page. Each page view plays a different video from this spin, with that video\'s own button. Page views are not counted as clicks; plays and button taps show under each video.</p><textarea class="field mono" id="vsZone" readonly rows="3" style="width:100%">' + esc(zoneCode(s)) + '</textarea><div class="vsrow" style="margin-top:8px"><button class="btn" type="button" id="vsZoneCopy">Copy code</button></div></details>'
+ '<h3 class="vsh">Videos in this spin <span class="muted">' + s.destinations.length + ' of ' + L.videos + '</span></h3>'
+ (rows || '<p class="muted">No videos yet. Add some below; the link starts working with the first one.</p>')
+ '<h3 class="vsh">Add your videos</h3>'
@@ -86,6 +88,7 @@
+ (room ? '<div class="vsrow"><input class="field" id="vsLinkIn" maxlength="300" placeholder="https://socialtube.club/watch/..."><button class="btn" type="button" id="vsAddLink">Add</button></div>' : '<p class="muted">This Video Spin is full for your tier.</p>')
+ '</div>';
$('vsCopy').addEventListener('click', () => { const u = linkOf(s); (navigator.clipboard && navigator.clipboard.writeText ? navigator.clipboard.writeText(u) : Promise.reject()).then(() => toast('Link copied'), () => { $('vsLink').select(); toast('Select and copy the link', true); }); });
$('vsZoneCopy').addEventListener('click', () => { const u = zoneCode(s); (navigator.clipboard && navigator.clipboard.writeText ? navigator.clipboard.writeText(u) : Promise.reject()).then(() => toast('Code copied'), () => { $('vsZone').select(); toast('Select and copy the code', true); }); });
$('vsPause').addEventListener('click', () => act(() => api('/api/my/rotations/' + s.id, { paused: !s.paused }), s.paused ? 'Resumed' : 'Paused'));
$('vsDel').addEventListener('click', e => { const b = e.currentTarget; if (b.dataset.arm !== '1') { b.dataset.arm = '1'; b.textContent = 'Tap again to delete'; setTimeout(() => { b.dataset.arm = ''; b.textContent = 'Delete'; }, 4000); return; }
act(async () => { await api('/api/my/rotations/' + s.id, { remove: true }); SEL = null; history.replaceState(null, '', '#v'); }, 'Video Spin deleted'); });
+2 -1
View File
@@ -113,6 +113,7 @@
.vsh{font-size:14px;letter-spacing:.06em;text-transform:uppercase;margin:24px 0 8px;display:flex;gap:10px;align-items:baseline}.vsh .muted{font-size:12px;text-transform:none;letter-spacing:0;font-weight:400}
.vsv{display:grid;grid-template-columns:44px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line)}.vsv img{width:44px;height:78px;object-fit:cover;border-radius:6px;background:#000}
.vsi b{font-size:14px}.vsi .muted{font-size:12.5px;margin-top:3px}.vsa{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.vsz{margin-top:14px;border:1px solid var(--line);border-radius:8px;padding:10px 12px;background:var(--panel)}.vsz summary{cursor:pointer;font-weight:700;font-size:13.5px}
.vsgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:10px}.vsc{position:relative;display:block;cursor:pointer;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--panel)}
.vsc img{display:block;width:100%;aspect-ratio:9/16;object-fit:cover;background:#000}.vsc span{display:block;font-size:12px;line-height:1.3;padding:6px 7px;max-height:44px;overflow:hidden}.vsc input{position:absolute;left:6px;top:6px;width:18px;height:18px}
@media (max-width:760px){.vsp{padding:14px 14px 24px}.vsv{grid-template-columns:44px minmax(0,1fr)}.vsa{grid-column:1/-1;justify-content:flex-start}}
@@ -290,6 +291,6 @@
<script src="/assets/cr-shell.js?v=20261115hub"></script>
<script src="/assets/links.js?v=20261111big"></script>
<script src="/assets/banner-spin.js?v=20261114bc"></script>
<script src="/assets/video-spin.js?v=20261122a"></script>
<script src="/assets/video-spin.js?v=20261122b"></script>
</body>
</html>