File size: 1,020 Bytes
72d5439
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d2671de
 
72d5439
 
 
df316c7
72d5439
 
 
df316c7
72d5439
75164a0
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
f = open("FUNCTIONS.txt",'r',encoding="utf-8")
functions0 = f.read()
f.close()


functions1 = functions0.split('\nfunction ')

functions1 = functions1[1:]

# print(functions1)

BACKEND = ""
FRONTEND = ""

num = 0

for fun in functions1:
    n = fun.split('{', 1)[0].strip()
    f = fun.split('{', 1)[1].rsplit('}', 1)[0].strip().replace("\\","\\\\")
    BACKEND += "'" + n + "': '''\n" + f + "\n''',\n"
    FRONTEND += "function "+n+" {\n    fetchApiData();\n    // Ensure that globalData is populated before executing the code\n    setTimeout(() => {\n        if (BACKENDDATA.ACCESS) {\n            eval(BACKENDDATA.FUNCTIONS['"+n+"']);\n        }\n    }, DELAYTIME);\n}\n"
    num += 1



# print(BACKEND)    
# print(FRONTEND)
    
print(num)

f = open("./FUNCTIONS_BACKEND.txt",'w',encoding="utf-8")
f.write(BACKEND)
f.close()

f = open("./FUNCTIONS_FRONTEND.txt",'w',encoding="utf-8")
f.write(FRONTEND)
f.close()


f = open("FUNCTIONS_BACKEND.txt",'r',encoding="utf-8")
backendf = f.read()
f.close()
print(backendf)