-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
84 lines (68 loc) · 2.07 KB
/
main.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
// create workspace
var workspace = Blockly.inject("blockly-editor", {
toolbox: document.getElementById("toolbox"),
scrollbars: false,
horizontalLayout: false,
zoom: {
controls: true,
wheel: false,
startScale: 0.7,
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.2,
pinch: true
},
grid: {
spacing: 20,
length: 3,
colour: "#ddd",
snap: true
},
tooloboxOptions: {
disableAutoClose: true,
},
// toolboxPosition: "end",
});
// keep the selected toolbox open when dragging blocks
// workspace.toolbox_.flyout_.autoClose = false;
workspace.getFlyout().autoClose = false;
// show the input from problem: to info mining section
// reset selection
function showProblem() {
// erase the previous problem desc in info mining section & erase all keywords added
var infoMiningArea = document.getElementById("info-mining");
infoMiningArea.innerHTML = ""
deleteAll();
// get the input from input box
var problem = document.getElementById("fillbox").value.toString();
// create new element to be append to HTML
var paragraph = document.createElement('p');
paragraph.textContent = problem;
// append "problem" to info-mining
infoMiningArea.appendChild(paragraph);
}
// Event listener for the "Delete Keyword" dropdown menu
document.getElementById('delete').addEventListener('change', function(event) {
var selectedKeyword = event.target.value;
if (selectedKeyword) {
deleteKeyword(selectedKeyword);
}
});
// README webpage
function readme1a() {
// window.location.href =
}
function readme1b() {
}
function readme1c() {
}
workspace.registerButtonCallback('readme1a', readme1a);
workspace.registerButtonCallback('readme1b', readme1b);
workspace.registerButtonCallback('readme1c', readme1c);
// ---------------------------------------
// // write code in text-editor
// function showCode() {
// var code = "xxxxx";
// var textEditor = createEditor();
// textEditor.getSession().setValue(code)
// }