@@ -300,10 +300,13 @@ Blockly.Blocks['demo_youtube'] = {
300
300
this . appendValueInput ( "name_" )
301
301
. appendField ( Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE ) ;
302
302
this . appendDummyInput ( )
303
- . appendField ( Blockly . Msg . DEMO_YOUTUBE_DEFAULT )
304
- . appendField ( new Blockly . FieldDropdown ( [ [ Blockly . Msg . DEMO_YOUTUBE_DEFAULT_1 , "1" ] , [ Blockly . Msg . DEMO_YOUTUBE_DEFAULT_2 , "2" ] ] ) , "type_" )
305
- . appendField ( Blockly . Msg . DEMO_YOUTUBE_DEFAULT_ID )
306
- . appendField ( new Blockly . FieldTextInput ( "..." ) , "id_" ) ;
303
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_DEFAULT )
304
+ . appendField ( new Blockly . FieldDropdown ( [
305
+ [ Blockly . Msg . DEMO_YOUTUBE_DEFAULT_1 , "1" ] ,
306
+ [ Blockly . Msg . DEMO_YOUTUBE_DEFAULT_2 , "2" ]
307
+ ] ) , "type_" )
308
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_DEFAULT_ID )
309
+ . appendField ( new Blockly . FieldTextInput ( "..." ) , "id_" ) ;
307
310
this . setPreviousStatement ( true ) ;
308
311
this . setNextStatement ( true ) ;
309
312
this . setTooltip ( '' ) ;
@@ -335,10 +338,10 @@ Blockly.Blocks['demo_youtube_speed'] = {
335
338
. appendField ( new Blockly . FieldVariable ( "youtube" ) , "name_" )
336
339
. appendField ( Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE_SPEED )
337
340
. appendField ( new Blockly . FieldDropdown ( [
341
+ [ Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE_VERYSLOW , "0.25" ] ,
338
342
[ Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE_SLOW , "0.5" ] ,
339
343
[ Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE_NORMAL , "1" ] ,
340
- [ Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE_FAST , "1.25" ] ,
341
- [ Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE_VERYFAST , "1.5" ] ,
344
+ [ Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE_FAST , "1.5" ] ,
342
345
[ Blockly . Msg . WEBDUINO_ULTRASONIC_YOUTUBE_SUPERFAST , "2" ]
343
346
] ) , "speed_" ) ;
344
347
this . setPreviousStatement ( true ) ;
@@ -384,7 +387,7 @@ Blockly.Blocks['demo_youtube_status'] = {
384
387
] ) , "status_" ) ;
385
388
this . setOutput ( true ) ;
386
389
this . setTooltip ( '' ) ;
387
- this . setColour ( Blockly . Blocks . colour . HUE ) ;
390
+ this . setColour ( 80 ) ;
388
391
this . setHelpUrl ( 'https://webduino.io' ) ;
389
392
}
390
393
} ;
@@ -411,7 +414,10 @@ Blockly.Blocks['demo_youtube_listcontrol'] = {
411
414
. appendField ( Blockly . Msg . DEMO_YOUTUBE_PLAY )
412
415
. appendField ( new Blockly . FieldVariable ( "youtube" ) , "name_" )
413
416
. appendField ( Blockly . Msg . DEMO_YOUTUBE_LIST )
414
- . appendField ( new Blockly . FieldDropdown ( [ [ Blockly . Msg . DEMO_YOUTUBE_LIST_PRE , ".previousVideo()" ] , [ Blockly . Msg . DEMO_YOUTUBE_LIST_NEXT , ".nextVideo()" ] ] ) , "preOrNext_" ) ;
417
+ . appendField ( new Blockly . FieldDropdown ( [
418
+ [ Blockly . Msg . DEMO_YOUTUBE_LIST_PRE , ".previousVideo()" ] ,
419
+ [ Blockly . Msg . DEMO_YOUTUBE_LIST_NEXT , ".nextVideo()" ]
420
+ ] ) , "preOrNext_" ) ;
415
421
this . setPreviousStatement ( true ) ;
416
422
this . setNextStatement ( true ) ;
417
423
this . setTooltip ( '' ) ;
@@ -422,14 +428,45 @@ Blockly.Blocks['demo_youtube_listcontrol'] = {
422
428
423
429
// https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#wnw8t9
424
430
Blockly . Blocks [ 'demo_youtube_listnum' ] = {
425
- init : function ( ) {
431
+ init : function ( ) {
426
432
this . appendValueInput ( "num_" )
427
- . setCheck ( "Number" )
428
- . appendField ( Blockly . Msg . DEMO_YOUTUBE_PLAY )
433
+ . setCheck ( "Number" )
434
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_PLAY )
435
+ . appendField ( new Blockly . FieldVariable ( "youtube" ) , "name_" )
436
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_LIST_LISTNUM ) ;
437
+ this . appendDummyInput ( )
438
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_LIST_NUM ) ;
439
+ this . setPreviousStatement ( true , null ) ;
440
+ this . setNextStatement ( true , null ) ;
441
+ this . setTooltip ( '' ) ;
442
+ this . setColour ( Blockly . Blocks . colour . HUE ) ;
443
+ this . setHelpUrl ( 'http://www.example.com/' ) ;
444
+ }
445
+ } ;
446
+
447
+ // https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#who4oo
448
+ Blockly . Blocks [ 'demo_youtube_currenttime' ] = {
449
+ init : function ( ) {
450
+ this . appendDummyInput ( )
451
+ . appendField ( new Blockly . FieldVariable ( "youtube" ) , "name_" )
452
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_CURRENTTIME ) ;
453
+ this . setOutput ( true , null ) ;
454
+ this . setTooltip ( '' ) ;
455
+ this . setColour ( 80 ) ;
456
+ this . setHelpUrl ( 'http://www.example.com/' ) ;
457
+ }
458
+ } ;
459
+
460
+ // https://blockly-demo.appspot.com/static/demos/blockfactory/index.html#fg9c8k
461
+ Blockly . Blocks [ 'demo_youtube_seekto' ] = {
462
+ init : function ( ) {
463
+ this . appendValueInput ( "sec_" )
464
+ . setCheck ( "Number" )
465
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_SET )
429
466
. appendField ( new Blockly . FieldVariable ( "youtube" ) , "name_" )
430
- . appendField ( Blockly . Msg . DEMO_YOUTUBE_LIST_LISTNUM ) ;
467
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_SEEKTO ) ;
431
468
this . appendDummyInput ( )
432
- . appendField ( Blockly . Msg . DEMO_YOUTUBE_LIST_NUM ) ;
469
+ . appendField ( Blockly . Msg . DEMO_YOUTUBE_SEC ) ;
433
470
this . setPreviousStatement ( true , null ) ;
434
471
this . setNextStatement ( true , null ) ;
435
472
this . setTooltip ( '' ) ;
0 commit comments