scratch-blocks/tests/multi_playground.html

263 lines
7.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Multi-toolbox Playground</title>
<script src="../blockly_uncompressed_horizontal.js"></script>
<script src="../msg/messages.js"></script>
<script src="../blocks/math.js"></script>
<script src="../blocks/text.js"></script>
<script src="../blocks_horizontal/control.js"></script>
<script src="../blocks_horizontal/event.js"></script>
<script src="../blocks_horizontal/wedo.js"></script>
<script>
'use strict';
function start() {
startBlocklyInstance('VertStartLTR', false, false, 'start');
startBlocklyInstance('VertStartRTL', true, false, 'start');
startBlocklyInstance('VertEndLTR', false, false, 'end');
startBlocklyInstance('VertEndRTL', true, false, 'end');
startBlocklyInstance('HorizontalStartLTR', false, true, 'start');
startBlocklyInstance('HorizontalStartRTL', true, true, 'start');
startBlocklyInstance('HorizontalEndLTR', false, true, 'end');
startBlocklyInstance('HorizontalEndRTL', true, true, 'end');
}
function startBlocklyInstance(suffix, rtl, horizontalLayout, position) {
var toolbox = document.getElementById('toolbox_categories');
var options = {
comments: false,
disable: false,
collapse: false,
maxBlocks: Infinity,
media: '../media/',
readOnly: false,
rtl: rtl,
scrollbars: true,
toolbox: toolbox,
trashcan: true,
horizontalLayout: horizontalLayout,
toolboxPosition: position,
zoom: {
controls: true,
wheel: true,
startScale: 1.0,
maxScale: 4,
minScale: 0.25,
scaleSpeed: 1.1
}
};
Blockly.inject('blocklyDiv' + suffix, options);
}
</script>
<style>
html, body {
height: 100%;
}
body {
background-color: #fff;
font-family: sans-serif;
}
h1 {
font-weight: normal;
font-size: 140%;
}
#blocklyDiv {
float: right;
height: 95%;
width: 70%;
}
#collaborators {
float: right;
width: 30px;
margin-left: 10px;
}
#collaborators > img {
margin-right: 5px;
height: 30px;
padding-bottom: 5px;
width: 30px;
border-radius: 3px;
}
#importExport {
font-family: monospace;
}
</style>
</head>
<body onload="start()">
<div id="collaborators"></div>
<table>
<tr>
<td/>
<td>LTR</td>
<td>RTL</td>
</tr>
<tr>
<td>Vertical layout; toolbox at start</td>
<td>
<div id="blocklyDivVertStartLTR" style="height: 480px; width: 600px;"></div>
</td>
<td>
<div id="blocklyDivVertStartRTL" style="height: 480px; width: 600px;"></div>
</td>
</tr>
<tr>
<td>Vertical layout; toolbox at end</td>
<td>
<div id="blocklyDivVertEndLTR" style="height: 480px; width: 600px;"></div>
</td>
<td>
<div id="blocklyDivVertEndRTL" style="height: 480px; width: 600px;"></div>
</td>
</tr>
<tr>
<td>Horizontal layout; toolbox at start</td>
<td>
<div id="blocklyDivHorizontalStartLTR" style="height: 480px; width: 600px;"></div>
</td>
<td>
<div id="blocklyDivHorizontalStartRTL" style="height: 480px; width: 600px;"></div>
</td>
</tr>
<tr>
<td>Horizontal layout; toolbox at end</td>
<td>
<div id="blocklyDivHorizontalEndLTR" style="height: 480px; width: 600px;"></div>
</td>
<td>
<div id="blocklyDivHorizontalEndRTL" style="height: 480px; width: 600px;"></div>
</td>
</tr>
</table>
<xml id="toolbox_alwaysOpen" style="display: none">
<block type="event_whenflagclicked"></block>
<block type="motion_moveright"></block>
<!-- <block type="control_repeat"></block> -->
<block type="control_forever"></block>
<block type="control_repeat">
<value name="TIMES">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
</block>
</xml>
<xml id="toolbox_categoriesScroll" style="display: none">
<category name="Events">
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
<block type="event_whenflagclicked"></block>
</category>
<sep></sep>
<!-- <block type="control_repeat"></block> -->
<category name="Pants">
<block type="control_forever"></block>
<block type="control_repeat">
<value name="TIMES">
<shadow type="math_number">
<field name="NUM">10</field>
</shadow>
</value>
</block>
</category>
</xml>
<xml id="toolbox_categories" style="display: none">
<category name="Events">
<block type="event_whenflagclicked"></block>
<block type="event_whenbroadcastreceived">
<value name="CHOICE">
<shadow type="dropdown_whenbroadcast">
<field name="CHOICE">blue</field>
</shadow>
</value>
</block>
<block type="event_broadcast">
<value name="CHOICE">
<shadow type="dropdown_broadcast">
<field name="CHOICE">blue</field>
</shadow>
</value>
</block>
</category>
<category name="Control">
<block type="control_forever"></block>
<block type="control_repeat">
<value name="TIMES">
<shadow type="math_number">
<field name="NUM">4</field>
</shadow>
</value>
</block>
<block type="control_stop"></block>
<block type="control_wait">
<value name="DURATION">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block>
</category>
<category name="Wedo">
<block type="wedo_setcolor">
<value name="CHOICE">
<shadow type="dropdown_wedo_setcolor">
<field name="CHOICE">mystery</field>
</shadow>
</value>
</block>
<block type="wedo_motorclockwise">
<value name="DURATION">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block>
<block type="wedo_motorcounterclockwise">
<value name="DURATION">
<shadow type="math_number">
<field name="NUM">1</field>
</shadow>
</value>
</block>
<block type="wedo_motorspeed">
<value name="CHOICE">
<shadow type="dropdown_wedo_motorspeed">
<field name="CHOICE">fast</field>
</shadow>
</value>
</block>
<block type="wedo_whentilt">
<value name="CHOICE">
<shadow type="dropdown_wedo_whentilt">
<field name="CHOICE">forward</field>
</shadow>
</value>
</block>
<block type="wedo_whendistanceclose"></block>
</category>
</xml>
</body>
</html>