f = open("/FUNCTIONS/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/FUNCTIONS_BACKEND.txt",'w',encoding="utf-8") | |
f.write(BACKEND) | |
f.close() | |
f = open("/FUNCTIONS/FUNCTIONS_FRONTEND.txt",'w',encoding="utf-8") | |
f.write(FRONTEND) | |
f.close() | |