-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathblockly.html
73 lines (69 loc) · 1.65 KB
/
blockly.html
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
<html>
<head>
<meta charset="utf-8">
<style>
* {
margin: 0;
padding: 0;
}
html, body {
background-color: #fff;
margin: 0;
padding: 0;
height:100%;
overflow:hidden;
}
#header {
position:absolute; left:0px;right:0px; top:0px;
width: 100%;
}
#send {
margin: 2px;
background-color: #7ff;
display: inline-block;
width : 100px;
height : 24px;
border: 2px solid #077;
border-radius: 5px;
text-align:center;
font-size: 120%;
cursor: pointer;
}
#blockly_container {
position:absolute; left:0px;right:0px; top:32px;bottom:0px;
}
#blockly {
width:100%;height:100%;border:0;
}
</style>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
var Blockly;
window.blocklyLoaded = function(blockly, blocklyWindow) { // see blockly/blockly.html
Blockly = blockly;
if (blocklyWindow) {
blocklyWindow.promptAsync = function(title,value,callback) {
var value = window.prompt(title,value);
callback(value);
};
}
};
$(function() {
$("#send").click(function(e) {
e.preventDefault();
var code = Blockly.JavaScript.workspaceToCode('JavaScript');
console.log("Program -> "+code);
document.cookie = "code="+window.btoa(code);
});
});
</script>
</head>
<body>
<div id="header">
<span id="send">Upload</span>
</div>
<div id="blockly_container">
<iframe id="blockly" src="blockly/blockly.html"></iframe>
</div>
</body>
</html>