1
- const fs = require ( "fs" ) ;
1
+ createAppStartupCodeFile ( ( ) => {
2
+ const fs = require ( "fs" ) ;
2
3
3
- document . body . style . backgroundSize = "100% 100%" ;
4
- document . body . style . backgroundImage = "url(https://images.pexels.com/photos/443446/pexels-photo-443446.jpeg?auto=compress&cs=tinysrgb&w=1280)" ;
5
- document . body . children [ 0 ] . style . opacity = "0.965" ;
6
- document . body . children [ 0 ] . style . backgroundColor = "#159be1" ;
7
- document . getElementById ( "pageEmbed" ) . style . backgroundColor = "black" ;
8
- document . getElementById ( "pageEmbed" ) . style . opacity = "0.85" ;
9
- document . getElementById ( "pageEmbed" ) . style . borderTopLeftRadius = "0" ;
10
- document . getElementById ( "pageEmbed" ) . style . borderBottomLeftRadius = "0" ;
11
- document . getElementById ( "pageEmbed" ) . contentWindow . document . body . style . color = "white" ;
12
- document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 0 ] . children [ 0 ] . style . color = "white" ;
13
- if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/scripts/index.html" ) ) {
14
- document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 2 ] . children [ 0 ] . children [ 1 ] . style . color = "white" ;
15
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . filter = "none" ;
16
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . width = "calc(100% + 2px)" ;
17
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . marginLeft = "-1px" ;
18
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . marginBottom = "-1px" ;
19
- } ;
20
- if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/debug/index.html" ) ) {
21
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "debugLogInput" ) . style . color = "white" ;
22
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "debugCodeExecutionInput" ) . style . borderTopLeftRadius = "2.5px" ;
23
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "debugCodeExecutionInput" ) . style . borderBottomLeftRadius = "2.5px" ;
24
- } ;
25
- if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/settings/index.html" ) ) {
26
- document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 2 ] . children [ 0 ] . style . display = "none" ;
27
- document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 2 ] . children [ 1 ] . style . display = "none" ;
28
- } ;
29
- if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/help/index.html" ) ) {
30
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "markdownEmbed" ) . style . filter = "invert(95%) hue-rotate(180deg)" ;
31
- document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "markdownEmbed" ) . src = ( ( Object . keys ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) ) . length ) ? ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourceProtocol + "//" + JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourceHostname + ( ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourcePort ) ? ( ":" + JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourcePort ) : "" ) ) : ( process . env . DEFAULT_RESOURCE_SERVER_PROTOCOL + "//" + process . env . DEFAULT_RESOURCE_SERVER_HOSTNAME + ( ( process . env . DEFAULT_RESOURCE_SERVER_PORT ) ? ( ":" + process . env . DEFAULT_RESOURCE_SERVER_PORT ) : "" ) ) ) + "/help/?darkMode=true" ;
32
- } ;
33
- if ( ( JSON . parse ( localStorage . getItem ( "settings" ) ) || { } ) . darkMode ) {
34
- localStorage . setItem ( "settings" , JSON . stringify ( {
35
- ...JSON . parse ( localStorage . getItem ( "settings" ) ) || { } ,
36
- ...{
37
- darkMode : false
38
- }
39
- } ) ) ;
40
- document . styleSheets [ 2 ] . media . deleteMedium ( "(prefers-color-scheme: dark)" ) ;
41
- document . styleSheets [ 2 ] . media . appendMedium ( "(prefers-color-scheme: white)" ) ;
42
- } ;
43
- document . getElementById ( "pageEmbed" ) . addEventListener ( "load" , ( ) => {
4
+ document . body . style . backgroundSize = "100% 100%" ;
5
+ document . body . style . backgroundImage = "url(https://images.pexels.com/photos/443446/pexels-photo-443446.jpeg?auto=compress&cs=tinysrgb&w=1280)" ;
6
+ document . body . children [ 0 ] . style . opacity = "0.965" ;
7
+ document . body . children [ 0 ] . style . backgroundColor = "#159be1" ;
8
+ document . getElementById ( "pageEmbed" ) . style . backgroundColor = "black" ;
9
+ document . getElementById ( "pageEmbed" ) . style . opacity = "0.85" ;
10
+ document . getElementById ( "pageEmbed" ) . style . borderTopLeftRadius = "0" ;
11
+ document . getElementById ( "pageEmbed" ) . style . borderBottomLeftRadius = "0" ;
44
12
document . getElementById ( "pageEmbed" ) . contentWindow . document . body . style . color = "white" ;
45
13
document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 0 ] . children [ 0 ] . style . color = "white" ;
46
14
if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/scripts/index.html" ) ) {
47
- document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 2 ] . children [ 0 ] . children [ 1 ] . style . color = "white" ;
15
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 2 ] . children [ 0 ] . children [ 1 ] . style . color = "white" ;
48
16
document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . filter = "none" ;
49
17
document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . width = "calc(100% + 2px)" ;
50
18
document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . marginLeft = "-1px" ;
@@ -63,4 +31,38 @@ document.getElementById("pageEmbed").addEventListener("load", () => {
63
31
document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "markdownEmbed" ) . style . filter = "invert(95%) hue-rotate(180deg)" ;
64
32
document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "markdownEmbed" ) . src = ( ( Object . keys ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) ) . length ) ? ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourceProtocol + "//" + JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourceHostname + ( ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourcePort ) ? ( ":" + JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourcePort ) : "" ) ) : ( process . env . DEFAULT_RESOURCE_SERVER_PROTOCOL + "//" + process . env . DEFAULT_RESOURCE_SERVER_HOSTNAME + ( ( process . env . DEFAULT_RESOURCE_SERVER_PORT ) ? ( ":" + process . env . DEFAULT_RESOURCE_SERVER_PORT ) : "" ) ) ) + "/help/?darkMode=true" ;
65
33
} ;
34
+ if ( ( JSON . parse ( localStorage . getItem ( "settings" ) ) || { } ) . darkMode ) {
35
+ localStorage . setItem ( "settings" , JSON . stringify ( {
36
+ ...JSON . parse ( localStorage . getItem ( "settings" ) ) || { } ,
37
+ ...{
38
+ darkMode : false
39
+ }
40
+ } ) ) ;
41
+ document . styleSheets [ 2 ] . media . deleteMedium ( "(prefers-color-scheme: dark)" ) ;
42
+ document . styleSheets [ 2 ] . media . appendMedium ( "(prefers-color-scheme: white)" ) ;
43
+ } ;
44
+ document . getElementById ( "pageEmbed" ) . addEventListener ( "load" , ( ) => {
45
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . body . style . color = "white" ;
46
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 0 ] . children [ 0 ] . style . color = "white" ;
47
+ if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/scripts/index.html" ) ) {
48
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 2 ] . children [ 0 ] . children [ 1 ] . style . color = "white" ;
49
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . filter = "none" ;
50
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . width = "calc(100% + 2px)" ;
51
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . marginLeft = "-1px" ;
52
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "scriptEditor" ) . style . marginBottom = "-1px" ;
53
+ } ;
54
+ if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/debug/index.html" ) ) {
55
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "debugLogInput" ) . style . color = "white" ;
56
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "debugCodeExecutionInput" ) . style . borderTopLeftRadius = "2.5px" ;
57
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "debugCodeExecutionInput" ) . style . borderBottomLeftRadius = "2.5px" ;
58
+ } ;
59
+ if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/settings/index.html" ) ) {
60
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 2 ] . children [ 0 ] . style . display = "none" ;
61
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . body . children [ 2 ] . children [ 1 ] . style . display = "none" ;
62
+ } ;
63
+ if ( document . getElementById ( "pageEmbed" ) . src . endsWith ( "/help/index.html" ) ) {
64
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "markdownEmbed" ) . style . filter = "invert(95%) hue-rotate(180deg)" ;
65
+ document . getElementById ( "pageEmbed" ) . contentWindow . document . getElementById ( "markdownEmbed" ) . src = ( ( Object . keys ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) ) . length ) ? ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourceProtocol + "//" + JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourceHostname + ( ( JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourcePort ) ? ( ":" + JSON . parse ( fs . readFileSync ( path . join ( process . resourcesPath , "customServer.json" ) , "utf8" ) ) . resourcePort ) : "" ) ) : ( process . env . DEFAULT_RESOURCE_SERVER_PROTOCOL + "//" + process . env . DEFAULT_RESOURCE_SERVER_HOSTNAME + ( ( process . env . DEFAULT_RESOURCE_SERVER_PORT ) ? ( ":" + process . env . DEFAULT_RESOURCE_SERVER_PORT ) : "" ) ) ) + "/help/?darkMode=true" ;
66
+ } ;
67
+ } ) ;
66
68
} ) ;
0 commit comments