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',
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.options = options;
|
||||
|
||||
this.initVisualization(options);
|
||||
this.initCommandCollection(options);
|
||||
|
@ -4633,7 +4634,8 @@ var Sandbox = Backbone.View.extend({
|
|||
|
||||
var currentLevel = new Level({
|
||||
level: levelJSON,
|
||||
deferred: whenLevelOpen
|
||||
deferred: whenLevelOpen,
|
||||
command: command
|
||||
});
|
||||
|
||||
whenLevelOpen.promise.then(function() {
|
||||
|
@ -6647,10 +6649,12 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
startOffCommand: function() {
|
||||
if (!this.testOption('noStartCommand')) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'hint; delay 3000; show goal'
|
||||
'hint; delay 2000; show goal'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
initVisualization: function(options) {
|
||||
|
@ -6823,6 +6827,10 @@ var Level = Sandbox.extend({
|
|||
return toAnalyze.split(';').length;
|
||||
},
|
||||
|
||||
testOption: function(option) {
|
||||
return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr'));
|
||||
},
|
||||
|
||||
levelSolved: function(defer) {
|
||||
this.solved = true;
|
||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||
|
@ -6832,7 +6840,10 @@ var Level = Sandbox.extend({
|
|||
var numCommands = this.gitCommandsIssued.length;
|
||||
var best = this.getNumSolutionCommands();
|
||||
|
||||
this.mainVis.gitVisuals.finishAnimation()
|
||||
var skipFinishDialog = this.testOption('noFinishDialog');
|
||||
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
||||
if (!skipFinishDialog) {
|
||||
finishAnimationChain = finishAnimationChain
|
||||
.then(function() {
|
||||
// we want to ask if they will move onto the next level
|
||||
// while giving them their results...
|
||||
|
@ -6843,9 +6854,12 @@ var Level = Sandbox.extend({
|
|||
});
|
||||
|
||||
return nextDialog.getPromise();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
finishAnimationChain
|
||||
.then(function() {
|
||||
if (nextLevel) {
|
||||
if (!skipFinishDialog && nextLevel) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'level ' + nextLevel.id
|
||||
|
@ -20657,10 +20671,12 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
startOffCommand: function() {
|
||||
if (!this.testOption('noStartCommand')) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'hint; delay 3000; show goal'
|
||||
'hint; delay 2000; show goal'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
initVisualization: function(options) {
|
||||
|
@ -20833,6 +20849,10 @@ var Level = Sandbox.extend({
|
|||
return toAnalyze.split(';').length;
|
||||
},
|
||||
|
||||
testOption: function(option) {
|
||||
return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr'));
|
||||
},
|
||||
|
||||
levelSolved: function(defer) {
|
||||
this.solved = true;
|
||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||
|
@ -20842,7 +20862,10 @@ var Level = Sandbox.extend({
|
|||
var numCommands = this.gitCommandsIssued.length;
|
||||
var best = this.getNumSolutionCommands();
|
||||
|
||||
this.mainVis.gitVisuals.finishAnimation()
|
||||
var skipFinishDialog = this.testOption('noFinishDialog');
|
||||
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
||||
if (!skipFinishDialog) {
|
||||
finishAnimationChain = finishAnimationChain
|
||||
.then(function() {
|
||||
// we want to ask if they will move onto the next level
|
||||
// while giving them their results...
|
||||
|
@ -20853,9 +20876,12 @@ var Level = Sandbox.extend({
|
|||
});
|
||||
|
||||
return nextDialog.getPromise();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
finishAnimationChain
|
||||
.then(function() {
|
||||
if (nextLevel) {
|
||||
if (!skipFinishDialog && nextLevel) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'level ' + nextLevel.id
|
||||
|
@ -21111,6 +21137,7 @@ var Sandbox = Backbone.View.extend({
|
|||
tagName: 'div',
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.options = options;
|
||||
|
||||
this.initVisualization(options);
|
||||
this.initCommandCollection(options);
|
||||
|
@ -21228,7 +21255,8 @@ var Sandbox = Backbone.View.extend({
|
|||
|
||||
var currentLevel = new Level({
|
||||
level: levelJSON,
|
||||
deferred: whenLevelOpen
|
||||
deferred: whenLevelOpen,
|
||||
command: command
|
||||
});
|
||||
|
||||
whenLevelOpen.promise.then(function() {
|
||||
|
|
|
@ -121,10 +121,12 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
startOffCommand: function() {
|
||||
if (!this.testOption('noStartCommand')) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'hint; delay 3000; show goal'
|
||||
'hint; delay 2000; show goal'
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
initVisualization: function(options) {
|
||||
|
@ -297,6 +299,10 @@ var Level = Sandbox.extend({
|
|||
return toAnalyze.split(';').length;
|
||||
},
|
||||
|
||||
testOption: function(option) {
|
||||
return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr'));
|
||||
},
|
||||
|
||||
levelSolved: function(defer) {
|
||||
this.solved = true;
|
||||
Main.getEvents().trigger('levelSolved', this.level.id);
|
||||
|
@ -306,7 +312,10 @@ var Level = Sandbox.extend({
|
|||
var numCommands = this.gitCommandsIssued.length;
|
||||
var best = this.getNumSolutionCommands();
|
||||
|
||||
this.mainVis.gitVisuals.finishAnimation()
|
||||
var skipFinishDialog = this.testOption('noFinishDialog');
|
||||
var finishAnimationChain = this.mainVis.gitVisuals.finishAnimation();
|
||||
if (!skipFinishDialog) {
|
||||
finishAnimationChain = finishAnimationChain
|
||||
.then(function() {
|
||||
// we want to ask if they will move onto the next level
|
||||
// while giving them their results...
|
||||
|
@ -317,9 +326,12 @@ var Level = Sandbox.extend({
|
|||
});
|
||||
|
||||
return nextDialog.getPromise();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
finishAnimationChain
|
||||
.then(function() {
|
||||
if (nextLevel) {
|
||||
if (!skipFinishDialog && nextLevel) {
|
||||
Main.getEventBaton().trigger(
|
||||
'commandSubmitted',
|
||||
'level ' + nextLevel.id
|
||||
|
|
|
@ -23,6 +23,7 @@ var Sandbox = Backbone.View.extend({
|
|||
tagName: 'div',
|
||||
initialize: function(options) {
|
||||
options = options || {};
|
||||
this.options = options;
|
||||
|
||||
this.initVisualization(options);
|
||||
this.initCommandCollection(options);
|
||||
|
@ -140,7 +141,8 @@ var Sandbox = Backbone.View.extend({
|
|||
|
||||
var currentLevel = new Level({
|
||||
level: levelJSON,
|
||||
deferred: whenLevelOpen
|
||||
deferred: whenLevelOpen,
|
||||
command: command
|
||||
});
|
||||
|
||||
whenLevelOpen.promise.then(function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue