Fix persistence of logging in playground.

This commit is contained in:
Neil Fraser 2016-02-29 15:02:05 -08:00
parent 4c542240e2
commit 6eb652cf70
3 changed files with 11 additions and 15 deletions

View file

@ -56,14 +56,12 @@ Blockly.Variables.allVariables = function(root) {
var variableHash = Object.create(null);
// Iterate through every block and add each variable to the hash.
for (var x = 0; x < blocks.length; x++) {
if (blocks[x].getVars) {
var blockVariables = blocks[x].getVars();
for (var y = 0; y < blockVariables.length; y++) {
var varName = blockVariables[y];
// Variable name may be null if the block is only half-built.
if (varName) {
variableHash[varName.toLowerCase()] = varName;
}
var blockVariables = blocks[x].getVars();
for (var y = 0; y < blockVariables.length; y++) {
var varName = blockVariables[y];
// Variable name may be null if the block is only half-built.
if (varName) {
variableHash[varName.toLowerCase()] = varName;
}
}
}
@ -85,9 +83,7 @@ Blockly.Variables.renameVariable = function(oldName, newName, workspace) {
var blocks = workspace.getAllBlocks();
// Iterate through every block.
for (var i = 0; i < blocks.length; i++) {
if (blocks[i].renameVar) {
blocks[i].renameVar(oldName, newName);
}
blocks[i].renameVar(oldName, newName);
}
};

View file

@ -43,9 +43,9 @@ goog.require('Blockly.Msg');
*/
/**
* Tip: Generate URLs for read-only blocks by creating the blocks in the Code app,
* then evaluating this in the console:
* 'http://blockly-demo.appspot.com/static/apps/code/readonly.html?lang=en&xml=' + encodeURIComponent(Blockly.Xml.domToText(Blockly.Xml.workspaceToDom(Blockly.mainWorkspace)).slice(5, -6))
* Each message is preceded with a tripple-slash comment that becomes the
* message descriptor. The build process extracts these descriptors, adds
* them to msg/json/qqq.json, and they show up in the translation console.
*/
/// default name - A simple, general default name for a variable, preferably short.

View file

@ -89,7 +89,7 @@ function start() {
taChange();
// Restore event logging state.
var state = sessionStorage.getItem('logEvents');
logEvents(Boolean(state));
logEvents(Boolean(Number(state)));
}
function toXml() {