@@ -458,6 +458,13 @@ function populateForm(d) {
458458 set ( 'cfg-yt-channel-id' , d . yt_channel_id ) ; set ( 'cfg-yt-alert-channel' , d . yt_alert_channel_id ) ;
459459 set ( 'cfg-yt-alert-msg' , d . yt_alert_message ) ;
460460 set ( 'cfg-tw-alerts' , d . tw_alerts ) ; set ( 'cfg-tw-username' , d . tw_username ) ;
461+ set ( 'cfg-tw-vc-followers' , d . tw_vc_followers || '' ) ; set ( 'cfg-tw-vc-status' , d . tw_vc_status || '' ) ;
462+ set ( 'cfg-tw-vc-viewers' , d . tw_vc_viewers || '' ) ; set ( 'cfg-tw-vc-game' , d . tw_vc_game || '' ) ;
463+ setVcFmt ( 'followers' , d . tw_fmt_followers || '🪻 | Followers : {value}' ) ;
464+ setVcFmt ( 'status-live' , d . tw_fmt_status_live || '🪻 | Status : 🔴 LIVE' ) ;
465+ setVcFmt ( 'status-offline' , d . tw_fmt_status_offline || '🪻 | Status : ⚫ Offline' ) ;
466+ setVcFmt ( 'viewers' , d . tw_fmt_viewers || '🪻 | Viewers : {value}' ) ;
467+ setVcFmt ( 'game' , d . tw_fmt_game || '🪻 | Game : {value}' ) ;
461468 set ( 'cfg-tw-alert-channel' , d . tw_alert_channel_id ) ; set ( 'cfg-tw-alert-msg' , d . tw_alert_message ) ;
462469 set ( 'cfg-tw-statsvc' , d . tw_stats_vc ) ; set ( 'cfg-yt-statsvc' , d . yt_stats_vc ) ;
463470 set ( 'cfg-boost-enabled' , d . boost_enabled ) ; set ( 'cfg-boost-channel' , d . boost_channel_id ) ;
@@ -522,7 +529,12 @@ function buildPayload(cat) {
522529 yt_alert_channel_id :v ( 'cfg-yt-alert-channel' ) , yt_alert_message :v ( 'cfg-yt-alert-msg' ) ,
523530 tw_alerts :vb ( 'cfg-tw-alerts' ) , tw_username :v ( 'cfg-tw-username' ) ,
524531 tw_alert_channel_id :v ( 'cfg-tw-alert-channel' ) , tw_alert_message :v ( 'cfg-tw-alert-msg' ) ,
525- tw_stats_vc :vb ( 'cfg-tw-statsvc' ) , yt_stats_vc :vb ( 'cfg-yt-statsvc' ) } ,
532+ tw_stats_vc :vb ( 'cfg-tw-statsvc' ) , yt_stats_vc :vb ( 'cfg-yt-statsvc' ) ,
533+ tw_vc_followers :v ( 'cfg-tw-vc-followers' ) , tw_vc_status :v ( 'cfg-tw-vc-status' ) ,
534+ tw_vc_viewers :v ( 'cfg-tw-vc-viewers' ) , tw_vc_game :v ( 'cfg-tw-vc-game' ) ,
535+ tw_fmt_followers :getVcFmt ( 'followers' ) , tw_fmt_status_live :getVcFmt ( 'status-live' ) ,
536+ tw_fmt_status_offline :getVcFmt ( 'status-offline' ) , tw_fmt_viewers :getVcFmt ( 'viewers' ) ,
537+ tw_fmt_game :getVcFmt ( 'game' ) } ,
526538 booster : { boost_enabled :vb ( 'cfg-boost-enabled' ) , boost_channel_id :v ( 'cfg-boost-channel' ) ,
527539 boost_message :v ( 'cfg-boost-msg' ) , boost_gradient :boostGrad , boost_accent :boostAccent , boost_emoji :boostEmoji } ,
528540 moderation : { antispam_enabled :vb ( 'cfg-antispam' ) , link_filter_enabled :vb ( 'cfg-linkfilter' ) ,
@@ -1584,3 +1596,70 @@ timeout_ms: 5000
15841596 if ( id === 'minecraft' ) mcLoadSettings ( ) ;
15851597 } ;
15861598} ) ( ) ;
1599+
1600+ // ── VC Format Picker ─────────────────────────────────────────────────────────
1601+
1602+ const VC_FMT_SAMPLE = {
1603+ followers : '1,234' ,
1604+ viewers : '89' ,
1605+ game : 'Minecraft' ,
1606+ } ;
1607+
1608+ const VC_FMT_IDS = {
1609+ 'followers' : 'cfg-tw-fmt-followers' ,
1610+ 'status-live' : 'cfg-tw-fmt-status-live' ,
1611+ 'status-offline' :'cfg-tw-fmt-status-offline' ,
1612+ 'viewers' : 'cfg-tw-fmt-viewers' ,
1613+ 'game' : 'cfg-tw-fmt-game' ,
1614+ } ;
1615+
1616+ function applyVcPreset ( key ) {
1617+ const preset = document . getElementById ( VC_FMT_IDS [ key ] + '-preset' ) ;
1618+ const input = document . getElementById ( VC_FMT_IDS [ key ] ) ;
1619+ if ( ! preset || ! input ) return ;
1620+ if ( preset . value === '__custom__' ) {
1621+ input . style . display = '' ;
1622+ input . focus ( ) ;
1623+ } else {
1624+ input . style . display = 'none' ;
1625+ input . value = preset . value ;
1626+ }
1627+ markDirty ( 'streams' ) ;
1628+ updateVcPreview ( key ) ;
1629+ }
1630+
1631+ function updateVcPreview ( key ) {
1632+ const input = document . getElementById ( VC_FMT_IDS [ key ] ) ;
1633+ const preview = document . getElementById ( 'prev-' + key ) ;
1634+ if ( ! input || ! preview ) return ;
1635+ const sample = VC_FMT_SAMPLE [ key ] || '' ;
1636+ const text = input . value . replace ( '{value}' , sample ) ;
1637+ preview . textContent = text || '' ;
1638+ }
1639+
1640+ function getVcFmt ( key ) {
1641+ const preset = document . getElementById ( VC_FMT_IDS [ key ] + '-preset' ) ;
1642+ const input = document . getElementById ( VC_FMT_IDS [ key ] ) ;
1643+ if ( ! preset ) return '' ;
1644+ return preset . value === '__custom__' ? ( input ? input . value : '' ) : preset . value ;
1645+ }
1646+
1647+ function setVcFmt ( key , val ) {
1648+ const preset = document . getElementById ( VC_FMT_IDS [ key ] + '-preset' ) ;
1649+ const input = document . getElementById ( VC_FMT_IDS [ key ] ) ;
1650+ if ( ! preset ) return ;
1651+ // Check if val matches a preset option
1652+ let matched = false ;
1653+ for ( const opt of preset . options ) {
1654+ if ( opt . value === val && opt . value !== '__custom__' ) {
1655+ preset . value = val ;
1656+ if ( input ) { input . style . display = 'none' ; input . value = val ; }
1657+ matched = true ; break ;
1658+ }
1659+ }
1660+ if ( ! matched && val ) {
1661+ preset . value = '__custom__' ;
1662+ if ( input ) { input . style . display = '' ; input . value = val ; }
1663+ }
1664+ updateVcPreview ( key ) ;
1665+ }
0 commit comments