Skip to content

Commit

Permalink
restore to origin
Browse files Browse the repository at this point in the history
  • Loading branch information
SeonMyungLim committed Aug 19, 2016
1 parent a47f619 commit cef6996
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 50 deletions.
28 changes: 5 additions & 23 deletions dist/entry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:2, TEXT_ALIGNS:["center", "left", "right"], clipboard:null, loadProject:function(b) {
b || (b = Entry.getStartProject(Entry.mediaFilePath));
this.setFuncRefs(b.functions);
"workspace" == this.type && Entry.stateManager.startIgnore();
Entry.projectId = b._id;
Entry.variableContainer.setVariables(b.variables);
Expand All @@ -17,7 +16,6 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:
Entry.engine.projectTimer || Entry.variableContainer.generateTimer();
0 === Object.keys(Entry.container.inputValue).length && Entry.variableContainer.generateAnswer();
Entry.start();
this.removeFuncRefs();
return b;
}, exportProject:function(b) {
b || (b = {});
Expand Down Expand Up @@ -125,12 +123,6 @@ var Entry = {block:{}, TEXT_ALIGN_CENTER:0, TEXT_ALIGN_LEFT:1, TEXT_ALIGN_RIGHT:
a.template = Lang.template.function_general;
Entry.block[b] = a;
}
}, setFuncRefs:function(b) {
this.functions = b ? b.map(function(a) {
return a.id;
}) : [];
}, removeFuncRefs:function() {
delete this.functions;
}};
window.Entry = Entry;
Entry.Albert = {PORT_MAP:{leftWheel:0, rightWheel:0, buzzer:0, leftEye:0, rightEye:0, note:0, bodyLed:0, frontLed:0, padWidth:0, padHeight:0}, setZero:function() {
Expand Down Expand Up @@ -13928,15 +13920,10 @@ Entry.VariableContainer.prototype.createFunction = function() {
Entry.VariableContainer.prototype.addFunction = function(b) {
};
Entry.VariableContainer.prototype.removeFunction = function(b) {
var a = b.id;
b = this.functions_;
b[a].destroy();
delete b[a];
a = "func_" + a;
Entry.container.removeFuncBlocks(a);
for (var c in b) {
b[c].content.removeBlocksByType(a);
}
b = b.id;
var a = this.functions_;
a[b].destroy();
delete a[b];
this.updateList();
};
Entry.VariableContainer.prototype.checkListPosition = function(b, a) {
Expand Down Expand Up @@ -18886,12 +18873,7 @@ Entry.Thread = function(b, a, c) {
}
for (var d = 0;d < a.length;d++) {
var e = a[d];
if (e instanceof Entry.Block || e.isDummy) {
e.setThread(this), this._data.push(e);
} else {
var f = Entry.functions, g = e.type;
(Entry.block[g] || f && -1 < f.indexOf(g.split("_")[1])) && this._data.push(new Entry.Block(e, this));
}
e instanceof Entry.Block || e.isDummy ? (e.setThread(this), this._data.push(e)) : this._data.push(new Entry.Block(e, this));
}
(d = this._code.view) && this.createView(d.board, b);
};
Expand Down
17 changes: 0 additions & 17 deletions src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Entry.loadProject = function(project) {
project = Entry.getStartProject(Entry.mediaFilePath);
}

this.setFuncRefs(project.functions);

if (this.type == 'workspace')
Entry.stateManager.startIgnore();
Entry.projectId = project._id;
Expand All @@ -52,8 +50,6 @@ Entry.loadProject = function(project) {
Entry.variableContainer.generateAnswer();
Entry.start();

this.removeFuncRefs();

return project;
};

Expand Down Expand Up @@ -358,17 +354,4 @@ Entry.generateFunctionSchema = function(functionId) {
Entry.block[functionId] = blockSchema;
};

Entry.setFuncRefs = function(functions) {
if (!functions) this.functions = [];
else {
this.functions = functions.map(function(f) {
return f.id;
});
}
};

Entry.removeFuncRefs = function() {
delete this.functions;
};

window.Entry = Entry;
6 changes: 3 additions & 3 deletions src/variable_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ Entry.VariableContainer.prototype.removeFunction = function(func) {
delete functions[functionId];
var functionType = 'func_' + functionId;

Entry.container.removeFuncBlocks(functionType);
for (var id in functions)
functions[id].content.removeBlocksByType(functionType);
//Entry.container.removeFuncBlocks(functionType);
//for (var id in functions)
//functions[id].content.removeBlocksByType(functionType);
this.updateList();
};

Expand Down
9 changes: 2 additions & 7 deletions src/workspace/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,8 @@ Entry.Thread = function(thread, code, parent) {
if (block instanceof Entry.Block || block.isDummy) {
block.setThread(this);
this._data.push(block);
} else {
var functions = Entry.functions;
var blockType = block.type;
if (Entry.block[blockType] || (
functions && functions.indexOf(blockType.split('_')[1]) > -1))
this._data.push(new Entry.Block(block, this));
}
} else
this._data.push(new Entry.Block(block, this));
}

var codeView = this._code.view;
Expand Down

0 comments on commit cef6996

Please sign in to comment.