@@ -2,18 +2,16 @@ function styledLog(message, style) {
22 console . log ( `%c${ message } ` , style ) ;
33}
44
5- function runTopLogs ( ) {
6- console . log ( '%cdiscord.gg/interstellar' , 'font-weight: bold; font-size: 39px; color: red; text-shadow: 3px 3px 0 rgb(217,31,38), 6px 6px 0 rgb(226,91,14), 9px 9px 0 rgb(245,221,8), 12px 12px 0 rgb(5,148,68), 15px 15px 0 rgb(2,135,206), 18px 18px 0 rgb(4,77,145), 21px 21px 0 rgb(42,21,113); margin-bottom: 12px; padding: 5%;' ) ;
7- console . log ( '%cCredits to @xbubbo and @xderpman on Discord.' , 'font-weight: bold; font-size: 20px; color: blue;' ) ;
8- console . log ( '%cYou can use this code with proper credits.' , 'font-weight: bold; font-size: 20px; color: purple;' ) ;
9- }
5+ // Made by discord.gg/interstellar
6+ // Credits to @xbubbo and @xderpman on Discord
7+ // You can use this code with proper credits.
108
119var adjustmentCompleted = false ;
1210var attempts = 0 ;
1311
1412function adjustElements ( ) {
1513 if ( adjustmentCompleted ) {
16- console . log ( '%cNow.GG Adjustment already completed. Stopping script.' , 'font-size: 30px ; color: green;' ) ;
14+ console . log ( '%cNow.GG Adjustment already completed. Stopping script.' , 'font-size: 15px ; color: green;' ) ;
1715 return true ;
1816 }
1917
@@ -24,13 +22,24 @@ function adjustElements() {
2422
2523 var roblox = innerDoc . getElementById ( 'js-game-video' ) ;
2624 var controlBar = innerDoc . getElementById ( 'ng-control-bar' ) ;
25+ var fullscreen = innerDoc . getElementById ( 'ng-fs' ) || innerDoc . querySelector ( '.sc-kOcGyv.dkAhwC' ) ;
2726
2827 if ( roblox && controlBar ) {
29- roblox . style . top = '295px' ;
30- controlBar . style . top = '90%' ;
31- console . log ( '%cSuccessfully adjusted Now.GG.' , 'font-size: 30px; color: green;' ) ;
28+ roblox . style . top = '415px' ;
29+ controlBar . style . top = '91%' ;
30+ console . log ( '%cSuccessfully adjusted Now.GG.' , 'font-size: 15px; color: green;' ) ;
31+
32+ if ( fullscreen ) {
33+ // Remove any existing event listeners before adding a new one
34+ fullscreen . removeEventListener ( 'mousedown' , fullscreenClickHandler ) ;
3235
33- adjustmentCompleted = true ;
36+ // Add the event listener
37+ fullscreen . addEventListener ( 'mousedown' , fullscreenClickHandler ) ;
38+ } else {
39+ console . log ( '%cFullscreen button not found.' , 'font-size: 15px; color: red;' ) ;
40+ }
41+
42+ adjust ( ) ;
3443
3544 return true ;
3645 } else {
@@ -43,18 +52,101 @@ function adjustElements() {
4352 }
4453}
4554
46- function checkAndAdjust ( ) {
55+ function CheckAndAdjust ( ) {
4756 var intervalId = setInterval ( function ( ) {
48- runTopLogs ( ) ;
57+ RunTopLogs ( ) ;
4958 attempts ++ ;
5059 if ( adjustElements ( ) ) {
5160 clearInterval ( intervalId ) ;
52- } else if ( attempts >= 5 ) {
53- console . log ( '%cNow.GG Script ran 5 times without finding elements. Stopping script.' , 'font-size: 15px; color: red;' ) ;
61+ } else if ( attempts >= 10 ) {
62+ console . log ( '%cNow.GG Script ran 10 times without finding elements. Stopping script.' , 'font-size: 15px; color: red;' ) ;
5463 clearInterval ( intervalId ) ;
5564 }
56- } , 7000 ) ;
65+ } , 5000 ) ;
66+ }
67+
68+ function adjust ( ) {
69+ setInterval ( function ( ) {
70+ var iframe = top . document . getElementById ( 'iframeId' ) ;
71+
72+ if ( iframe ) {
73+ var innerDoc = iframe . contentWindow . document ;
74+
75+ var roblox = innerDoc . getElementById ( 'js-game-video' ) ;
76+ var controlBar = innerDoc . getElementById ( 'ng-control-bar' ) ;
77+ var customClassElement = innerDoc . querySelector ( '.sc-rUGft.hLgqJJ' ) ;
78+
79+ if ( roblox ) {
80+ checkAndAdjustStyles ( roblox , 'top' , [ '415px' ] ) ;
81+ }
82+
83+ if ( controlBar ) {
84+ checkAndAdjustStyles ( controlBar , 'top' , [ '91%' ] ) ;
85+ }
86+
87+ if ( customClassElement ) {
88+ customClassElement . remove ( ) ;
89+ console . log ( '%cRemoved class "sc-rUGft hLgqJJ".' , 'font-size: 15px; color: green;' ) ;
90+ }
91+
92+ } else {
93+ console . log ( '%cFailed to find iframe with the specified ID.' , 'font-size: 15px; color: red;' ) ;
94+ }
95+ } , 3000 ) ;
96+ }
97+
98+ function checkAndAdjustStyles ( element , property , targetValues ) {
99+ if ( element ) {
100+ var currentStyle = window . getComputedStyle ( element ) [ property ] ;
101+
102+ if ( ! targetValues . includes ( currentStyle ) ) {
103+ element . style [ property ] = targetValues [ 0 ] ;
104+ console . log ( `%cAdjusted ${ property } to ${ targetValues [ 0 ] } .` , 'font-size: 15px; color: green;' ) ;
105+ }
106+ } else {
107+ console . log ( '%cElement is null. Skipping check and adjustment.' , 'font-size: 15px; color: red;' ) ;
108+ }
109+ }
110+
111+ function RunTopLogs ( ) {
112+ console . log ( '%cdiscord.gg/interstellar' , 'font-weight: bold; font-size: 39px; color: red; text-shadow: 3px 3px 0 rgb(217,31,38), 6px 6px 0 rgb(226,91,14), 9px 9px 0 rgb(245,221,8), 12px 12px 0 rgb(5,148,68), 15px 15px 0 rgb(2,135,206), 18px 18px 0 rgb(4,77,145), 21px 21px 0 rgb(42,21,113); margin-bottom: 12px; padding: 5%;' ) ;
113+ }
114+
115+ var heightAdjusted = false ;
116+
117+ function fullscreenClickHandler ( event ) {
118+ if ( event . detail > 1 ) {
119+ event . preventDefault ( ) ;
120+ return ;
121+ }
122+
123+ console . log ( '%cFullscreen button clicked.' , 'font-size: 15px; color: orange;' ) ;
124+
125+ console . log ( '%cAdjusting height to 415px...' , 'font-size: 15px; color: orange;' ) ;
126+
127+ var iframe = top . document . getElementById ( 'iframeId' ) ;
128+ if ( iframe ) {
129+ var innerDoc = iframe . contentWindow . document ;
130+ var roblox = innerDoc . getElementById ( 'js-game-video' ) ;
131+
132+ setTimeout ( function ( ) {
133+ if ( roblox ) {
134+ roblox . style . top = '415px' ;
135+ console . log ( '%cHeight adjusted to 415px.' , 'font-size: 15px; color: green;' ) ;
136+ heightAdjusted = true ;
137+ }
138+ } , 3000 ) ;
139+ }
140+
141+ var fullscreen = innerDoc . getElementById ( 'ng-fs' ) || innerDoc . querySelector ( '.sc-kOcGyv.dkAhwC' ) ;
142+ if ( fullscreen ) {
143+ fullscreen . removeEventListener ( 'mousedown' , fullscreenClickHandler ) ;
144+
145+ if ( ! heightAdjusted ) {
146+ fullscreen . addEventListener ( 'mousedown' , fullscreenClickHandler ) ;
147+ }
148+ }
57149}
58150
59- checkAndAdjust ( ) ;
60- console . log ( '%cNow.GG Adjustment script started. Checking every 7 seconds.' , 'font-size: 15px; color: blue;' ) ;
151+ CheckAndAdjust ( ) ;
152+ console . log ( '%cNow.GG Adjustment script started. Checking every 5 seconds.' , 'font-size: 15px; color: blue;' ) ;
0 commit comments