1- var steConsoleData = [ ]
1+ var steConsoleData = [ ] ;
22
33var ste = {
44 console : {
@@ -15,18 +15,13 @@ var ste = {
1515 "font-family: Inter" ,
1616 "width: 2rem" ,
1717 ] ;
18- console . log (
19- "%cScratchTools" ,
20- styleArray . join ( ";" ) ,
21- title ,
22- content
23- ) ;
18+ console . log ( "%cScratchTools" , styleArray . join ( ";" ) , title , content ) ;
2419 steConsoleData . push ( {
2520 script : title ,
2621 data : content ,
2722 time : Date . now ( ) ,
2823 type : "log" ,
29- } )
24+ } ) ;
3025 } ,
3126 warn : function ( content , title ) {
3227 var styleArray = [
@@ -41,18 +36,13 @@ var ste = {
4136 "font-family: Inter" ,
4237 "width: 2rem" ,
4338 ] ;
44- console . log (
45- "%cScratchTools" ,
46- styleArray . join ( ";" ) ,
47- title ,
48- content
49- ) ;
39+ console . log ( "%cScratchTools" , styleArray . join ( ";" ) , title , content ) ;
5040 steConsoleData . push ( {
5141 script : title ,
5242 data : content ,
5343 time : Date . now ( ) ,
5444 type : "warn" ,
55- } )
45+ } ) ;
5646 } ,
5747 error : function ( content , title ) {
5848 var styleArray = [
@@ -67,24 +57,19 @@ var ste = {
6757 "font-family: Inter" ,
6858 "width: 2rem" ,
6959 ] ;
70- console . log (
71- "%cScratchTools" ,
72- styleArray . join ( ";" ) ,
73- title ,
74- content
75- ) ;
60+ console . log ( "%cScratchTools" , styleArray . join ( ";" ) , title , content ) ;
7661 steConsoleData . push ( {
7762 script : title ,
7863 data : content ,
7964 time : Date . now ( ) ,
8065 type : "error" ,
81- } )
66+ } ) ;
8267 } ,
8368 } ,
8469} ;
8570
8671var ScratchTools = { } ;
87- ScratchTools . managedElements = [ ]
72+ ScratchTools . managedElements = [ ] ;
8873ScratchTools . Storage = { } ;
8974ScratchTools . Resources = { } ;
9075ste . console . log ( "ScratchTools API Created" , "ste-main" ) ;
@@ -276,21 +261,26 @@ ScratchTools.setDisable = function (feature, f) {
276261 ste . console . log ( `Set disable function for ${ feature } .` , "ste-main" ) ;
277262} ;
278263
279- Element . prototype . applyStyles = function ( data ) {
280- var element = this
281- Object . keys ( data ) . forEach ( function ( el ) {
282- element . style [ el ] = data [ el ]
283- } )
284- }
264+ Element . prototype . applyStyles = function ( data ) {
265+ var element = this ;
266+ Object . keys ( data ) . forEach ( function ( el ) {
267+ element . style [ el ] = data [ el ] ;
268+ } ) ;
269+ } ;
285270
286271ScratchTools . disable = function ( feature ) {
287- allFeatures . filter ( ( el ) => el . self . id === feature ) . forEach ( function ( el ) {
288- el . self . enabled = false
289- } )
290- ScratchTools . managedElements . filter ( ( el ) => el . feature === feature ) . forEach ( function ( el ) {
291- el . previousDisplay = el . element . style . display
292- el . element . style . display = "none"
293- } )
272+ allFeatures
273+ . filter ( ( el ) => el . self . id === feature )
274+ . forEach ( function ( el ) {
275+ el . self . enabled = false ;
276+ } ) ;
277+ ScratchTools . managedElements
278+ . filter ( ( el ) => el . feature === feature )
279+ . forEach ( function ( el ) {
280+ if ( ! el . element ) return ;
281+ el . previousDisplay = el . element ?. style . display ;
282+ el . element . style . display = "none" ;
283+ } ) ;
294284 ste . console . log ( `Disabled ${ feature } .` , "ste-main" ) ;
295285 document
296286 . querySelectorAll ( `link[data-feature=${ feature } ]` )
@@ -391,3 +381,14 @@ ScratchTools.waitForElements(
391381 "ste-full-settings-btn" ,
392382 false
393383) ;
384+
385+ async function blockliveDetection ( ) {
386+ let gui = document
387+ . querySelector ( "#app" )
388+ [
389+ Object . keys ( app ) . find ( ( key ) => key . startsWith ( "__reactContainer" ) )
390+ ] . child . stateNode . store . getState ( ) ?. scratchGui ;
391+ if ( ! gui ?. projectState ) return ;
392+ let detectBlocklive = await import ( "./blocklive-detection/blocklive-detect.js" ) ;
393+ detectBlocklive . default ( ) ;
394+ }
0 commit comments