mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
some command line support for things
This commit is contained in:
parent
67817f0cdb
commit
73cead0ae8
3 changed files with 93 additions and 51 deletions
|
@ -4516,6 +4516,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
this.options = options;
|
||||||
|
|
||||||
this.initVisualization(options);
|
this.initVisualization(options);
|
||||||
this.initCommandCollection(options);
|
this.initCommandCollection(options);
|
||||||
|
@ -4633,7 +4634,8 @@ var Sandbox = Backbone.View.extend({
|
||||||
|
|
||||||
var currentLevel = new Level({
|
var currentLevel = new Level({
|
||||||
level: levelJSON,
|
level: levelJSON,
|
||||||
deferred: whenLevelOpen
|
deferred: whenLevelOpen,
|
||||||
|
command: command
|
||||||
});
|
});
|
||||||
|
|
||||||
whenLevelOpen.promise.then(function() {
|
whenLevelOpen.promise.then(function() {
|
||||||
|
@ -6647,10 +6649,12 @@ var Level = Sandbox.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
startOffCommand: function() {
|
startOffCommand: function() {
|
||||||
Main.getEventBaton().trigger(
|
if (!this.testOption('noStartCommand')) {
|
||||||
'commandSubmitted',
|
Main.getEventBaton().trigger(
|
||||||
'hint; delay 3000; show goal'
|
'commandSubmitted',
|
||||||
);
|
'hint; delay 2000; show goal'
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initVisualization: function(options) {
|
initVisualization: function(options) {
|
||||||
|
@ -6823,6 +6827,10 @@ var Level = Sandbox.extend({
|
||||||
return toAnalyze.split(';').length;
|
return toAnalyze.split(';').length;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testOption: function(option) {
|
||||||
|
return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr'));
|
||||||
|
},
|
||||||
|
|
||||||
levelSolved: function(defer) {
|
levelSolved: function(defer) {
|
||||||
this.solved = true;
|
this.solved = true;
|
||||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||||
|
@ -6832,20 +6840,26 @@ var Level = Sandbox.extend({
|
||||||
var numCommands = this.gitCommandsIssued.length;
|
var numCommands = this.gitCommandsIssued.length;
|
||||||
var best = this.getNumSolutionCommands();
|
var best = this.getNumSolutionCommands();
|
||||||
|
|
||||||
this.mainVis.gitVisuals.finishAnimation()
|
var skipFinishDialog = this.testOption('noFinishDialog');
|
||||||
.then(function() {
|
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
||||||
// we want to ask if they will move onto the next level
|
if (!skipFinishDialog) {
|
||||||
// while giving them their results...
|
finishAnimationChain = finishAnimationChain
|
||||||
var nextDialog = new NextLevelConfirm({
|
.then(function() {
|
||||||
nextLevel: nextLevel,
|
// we want to ask if they will move onto the next level
|
||||||
numCommands: numCommands,
|
// while giving them their results...
|
||||||
best: best
|
var nextDialog = new NextLevelConfirm({
|
||||||
});
|
nextLevel: nextLevel,
|
||||||
|
numCommands: numCommands,
|
||||||
|
best: best
|
||||||
|
});
|
||||||
|
|
||||||
return nextDialog.getPromise();
|
return nextDialog.getPromise();
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
finishAnimationChain
|
||||||
.then(function() {
|
.then(function() {
|
||||||
if (nextLevel) {
|
if (!skipFinishDialog && nextLevel) {
|
||||||
Main.getEventBaton().trigger(
|
Main.getEventBaton().trigger(
|
||||||
'commandSubmitted',
|
'commandSubmitted',
|
||||||
'level ' + nextLevel.id
|
'level ' + nextLevel.id
|
||||||
|
@ -20657,10 +20671,12 @@ var Level = Sandbox.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
startOffCommand: function() {
|
startOffCommand: function() {
|
||||||
Main.getEventBaton().trigger(
|
if (!this.testOption('noStartCommand')) {
|
||||||
'commandSubmitted',
|
Main.getEventBaton().trigger(
|
||||||
'hint; delay 3000; show goal'
|
'commandSubmitted',
|
||||||
);
|
'hint; delay 2000; show goal'
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initVisualization: function(options) {
|
initVisualization: function(options) {
|
||||||
|
@ -20833,6 +20849,10 @@ var Level = Sandbox.extend({
|
||||||
return toAnalyze.split(';').length;
|
return toAnalyze.split(';').length;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testOption: function(option) {
|
||||||
|
return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr'));
|
||||||
|
},
|
||||||
|
|
||||||
levelSolved: function(defer) {
|
levelSolved: function(defer) {
|
||||||
this.solved = true;
|
this.solved = true;
|
||||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||||
|
@ -20842,20 +20862,26 @@ var Level = Sandbox.extend({
|
||||||
var numCommands = this.gitCommandsIssued.length;
|
var numCommands = this.gitCommandsIssued.length;
|
||||||
var best = this.getNumSolutionCommands();
|
var best = this.getNumSolutionCommands();
|
||||||
|
|
||||||
this.mainVis.gitVisuals.finishAnimation()
|
var skipFinishDialog = this.testOption('noFinishDialog');
|
||||||
.then(function() {
|
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
||||||
// we want to ask if they will move onto the next level
|
if (!skipFinishDialog) {
|
||||||
// while giving them their results...
|
finishAnimationChain = finishAnimationChain
|
||||||
var nextDialog = new NextLevelConfirm({
|
.then(function() {
|
||||||
nextLevel: nextLevel,
|
// we want to ask if they will move onto the next level
|
||||||
numCommands: numCommands,
|
// while giving them their results...
|
||||||
best: best
|
var nextDialog = new NextLevelConfirm({
|
||||||
});
|
nextLevel: nextLevel,
|
||||||
|
numCommands: numCommands,
|
||||||
|
best: best
|
||||||
|
});
|
||||||
|
|
||||||
return nextDialog.getPromise();
|
return nextDialog.getPromise();
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
finishAnimationChain
|
||||||
.then(function() {
|
.then(function() {
|
||||||
if (nextLevel) {
|
if (!skipFinishDialog && nextLevel) {
|
||||||
Main.getEventBaton().trigger(
|
Main.getEventBaton().trigger(
|
||||||
'commandSubmitted',
|
'commandSubmitted',
|
||||||
'level ' + nextLevel.id
|
'level ' + nextLevel.id
|
||||||
|
@ -21111,6 +21137,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
this.options = options;
|
||||||
|
|
||||||
this.initVisualization(options);
|
this.initVisualization(options);
|
||||||
this.initCommandCollection(options);
|
this.initCommandCollection(options);
|
||||||
|
@ -21228,7 +21255,8 @@ var Sandbox = Backbone.View.extend({
|
||||||
|
|
||||||
var currentLevel = new Level({
|
var currentLevel = new Level({
|
||||||
level: levelJSON,
|
level: levelJSON,
|
||||||
deferred: whenLevelOpen
|
deferred: whenLevelOpen,
|
||||||
|
command: command
|
||||||
});
|
});
|
||||||
|
|
||||||
whenLevelOpen.promise.then(function() {
|
whenLevelOpen.promise.then(function() {
|
||||||
|
|
|
@ -121,10 +121,12 @@ var Level = Sandbox.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
startOffCommand: function() {
|
startOffCommand: function() {
|
||||||
Main.getEventBaton().trigger(
|
if (!this.testOption('noStartCommand')) {
|
||||||
'commandSubmitted',
|
Main.getEventBaton().trigger(
|
||||||
'hint; delay 3000; show goal'
|
'commandSubmitted',
|
||||||
);
|
'hint; delay 2000; show goal'
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initVisualization: function(options) {
|
initVisualization: function(options) {
|
||||||
|
@ -297,6 +299,10 @@ var Level = Sandbox.extend({
|
||||||
return toAnalyze.split(';').length;
|
return toAnalyze.split(';').length;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testOption: function(option) {
|
||||||
|
return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr'));
|
||||||
|
},
|
||||||
|
|
||||||
levelSolved: function(defer) {
|
levelSolved: function(defer) {
|
||||||
this.solved = true;
|
this.solved = true;
|
||||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||||
|
@ -306,20 +312,26 @@ var Level = Sandbox.extend({
|
||||||
var numCommands = this.gitCommandsIssued.length;
|
var numCommands = this.gitCommandsIssued.length;
|
||||||
var best = this.getNumSolutionCommands();
|
var best = this.getNumSolutionCommands();
|
||||||
|
|
||||||
this.mainVis.gitVisuals.finishAnimation()
|
var skipFinishDialog = this.testOption('noFinishDialog');
|
||||||
.then(function() {
|
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
||||||
// we want to ask if they will move onto the next level
|
if (!skipFinishDialog) {
|
||||||
// while giving them their results...
|
finishAnimationChain = finishAnimationChain
|
||||||
var nextDialog = new NextLevelConfirm({
|
.then(function() {
|
||||||
nextLevel: nextLevel,
|
// we want to ask if they will move onto the next level
|
||||||
numCommands: numCommands,
|
// while giving them their results...
|
||||||
best: best
|
var nextDialog = new NextLevelConfirm({
|
||||||
});
|
nextLevel: nextLevel,
|
||||||
|
numCommands: numCommands,
|
||||||
|
best: best
|
||||||
|
});
|
||||||
|
|
||||||
return nextDialog.getPromise();
|
return nextDialog.getPromise();
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
finishAnimationChain
|
||||||
.then(function() {
|
.then(function() {
|
||||||
if (nextLevel) {
|
if (!skipFinishDialog && nextLevel) {
|
||||||
Main.getEventBaton().trigger(
|
Main.getEventBaton().trigger(
|
||||||
'commandSubmitted',
|
'commandSubmitted',
|
||||||
'level ' + nextLevel.id
|
'level ' + nextLevel.id
|
||||||
|
|
|
@ -23,6 +23,7 @@ var Sandbox = Backbone.View.extend({
|
||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
initialize: function(options) {
|
initialize: function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
this.options = options;
|
||||||
|
|
||||||
this.initVisualization(options);
|
this.initVisualization(options);
|
||||||
this.initCommandCollection(options);
|
this.initCommandCollection(options);
|
||||||
|
@ -140,7 +141,8 @@ var Sandbox = Backbone.View.extend({
|
||||||
|
|
||||||
var currentLevel = new Level({
|
var currentLevel = new Level({
|
||||||
level: levelJSON,
|
level: levelJSON,
|
||||||
deferred: whenLevelOpen
|
deferred: whenLevelOpen,
|
||||||
|
command: command
|
||||||
});
|
});
|
||||||
|
|
||||||
whenLevelOpen.promise.then(function() {
|
whenLevelOpen.promise.then(function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue