From 744e70e4d243c09d9d969ec3f915a278abe9457d Mon Sep 17 00:00:00 2001
From: Rachel Fenichel
Date: Mon, 12 Feb 2018 17:12:52 -0800
Subject: [PATCH 1/3] Split playground toolbox XML into typed and untyped
examples.
---
tests/playground.html | 358 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 355 insertions(+), 3 deletions(-)
diff --git a/tests/playground.html b/tests/playground.html
index 8e63815ea..fb7859587 100644
--- a/tests/playground.html
+++ b/tests/playground.html
@@ -77,7 +77,7 @@ function start() {
document.forms.options.elements.dir.selectedIndex = Number(rtl);
var toolbox = getToolboxElement();
document.forms.options.elements.toolbox.selectedIndex =
- Number(toolbox.getElementsByTagName('category').length == 0);
+ getToolboxFormIndex(toolbox.id);
match = location.search.match(/side=([^&]+)/);
var side = match ? match[1] : 'start';
document.forms.options.elements.side.value = side;
@@ -137,7 +137,24 @@ function setBackgroundColor() {
function getToolboxElement() {
var match = location.search.match(/toolbox=([^&]+)/);
- return document.getElementById('toolbox-' + (match ? match[1] : 'categories'));
+ // Default to the basic toolbox with categories and untyped variables,
+ // but override that if the toolbox type is set in the URL.
+ var toolboxSuffix = (match ? match[1] : 'categories');
+ // The three possible values are: "simple", "categories",
+ // "categories-typed-variables".
+ return document.getElementById('toolbox-' + toolboxSuffix);
+}
+
+function getToolboxFormIndex(id) {
+ if (id == 'toolbox-categories') {
+ return 0;
+ } else if (id == 'toolbox-categories-typed-variables') {
+ return 1;
+ } else if (id == 'toolbox-simple') {
+ return 2;
+ }
+ // Didn't recognize it.
+ return 0;
}
function toXml() {
@@ -301,7 +318,8 @@ h1 {
+
+
+
@@ -367,6 +390,9 @@ h1 {
+
@@ -688,6 +714,332 @@ h1 {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+ 10
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+
+
+ 9
+
+
+
+
+
+
+ 45
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+ 3.1
+
+
+
+
+
+
+
+ 64
+
+
+
+
+ 10
+
+
+
+
+
+
+ 50
+
+
+
+
+ 1
+
+
+
+
+ 100
+
+
+
+
+
+
+ 1
+
+
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text
+
+
+
+
+ abc
+
+
+
+
+
+
+ text
+
+
+
+
+
+
+ text
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+ abc
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+
+
+
+
+
+ list
+
+
+
+
+
+
+ list
+
+
+
+
+
+
+ list
+
+
+
+
+
+
+ list
+
+
+
+
+
+
+ ,
+
+
+
+
+
+
+
+
+
+
+
+
+ 100
+
+
+
+
+ 50
+
+
+
+
+ 0
+
+
+
+
+
+
+ #ff0000
+
+
+
+
+ #3333ff
+
+
+
+
+ 0.5
+
+
+
+
+
From 3a8fc92143ee7a0d46677c8626c4461c740b3aaf Mon Sep 17 00:00:00 2001
From: Rachel Fenichel
Date: Mon, 12 Feb 2018 17:14:26 -0800
Subject: [PATCH 2/3] Indentation
---
tests/playground.html | 55 +++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 25 deletions(-)
diff --git a/tests/playground.html b/tests/playground.html
index fb7859587..4bf0b31fb 100644
--- a/tests/playground.html
+++ b/tests/playground.html
@@ -83,31 +83,36 @@ function start() {
document.forms.options.elements.side.value = side;
// Create main workspace.
workspace = Blockly.inject('blocklyDiv',
- {comments: true,
- collapse: true,
- disable: true,
- grid:
- {spacing: 25,
- length: 3,
- colour: '#ccc',
- snap: true},
- horizontalLayout: side == 'top' || side == 'bottom',
- maxBlocks: Infinity,
- media: '../media/',
- oneBasedIndex: true,
- readOnly: false,
- rtl: rtl,
- scrollbars: true,
- toolbox: toolbox,
- toolboxPosition: side == 'top' || side == 'start' ? 'start' : 'end',
- zoom:
- {controls: true,
- wheel: true,
- startScale: 1.0,
- maxScale: 4,
- minScale: .25,
- scaleSpeed: 1.1}
- });
+ {
+ comments: true,
+ collapse: true,
+ disable: true,
+ grid:
+ {
+ spacing: 25,
+ length: 3,
+ colour: '#ccc',
+ snap: true
+ },
+ horizontalLayout: side == 'top' || side == 'bottom',
+ maxBlocks: Infinity,
+ media: '../media/',
+ oneBasedIndex: true,
+ readOnly: false,
+ rtl: rtl,
+ scrollbars: true,
+ toolbox: toolbox,
+ toolboxPosition: side == 'top' || side == 'start' ? 'start' : 'end',
+ zoom:
+ {
+ controls: true,
+ wheel: true,
+ startScale: 1.0,
+ maxScale: 4,
+ minScale: .25,
+ scaleSpeed: 1.1
+ }
+ });
// Restore previously displayed text.
if (sessionStorage) {
var text = sessionStorage.getItem('textarea');
From 2bd606c5e7c2d55d90cf5634c4698030816d0391 Mon Sep 17 00:00:00 2001
From: Rachel Fenichel
Date: Tue, 13 Feb 2018 10:41:57 -0800
Subject: [PATCH 3/3] Fix comments
---
tests/playground.html | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/playground.html b/tests/playground.html
index 4bf0b31fb..596e8f373 100644
--- a/tests/playground.html
+++ b/tests/playground.html
@@ -395,8 +395,8 @@ h1 {
-
@@ -722,7 +722,7 @@ h1 {
-