diff --git a/build/bundle.js b/build/bundle.js index 91db4c8d..4ab63713 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -4669,7 +4669,7 @@ var Sandbox = Backbone.View.extend({ showLevels: function(command, deferred) { var whenClosed = Q.defer(); - Main.getLevelDropdown().show(whenClosed); + Main.getLevelDropdown().show(whenClosed, command); whenClosed.promise.done(function() { command.finishWith(deferred); }); @@ -6828,7 +6828,7 @@ var Level = Sandbox.extend({ }, testOption: function(option) { - return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr')); + return this.options.command && new RegExp('--' + option).test(this.options.command.get('rawStr')); }, levelSolved: function(defer) { @@ -16926,7 +16926,12 @@ var LevelDropdownView = ContainedBase.extend({ this.hide(); }, - show: function(deferred) { + testOption: function(str) { + return this.currentCommand && new RegExp('--' + str).test(this.currentCommand.get('rawStr')); + }, + + show: function(deferred, command) { + this.currentCommand = command; // doing the update on show will allow us to fade which will be nice this.updateSolvedStatus(); @@ -16947,10 +16952,12 @@ var LevelDropdownView = ContainedBase.extend({ }, loadLevelID: function(id) { - Main.getEventBaton().trigger( - 'commandSubmitted', - 'level ' + id - ); + if (!this.testOption('noOutput')) { + Main.getEventBaton().trigger( + 'commandSubmitted', + 'level ' + id + ); + } this.hide(); }, @@ -20850,7 +20857,7 @@ var Level = Sandbox.extend({ }, testOption: function(option) { - return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr')); + return this.options.command && new RegExp('--' + option).test(this.options.command.get('rawStr')); }, levelSolved: function(defer) { @@ -21290,7 +21297,7 @@ var Sandbox = Backbone.View.extend({ showLevels: function(command, deferred) { var whenClosed = Q.defer(); - Main.getLevelDropdown().show(whenClosed); + Main.getLevelDropdown().show(whenClosed, command); whenClosed.promise.done(function() { command.finishWith(deferred); }); @@ -24098,7 +24105,12 @@ var LevelDropdownView = ContainedBase.extend({ this.hide(); }, - show: function(deferred) { + testOption: function(str) { + return this.currentCommand && new RegExp('--' + str).test(this.currentCommand.get('rawStr')); + }, + + show: function(deferred, command) { + this.currentCommand = command; // doing the update on show will allow us to fade which will be nice this.updateSolvedStatus(); @@ -24119,10 +24131,12 @@ var LevelDropdownView = ContainedBase.extend({ }, loadLevelID: function(id) { - Main.getEventBaton().trigger( - 'commandSubmitted', - 'level ' + id - ); + if (!this.testOption('noOutput')) { + Main.getEventBaton().trigger( + 'commandSubmitted', + 'level ' + id + ); + } this.hide(); }, diff --git a/src/js/level/index.js b/src/js/level/index.js index c3345c65..776ce6ff 100644 --- a/src/js/level/index.js +++ b/src/js/level/index.js @@ -300,7 +300,7 @@ var Level = Sandbox.extend({ }, testOption: function(option) { - return this.options.command && RegExp('--' + option).test(this.options.command.get('rawStr')); + return this.options.command && new RegExp('--' + option).test(this.options.command.get('rawStr')); }, levelSolved: function(defer) { diff --git a/src/js/level/sandbox.js b/src/js/level/sandbox.js index 0e0edd3f..4874c761 100644 --- a/src/js/level/sandbox.js +++ b/src/js/level/sandbox.js @@ -176,7 +176,7 @@ var Sandbox = Backbone.View.extend({ showLevels: function(command, deferred) { var whenClosed = Q.defer(); - Main.getLevelDropdown().show(whenClosed); + Main.getLevelDropdown().show(whenClosed, command); whenClosed.promise.done(function() { command.finishWith(deferred); }); diff --git a/src/js/views/levelDropdownView.js b/src/js/views/levelDropdownView.js index 14fe7ee2..3f1de3cc 100644 --- a/src/js/views/levelDropdownView.js +++ b/src/js/views/levelDropdownView.js @@ -190,7 +190,12 @@ var LevelDropdownView = ContainedBase.extend({ this.hide(); }, - show: function(deferred) { + testOption: function(str) { + return this.currentCommand && new RegExp('--' + str).test(this.currentCommand.get('rawStr')); + }, + + show: function(deferred, command) { + this.currentCommand = command; // doing the update on show will allow us to fade which will be nice this.updateSolvedStatus(); @@ -211,10 +216,12 @@ var LevelDropdownView = ContainedBase.extend({ }, loadLevelID: function(id) { - Main.getEventBaton().trigger( - 'commandSubmitted', - 'level ' + id - ); + if (!this.testOption('noOutput')) { + Main.getEventBaton().trigger( + 'commandSubmitted', + 'level ' + id + ); + } this.hide(); },