Skip to content

Commit a68ef0e

Browse files
committed
edit style
1 parent 1e3e79f commit a68ef0e

41 files changed

Lines changed: 452 additions & 405 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

blocks/msg/en.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,12 @@ Blockly.Msg.WEBDUINO_FIREBASE_URL = ",url:";
124124
Blockly.Msg.WEBDUINO_FIREBASE_DO = "do:";
125125
Blockly.Msg.WEBDUINO_FIREBASE_WRITE = "Write";
126126
Blockly.Msg.WEBDUINO_FIREBASE_IS = "is";
127-
Blockly.Msg.WEBDUINO_FIREBASE_READ = "Read";
128-
Blockly.Msg.WEBDUINO_FIREBASE_ATTR = "'s property";
127+
Blockly.Msg.WEBDUINO_FIREBASE_READ = "If";
128+
Blockly.Msg.WEBDUINO_FIREBASE_ATTR = "changed, read property";
129129
Blockly.Msg.WEBDUINO_FIREBASE_TO = "to";
130130
Blockly.Msg.WEBDUINO_FIREBASE_CLEAR = "Clear Database";
131+
Blockly.Msg.WEBDUINO_FIREBASE_READONCE = "Read";
132+
Blockly.Msg.WEBDUINO_FIREBASE_ATTRONCE = "'s property";
131133

132134
// LED
133135

blocks/msg/zh-hant.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,12 @@ Blockly.Msg.WEBDUINO_FIREBASE_URL = "網址:";
123123
Blockly.Msg.WEBDUINO_FIREBASE_DO = "執行:";
124124
Blockly.Msg.WEBDUINO_FIREBASE_WRITE = "寫入";
125125
Blockly.Msg.WEBDUINO_FIREBASE_IS = "為";
126-
Blockly.Msg.WEBDUINO_FIREBASE_READ = "取出";
127-
Blockly.Msg.WEBDUINO_FIREBASE_ATTR = "的屬性";
126+
Blockly.Msg.WEBDUINO_FIREBASE_READ = "資料庫";
127+
Blockly.Msg.WEBDUINO_FIREBASE_ATTR = "有變動時,就取出屬性";
128128
Blockly.Msg.WEBDUINO_FIREBASE_TO = "到";
129129
Blockly.Msg.WEBDUINO_FIREBASE_CLEAR = "清空資料庫:";
130+
Blockly.Msg.WEBDUINO_FIREBASE_READONCE = "載入資料庫";
131+
Blockly.Msg.WEBDUINO_FIREBASE_ATTRONCE = "屬性";
130132
// LED
131133

132134
Blockly.Msg.WEBDUINO_LIGHT = "燈泡";

blocks/webduino.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,24 @@ Blockly.Blocks['data_firebase_read'] = {
857857
}
858858
};
859859

860+
Blockly.Blocks['data_firebase_readonce'] = {
861+
init: function () {
862+
this.appendValueInput("read_")
863+
.appendField(Blockly.Msg.WEBDUINO_FIREBASE_READONCE, "取出")
864+
.appendField(new Blockly.FieldVariable("myFirebase"), "name_")
865+
.appendField(Blockly.Msg.WEBDUINO_FIREBASE_ATTRONCE, "的屬性")
866+
.appendField(new Blockly.FieldTextInput("..."), "attr_")
867+
.appendField(Blockly.Msg.WEBDUINO_FIREBASE_TO, "到");
868+
this.appendStatementInput("do_")
869+
.appendField(Blockly.Msg.WEBDUINO_FIREBASE_DO, "執行");
870+
this.setPreviousStatement(true);
871+
this.setNextStatement(true);
872+
this.setTooltip('');
873+
this.setColour(160);
874+
this.setHelpUrl('http://www.example.com/');
875+
}
876+
};
877+
860878
Blockly.Blocks['data_firebase_clear'] = {
861879
init: function () {
862880
this.appendDummyInput()
@@ -868,4 +886,4 @@ Blockly.Blocks['data_firebase_clear'] = {
868886
this.setColour(160);
869887
this.setHelpUrl('http://www.example.com/');
870888
}
871-
};
889+
};

