@@ -107,6 +107,17 @@ when(() => top.TWITCH_INTEGRITY_FAIL, 5_000).then(() => {
107107 });
108108});
109109
110+ // Twith's "bonus button blunder" issue...
111+ // If the bonus button is present before the extension finishes loading, the display completely breaks...
112+ BONUS_BUTTON_BLUNDER: {
113+ when.defined(() => null
114+ ?? $.last('[class*="bonus"i]')?.closest('button')
115+ ?? $.last('[data-test-selector*="points"i][data-test-selector*="summary"i] button[class*="success"i]')
116+ ?? $.last('[data-test-selector*="points"i][data-test-selector*="summary"i] button:is([class*="destruct"i], [class*="error"i])')
117+ ?? $.last('[class*="points"i] button [class*="bonus"i]')?.closest('button')
118+ ).then(ChannelPointsButton => ChannelPointsButton.click());
119+ }
120+
110121/*** Setup (pre-init) - #MARK:classes #MARK:functions #MARK:methods
111122 * _____ _ __ _ _ _ __
112123 * / ____| | | / / (_) (_) |\ \
@@ -131,11 +142,14 @@ class Balloon {
131142 constructor({ title, icon = 'play', iconAttr = {} }, ...jobs) {
132143 let f = furnish;
133144
134- let [L_pane, C_pane, R_pane] = $.all('.top-nav__menu > div'),
145+ let [L_pane, C_pane, R_pane] = $.all('.top-nav__menu > div:not(:only-child) '),
135146 X = $('#tt-balloon', R_pane),
136147 I = Runtime.getURL('profile.png'),
137148 F, C, H, U, N;
138149
150+ if([L_pane, C_pane, R_pane].filter(nullish).length)
151+ return;
152+
139153 let uuid = U = UUID.from([title, JSON.stringify(jobs)].join(':')).value,
140154 existing = Balloon.#BALLOONS.get(title);
141155
@@ -443,7 +457,7 @@ class Balloon {
443457 )
444458 );
445459
446- R_pane?.insertBefore(p, R_pane.children[1] );
460+ R_pane?.insertBefore(p, R_pane.firstElementChild );
447461
448462 this.body = C;
449463 this.icon = N;
0 commit comments