Skip to content

Commit

Permalink
Upgrade Blockly version, which should now work better on Android tabl…
Browse files Browse the repository at this point in the history
…ets. Also change meta viewport to 0.8 which gives much more sensible scaling (1 is a bit too big)
  • Loading branch information
gfwilliams committed Nov 15, 2023
1 parent 25d616c commit 25fa6a7
Show file tree
Hide file tree
Showing 11 changed files with 2,639 additions and 2,598 deletions.
2 changes: 1 addition & 1 deletion blockly/blockly.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<script type="text/javascript" src="blockly_compressed.js"></script>
<script type="text/javascript" src="blocks_compressed.js"></script>
<script type="text/javascript" src="en.js"></script>
<script type="text/javascript" src="en_espruino.js"></script>
<script type="text/javascript" src="ru.js"></script>
<script type="text/javascript" src="de.js"></script>
<script type="text/javascript" src="javascript_compressed.js"></script>
Expand All @@ -15,7 +16,6 @@
<script type="text/javascript" src="blockly_nordic_thingy.js"></script>
<script type="text/javascript" src="blockly_smartibot.js"></script>
<script type="text/javascript" src="blockly_bangle.js"></script>
<script type="text/javascript" src="field_textarea.js"></script>
<script type="text/javascript" src="../js/libs/imageconverter.js"></script>
<style>
html, body {
Expand Down
3,330 changes: 1,658 additions & 1,672 deletions blockly/blockly_compressed.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions blockly/blockly_espruino.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ window.onload = function() {
}
}
// Set up blockly from toolbox
Blockly.inject(document.body,{
Blockly.mainWorkspace = Blockly.inject(document.body,{
toolbox: toolbox,
media: 'media/',
});
Expand All @@ -87,7 +87,7 @@ window.onload = function() {
// Patch up scrub_ to allow nested callbacks for stuff like 'wait'
Blockly.JavaScript.scrub__ = Blockly.JavaScript.scrub_;
Blockly.JavaScript.scrub_ = function(block, code) {
var callbackIdx = goog.isString(code) ? code.indexOf(MAGIC_CALLBACK_CODE) : -1;
var callbackIdx = ("string" == typeof code) ? code.indexOf(MAGIC_CALLBACK_CODE) : -1;
if (callbackIdx>=0) {
var nextBlock = block.nextConnection && block.nextConnection.targetBlock();
var nextCode = Blockly.JavaScript.blockToCode(nextBlock);
Expand Down Expand Up @@ -382,7 +382,7 @@ Blockly.Blocks.espruino_pinMode = {
Blockly.Blocks.espruino_code = {
category: 'Espruino',
init: function() {
this.appendDummyInput().appendField(new Blockly.FieldTextArea("// Enter JavaScript Statements Here"),"CODE");
this.appendDummyInput().appendField(new Blockly.FieldMultilineInput("// Enter JavaScript Statements Here"),"CODE");

this.setPreviousStatement(true);
this.setNextStatement(true);
Expand Down
356 changes: 194 additions & 162 deletions blockly/blocks_compressed.js

Large diffs are not rendered by default.

910 changes: 435 additions & 475 deletions blockly/en.js

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions blockly/en_espruino.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
if (window.location.href.indexOf("lang=en")>=0 ||
window.location.href.indexOf("lang=")==-1) {

Blockly.Msg.ESPRUINO_WAIT = 'wait';
Blockly.Msg.ESPRUINO_SECONDS = 'seconds';
Blockly.Msg.ESPRUINO_WAIT_TOOLTIP = 'Delay for a certain amount of time';
Blockly.Msg.ESPRUINO_AFTER = 'after';
Blockly.Msg.ESPRUINO_AFTER_TOOLTIP = 'Waits for a certain period before running code';

Blockly.Msg.ESPRUINO_EVERY_TOOLTIP = 'Runs code repeatedly, every so many seconds';
Blockly.Msg.ESPRUINO_EVERY = 'every';

Blockly.Msg.ESPRUINO_MORE = 'More';
Blockly.Msg.ESPRUINO_BACK = 'Back';
Blockly.Msg.ESPRUINO_PIN_NAME = 'The Name of a Pin';

Blockly.Msg.ESPRUINO_WATCH = 'watch';
Blockly.Msg.ESPRUINO_WATCH_TOOLTIP = 'Runs code when an input changes';
Blockly.Msg.ESPRUINO_TIME = 'Time';
Blockly.Msg.ESPRUINO_TIME_TOOLTIP = 'Read the current time in seconds';
Blockly.Msg.ESPRUINO_DIGITALWRITE = 'digitalWrite Pin';
Blockly.Msg.ESPRUINO_VALUE = 'Value';
Blockly.Msg.ESPRUINO_DIGITALWRITE_TOOLTIP = 'Writes a Digital Value to a Pin';
Blockly.Msg.ESPRUINO_DIGITALPULSE = 'digitalPulse Pin';
Blockly.Msg.ESPRUINO_MILLISECONDS = 'Milliseconds';
Blockly.Msg.ESPRUINO_DIGITALPULSE_TOOLTIP = 'Pulses a pin for the given number of milliseconds';
Blockly.Msg.ESPRUINO_DIGITALREAD = 'digitalRead Pin';
Blockly.Msg.ESPRUINO_DIGITALREAD_TOOLTIP = 'Read a Digital Value from a Pin';
Blockly.Msg.ESPRUINO_ANALOGWRITE = 'analogWrite Pin';
Blockly.Msg.ESPRUINO_ANALOGWRITE_TOOLTIP = 'Writes an Analog Value to a Pin';
Blockly.Msg.ESPRUINO_ANALOGREAD = 'analogRead Pin';
Blockly.Msg.ESPRUINO_ANALOGREAD_TOOLTIP = 'Read an Analog Value from a Pin';
Blockly.Msg.ESPRUINO_PINMODE = 'pinMode Pin';
Blockly.Msg.ESPRUINO_PINMODE_TOOLTIP = 'Sets the mode of the pin (if not used, pin mode is set automatically)';
Blockly.Msg.ESPRUINO_JS_TOOLTIP = 'Executes the given JavaScript code';
Blockly.Msg.ESPRUINO_JSEXPR_TOOLTIP = 'Executes the given JavaScript code as an expression';
Blockly.Msg.ESPRUINO_MOVE_SERVO = 'Move Servo on Pin';
Blockly.Msg.ESPRUINO_TO = 'to';
Blockly.Msg.ESPRUINO_MOVE_SERVO_TOOLTIP = 'Start moving the servo motor - position between -1 and 1';
Blockly.Msg.ESPRUINO_STOP_SERVO = 'Stop Servo on Pin';
Blockly.Msg.ESPRUINO_STOP_SERVO_TOOLTIP = 'Stop moving the servo motor';
Blockly.Msg.ESPRUINO_ULTRASONIC_GET_TRIG = 'Get distance, trigger';
Blockly.Msg.ESPRUINO_ULTRASONIC_ECHO = ', echo';
Blockly.Msg.ESPRUINO_ULTRASONIC_TOOLTIP = 'Return distance in centimetres from the ultrasonic sensor';

}
185 changes: 0 additions & 185 deletions blockly/field_textarea.js

This file was deleted.

Loading

0 comments on commit 25fa6a7

Please sign in to comment.