Add admin UI: setup wizard, goals, rules editor, donations, moderation, overlays, settings
Test and Release / test (push) Successful in 2m34s
Test and Release / release (push) Successful in 9s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-15 10:26:03 -08:00
1 parent 0b9e6e7cbb
commit 4efdef72f6
18 files changed
+2169

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
/* StreamGoals admin: copy buttons and confirm prompts. No dependencies. */
( function () {
'use strict';
function flash( btn, text ) {
var old = btn.getAttribute( 'data-label' ) || btn.textContent;
btn.setAttribute( 'data-label', old );
btn.textContent = text;
window.setTimeout( function () { btn.textContent = old; }, 1500 );
}
function copyText( text, btn, input ) {
function fallback() {
var el = input;
var temp = null;
if ( ! el ) {
temp = el = document.createElement( 'textarea' );
el.value = text;
el.style.position = 'fixed';
el.style.opacity = '0';
document.body.appendChild( el );
}
el.select();
var ok = false;
try { ok = document.execCommand( 'copy' ); } catch ( e ) { ok = false; }
if ( temp ) { document.body.removeChild( temp ); }
flash( btn, ok ? 'Copied!' : 'Press Ctrl+C' );
}
if ( navigator.clipboard && window.isSecureContext ) {
navigator.clipboard.writeText( text ).then( function () { flash( btn, 'Copied!' ); }, fallback );
} else {
fallback();
}
}
document.addEventListener( 'click', function ( e ) {
var btn = e.target.closest ? e.target.closest( '[data-sg-copy],[data-sg-copy-text]' ) : null;
if ( ! btn ) { return; }
e.preventDefault();
if ( btn.hasAttribute( 'data-sg-copy-text' ) ) {
copyText( btn.getAttribute( 'data-sg-copy-text' ), btn, null );
return;
}
var input = btn.parentNode.querySelector( 'input' );
if ( input ) { copyText( input.value, btn, input ); }
} );
document.addEventListener( 'focusin', function ( e ) {
if ( e.target.classList && e.target.classList.contains( 'sg-url' ) ) { e.target.select(); }
} );
document.addEventListener( 'submit', function ( e ) {
var form = e.target;
if ( ! form.classList || ! form.classList.contains( 'sg-confirm' ) ) { return; }
var src = e.submitter || form.querySelector( '[data-confirm]' );
var msg = src && src.getAttribute( 'data-confirm' );
if ( msg && ! window.confirm( msg ) ) { e.preventDefault(); }
} );
}() );