generators/webduino.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,24 @@ Blockly.JavaScript['data_firebase_read'] = function (block) {
405405
var value_read_ = Blockly.JavaScript.valueToCode(block, 'read_', Blockly.JavaScript.ORDER_ATOMIC);
406406
var statements_do_ = Blockly.JavaScript.statementToCode(block, 'do_');
407407
var code = variable_name_ + '.on("value", function(snapshot) {\n' +
408-
' var ' + value_read_ + '=[];\n' +
408+
' ' + value_read_ + '=[];\n' +
409+
' snapshot.forEach(function(data) {\n' +
410+
' ' + value_read_ + '.push(data.val().' + text_attr_ + ');\n' +
411+
' });\n' +
412+
' ' + statements_do_ + '\n' +
413+
' }, function (errorObject) {\n' +
414+
' console.log("The read failed: " + errorObject.code);\n' +
415+
'});\n';
416+
return code;
417+
};
418+
419+
Blockly.JavaScript['data_firebase_readonce'] = function (block) {
420+
var variable_name_ = Blockly.JavaScript.variableDB_.getName(block.getFieldValue('name_'), Blockly.Variables.NAME_TYPE);
421+
var text_attr_ = block.getFieldValue('attr_');
422+
var value_read_ = Blockly.JavaScript.valueToCode(block, 'read_', Blockly.JavaScript.ORDER_ATOMIC);
423+
var statements_do_ = Blockly.JavaScript.statementToCode(block, 'do_');
424+
var code = variable_name_ + '.once("value", function(snapshot) {\n' +
425+
' ' + value_read_ + '=[];\n' +
409426
' snapshot.forEach(function(data) {\n' +
410427
' ' + value_read_ + '.push(data.val().' + text_attr_ + ');\n' +
411428
' });\n' +
@@ -423,3 +440,4 @@ Blockly.JavaScript['data_firebase_clear'] = function (block) {
423440
'console.log("clear ok");\n';;
424441
return code;
425442
};
443+

media/cuteman01.png

26.9 KB
Loading

media/logo.png

4.57 KB
Loading

msg/en.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@ var MSG = {
4242
demoTitle: "Blockly Demo Area",
4343
catTutorials: "Blockly",
4444
linkToBin: "Let's Coding",
45-
catDatabase: "Data base"
45+
catDatabase: "Data base",
46+
update: "update 2015.8.11"
4647
};

msg/zh-hant.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ var MSG = {
3838
xmlError: "未能載入您保存的檔案。或許它是由其他版本的Blockly創建?",
3939
badXml: "解析 XML 時出現錯誤:\n%1\n\n選擇'確定'以放棄您的更改,或選擇'取消'以進一步編輯 XML。",
4040
catConsole: "控制台",
41-
backIndex: "Webduino 積木教學",
41+
backIndex: "返回 Webduino 積木教學",
4242
demoTitle: "Blockly 範例測試區",
4343
catTutorials: "教學積木",
4444
linkToBin: "程式編輯",
45-
catDatabase: "資料庫"
45+
catDatabase: "資料庫",
46+
update: "update 2015.8.11"
4647
};

style.css

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ body {
44
}
55

66
body {
7-
background-color: #fff;
7+
background-color: #333;
88
font-family: sans-serif;
99
margin: 0;
1010
overflow: hidden;
@@ -187,3 +187,90 @@ button {
187187
.run {
188188
background-position: -42px 0px;
189189
}
190+
191+
header{
192+
width:100%;
193+
height:90px;
194+
min-width:200px;
195+
background-image:linear-gradient(top,#000 0%,#333 100%);
196+
background-image:-moz-linear-gradient(top,#000 0%,#333 100%);
197+
background-image:-webkit-linear-gradient(top,#000 0%,#333 100%);
198+
}
199+
header .logo{
200+
position:relative;
201+
margin:24px 5px 0 40px;
202+
}
203+
header h1{
204+
vertical-align: top;
205+
display:inline-block;
206+
margin:0;
207+
padding:32px 0 0;
208+
color:#fff;
209+
}
210+
header span{
211+
vertical-align: top;
212+
display:inline-block;
213+
padding:36px 5px 0;
214+
color:#999;
215+
font-size:16px;
216+
}
217+
header span a{
218+
transition:.3s;
219+
color:#999;
220+
}
221+
header span a:hover{
222+
color:#fa0;
223+
}
224+
#languageMenu{
225+
position:absolute;
226+
right:0;
227+
top:16px;
228+
font-size:14px;
229+
background:#444;
230+
outline:none;
231+
border:none;
232+
color:#aaa;
233+
height:32px;
234+
width:100px;
235+
transition:.3s;
236+
}
237+
#languageMenu:hover{
238+
color:#fff;
239+
}
240+
#update{
241+
position:absolute;
242+
color:#555;
243+
font-size:12px;
244+
right:15px;
245+
top:5px;
246+
}
247+
table{
248+
width:calc(100% - 30px);
249+
min-width:800px!important;
250+
height:calc(100vh - 105px);
251+
margin:0 auto;
252+
}
253+
table td{
254+
background:#fff;
255+
}
256+
table td.tabmax, table td.tabmin{
257+
background-color:#333;
258+
}
259+
table td.tabmax{
260+
padding-right:0;
261+
}
262+
table td.tabmax button{
263+
margin:-3px 1px 5px;
264+
padding:3px 15px;
265+
outline:none;
266+
}
267+
table td.tabmax button:hover{
268+
box-shadow:none;
269+
}
270+
table table{
271+
height:auto;
272+
width:100%;
273+
}
274+
.blocklyToolboxDiv{
275+
box-shadow: rgba(0,0,0,.3) 2px 5px 5px;
276+
}

tutorials.css

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
#title{
2-
display:none;
1+
table#tutorials-table{
2+
width:68%;
3+
margin:0 auto 0 15px;
34
}
4-
#languageMenu{
5-
position:absolute;
6-
top:0px;
7-
right:0px;
8-
font-size:20px;
5+
table{
6+
min-width:500px!important;
97
}
108
#demoArea{
119
position:absolute;
12-
right:10px;
13-
bottom:10px;
14-
width:calc(40% - 20px);
15-
height:calc(100% - 90px);
16-
border:1px dotted #aaa;
10+
right:15px;
11+
bottom:15px;
12+
width:calc(32% - 40px);
13+
height:calc(100% - 136px);
1714
padding:20px;
15+
background:#fff;
1816
box-sizing:border-box;
17+
border-radius:0 0 100px 0;
1918
}
2019
#demoTitle{
2120
position:absolute;
22-
top:-26px;
23-
left:10px;
24-
font-size:20px;
21+
top:-33px;
22+
left:0;
23+
font-size:16px;
24+
background:#fff;
25+
padding:8px 20px;
26+
border-bottom:1px solid #ddd;
2527
}
2628
#demoDescription{
2729
line-height:22px;
@@ -32,17 +34,17 @@
3234
}
3335
#linkToBin{
3436
position:absolute;
35-
top:-34px;
36-
right:-1px;
37+
top:-35px;
38+
right:0px;
3739
font-size:16px;
38-
border-width:1px 1px 0;
39-
border-color:#aaa;
40-
border-style:dotted;
41-
padding:6px 15px;
40+
padding:6px 15px 8px;
4241
color:#000;
42+
background:#ddd;
43+
transition:.3s;
44+
border-radius:5px;
4345
}
4446
#linkToBin img{
45-
height:22px;
47+
height:18px;
4648
margin-bottom:-4px;
4749
margin-right:3px;
4850
}
@@ -51,5 +53,16 @@
5153
text-decoration: none;
5254
}
5355
#linkToBin:hover{
54-
background:#eee;
56+
background:#fff;
57+
}
58+
#cuteman01{
59+
display:block;
60+
position:absolute;
61+
bottom:-15px;
62+
right:-5px;
63+
width:160px;
64+
height:103px;
65+
background:url(media/cuteman01.png);
66+
background-size:cover;
67+
cursor:pointer;
5568
}

0 commit comments

Comments
 (0)