forked from dakadayyds/Dakadajs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdakada.js
272 lines (261 loc) · 24.5 KB
/
dakada.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
(function (Scratch) {
'use strict';
Scratch.translate.setup({
'en': {
'dakadajs.name': 'Dakada\'s JS function',
'dakadajs.error': 'error',
'dakadajs.coder': 'run code [code] and return',
'dakadajs.coder_command': 'run code [code2]',
'dakadajs.have_func': 'have function [name]?',
'dakadajs.js_coder': 'set function [name] with code [list]',
'dakadajs.new_js_coder': 'set function [name] with code [list] and args [args]',
'dakadajs.js_list_coder': 'set function [name] with list [list] and args [args]',
'dakadajs.delete_coder': 'delete function [name]',
'dakadajs.run_fuction': 'run function [name] with args [param]',
},
'zh': {
'dakadajs.name': 'Dakada的JS函数',
'dakadajs.error': '错误',
'dakadajs.coder': '运行 [code] 并返回结果',
'dakadajs.coder_command': '运行 [code2]',
'dakadajs.have_func': '存在函数 [name]?',
'dakadajs.js_coder': '设置函数 [name],代码为 [list]',
'dakadajs.new_js_coder': '设置函数 [name],代码为 [list],参数为 [args]',
'dakadajs.js_list_coder': '设置函数 [name],代码为列表 [list],参数为 [args]',
'dakadajs.delete_coder': '删除函数 [name]',
'dakadajs.run_fuction': '运行函数 [name],参数为 [param]',
},
});
class dakada {
constructor() {
this.lists = [];
this.error_ = '';
}
getInfo() {
return {
id: 'dakadajs',
name: Scratch.translate({ id: "dakadajs.name", default: "Dakada's JS function" }),
color1: '#FFC93E',
color2: '#FFC93E',
blockIconURI: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIHdpZHRoPSI5Mi44NjQ0NTM3MzI4NzcwNyIgaGVpZ2h0PSIxMDguNTg5NjIwMDUzNjc3ODUiIHZpZXdCb3g9IjAuOTE2ODg1NTI1MDMzMzI5NCAwLjc2NzAwODMzNDQ0MzQyNDYgOTIuODY0NDUzNzMyODc3MDcgMTA4LjU4OTYyMDA1MzY3Nzg1Ij4KICA8IS0tIEV4cG9ydGVkIGJ5IFNjcmF0Y2ggLSBodHRwOi8vc2NyYXRjaC5taXQuZWR1LyAtLT4KICA8ZyBpZD0iSUQwLjgzMjM4Mjk3Mzc0OTE5MDYiPgogICAgPHBhdGggaWQ9IlJfTGVnIiBmaWxsPSIjRkZDOTNFIiBzdHJva2U9IiM2MDM4MTMiIHN0cm9rZS13aWR0aD0iMS4zMjY4NDA4MTc4MzgwMDQyIiBkPSJNIDQ3LjI1ODQgOTcuNTU3NyBDIDQ3LjI1ODQgOTYuMTkzIDQ3LjY0MTIgOTQuMjMyNiA0OS43NTg4IDkzLjc5MDEgQyA1Mi44MTM5IDkzLjE0OTIgNTYuMzA5NCA5Ni4yNDI4IDU3LjI2MDEgOTcuMTUzIEMgNTcuMTg5OCA5Ny41MTU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3ZnPg==',
blocks: [
{
opcode: 'error',
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate({ id: "dakadajs.error", default: "error" }),
disableMonitor: true,
},
'---',
{
opcode: 'coder',
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate({ id: "dakadajs.coder", default: "run code [code] and return" }),
arguments: {
code: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'return 1+1;',
},
},
disableMonitor: true,
},
{
opcode: 'coder_command',
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({ id: "dakadajs.coder_command", default: "run code [code2]" }),
arguments: {
code2: {
type: Scratch.ArgumentType.STRING,
defaultValue: '1+1',
},
},
},
'---',
{
opcode: 'have_func',
blockType: Scratch.BlockType.BOOLEAN,
text: Scratch.translate({ id: "dakadajs.have_func", default: "have function [name]?" }),
arguments: {
name: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Gobo',
},
},
},
{
opcode: 'js_coder',
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({ id: "dakadajs.js_coder", default: "set function [name] with code [list]" }),
hideFromPalette: true,
arguments: {
list: {
type: Scratch.ArgumentType.STRING,
defaultValue: '?',
},
name: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Gobo',
},
},
},
{
opcode: 'new_js_coder',
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({ id: "dakadajs.new_js_coder", default: "set function [name] with code [list] and args [args]" }),
arguments: {
list: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'return arg+1;',
},
name: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Gobo',
},
args: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'arg',
}
},
},
{
opcode: 'js_list_coder',
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({ id: "dakadajs.js_list_coder", default: "set function [name] with list [list] and args [args]" }),
arguments: {
list: {
type: Scratch.ArgumentType.STRING,
menu: 'listMenu',
},
name: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Gobo',
},
args: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'arg',
}
},
},
{
opcode: 'delete_coder',
blockType: Scratch.BlockType.COMMAND,
text: Scratch.translate({ id: "dakadajs.delete_coder", default: "delete function [name]" }),
arguments: {
name: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Gobo',
},
},
},
{
opcode: 'run_fuction',
blockType: Scratch.BlockType.REPORTER,
text: Scratch.translate({ id: "dakadajs.run_fuction", default: "run function [name] with args [param]" }),
arguments: {
name: {
type: Scratch.ArgumentType.STRING,
defaultValue: 'Gobo',
},
param: {
type: Scratch.ArgumentType.STRING,
defaultValue: '114,514',
},
},
disableMonitor: true,
},
],
menus: {
listMenu: {
items: 'findAllList'
},
}
};
}
findAllList() {
const list = [];
const variables = vm.runtime.targets[0].variables;
Object.keys(variables).forEach(obj => {
if (variables[obj].type === 'list') {
list.push({
text: variables[obj].name,
value: variables[obj].name,
});
}
});
if (list.length === 0) {
list.push({
text: `-`,
value: 'empty'
});
}
return list;
}
error() {
return String(this.error_);
}
coder(args) {
return (new Function(args.code))();
}
coder_command(args) {
(new Function(args.code2))();
}
have_func(args) {
let name = String(args.name);
return (name in this.lists);
}
js_coder(args) {
let name = String(args.name);
this.error_ = '[Dakada]已废弃积木';
}
new_js_coder(args) {
let name = String(args.name);
if (name in this.lists) {
his.error_ = '[Dakada]该函数已存在';
} else {
try {
this.lists[name] = new Function(...String(args.args).split(","), String(args.list));
this.error_ = '';
} catch (err2) {
this.error_ = err2;
}
}
}
js_list_coder(args, util) {
let name = String(args.name);
if (args.list != 'empty') {
const list = util.target.lookupVariableByNameAndType(String(args.list), 'list');
var listvalue = list.value;
if (!(name in this.lists)) {
try {
this.lists[name] = new Function(...String(args.args).split(","), listvalue.join(" "));
this.error_ = '';
} catch (err) {
this.error_ = err;
}
}
}
else this.error_ = "[Dakada]没有列表";
}
delete_coder(args) {
let name = String(args.name);
this.error_ = '';
delete this.lists[name];
}
run_fuction(args) {
let name = String(args.name);
if (name in this.lists) {
try {
this.error_ = '';
return this.lists[name](...String(args.param).split(','));
} catch (error) {
this.error_ = error;
return "";
}
} else {
this.error_ = '[Dakada]函数不存在';
return "";
}
}
}
Scratch.extensions.register(new dakada());
}(Scratch));