diff options
Diffstat (limited to 'js/codeq')
-rw-r--r-- | js/codeq/prolog.js | 14 | ||||
-rw-r--r-- | js/codeq/python.js | 14 | ||||
-rw-r--r-- | js/codeq/robot.js | 19 |
3 files changed, 11 insertions, 36 deletions
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index 0ae8206..1b8d3c3 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -17,16 +17,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ (function() { "use strict"; var jqScreen = $('#screen-prolog'), // the screen container element - // quadrants - jqCode = jqScreen.find('.block2'), jqConsole = jqScreen.find('.block3'), - jqInfo = jqScreen.find('.block-left'), - jqAllQuadrants = jqCode.add(jqConsole).add(jqInfo), // all the quadrants - // buttons jqBtnPlan = jqScreen.find('.btn-plan'), jqBtnTest = jqScreen.find('.btn-test').ladda(), jqAllButtons = jqBtnPlan.add(jqBtnTest), // all the buttons - prologHandler; + prologHandler; // created when we enter the prolog state and destroyed once we leave it // experiment: Prolog hints var jqTeacherHelp = jqScreen.find('.teacher-help'); @@ -42,7 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ prologHandler = createPrologHandler(problemDef, commonDef, currentSolution); }; - var prologHandler; //created when we enter the prolog state and destroyed once we leave it codeq.globalStateMachine.register('prolog', { 'jqScreen': jqScreen, 'enter': function (ref, data) { @@ -64,8 +58,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ jqTeacherHelp.hide(); // end of experiment: Prolog hints - jqAllButtons.off(); // unregister all event handlers - jqAllQuadrants.off(); jqScreen.css('display', 'none'); prologHandler.destroy(); prologHandler = null; @@ -173,9 +165,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ }); var createPrologHandler = function (problemDef, commonDef, currentSolution) { - var jqEditor = jqCode.find('.code_editor'), + var jqEditor = jqScreen.find('.code_editor'), + jqHints = jqScreen.find('.hints'), jqTerminal = jqConsole.find('.console'), - jqHints = jqInfo.find('.hints'), editor = codeq.makeEditor(jqEditor[0], { mode: 'prolog', diff --git a/js/codeq/python.js b/js/codeq/python.js index edf0f46..893110b 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -17,18 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ (function() { "use strict"; var jqScreen = $('#screen-python'), // the screen container element - // quadrants - jqCode = jqScreen.find('.block2'), jqConsole = jqScreen.find('.block3'), - jqInfo = jqScreen.find('.block-left'), - jqAllQuadrants = jqCode.add(jqConsole).add(jqInfo), // all the quadrants - // buttons jqBtnPlan = jqScreen.find('.btn-plan'), jqBtnTest = jqScreen.find('.btn-test').ladda(), jqBtnRun = jqScreen.find('.btn-run'), jqBtnStop = jqScreen.find('.btn-stop'), - jqInfoButtons = jqBtnPlan.add(jqBtnTest), // all info-focusing buttons - jqAllButtons = jqInfoButtons.add(jqBtnRun).add(jqBtnStop), // all buttons + jqAllButtons = jqBtnPlan.add(jqBtnTest).add(jqBtnRun).add(jqBtnStop), // all buttons pythonHandler; // created when we enter the python state and destroyed once we leave it var enterFun = function(problemDef, commonDef, currentSolution) { @@ -58,8 +52,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ .done(); }, 'exit': function () { - jqAllButtons.off(); // unregister all event handlers - jqAllQuadrants.off(); jqScreen.css('display', 'none'); pythonHandler.destroy(); pythonHandler = null; @@ -113,9 +105,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ }); var createPythonHandler = function (problemDef, commonDef, currentSolution) { - var jqEditor = jqCode.find('.code_editor'), + var jqEditor = jqScreen.find('.code_editor'), + jqHints = jqScreen.find('.hints'), jqTerminal = jqConsole.find('.console'), - jqHints = jqInfo.find('.hints'), editor = codeq.makeEditor(jqEditor[0], { mode: 'python', diff --git a/js/codeq/robot.js b/js/codeq/robot.js index 7bda8ec..f64e4a0 100644 --- a/js/codeq/robot.js +++ b/js/codeq/robot.js @@ -17,19 +17,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ (function() { "use strict"; var jqScreen = $('#screen-robot'), // the screen container element - // quadrants - jqCode = jqScreen.find('.block2'), jqConsole = jqScreen.find('.block3'), - jqInfo = jqScreen.find('.block-left'), - jqAllQuadrants = jqCode.add(jqConsole).add(jqInfo), // all the quadrants - // buttons jqBtnPlan = jqScreen.find('.btn-plan'), jqBtnHint = jqScreen.find('.btn-hint').ladda(), jqBtnRun = jqScreen.find('.btn-run'), jqBtnStop = jqScreen.find('.btn-stop'), - jqInfoButtons = jqBtnPlan.add(jqBtnHint), // all info-focusing buttons - jqAllButtons = jqInfoButtons.add(jqBtnRun).add(jqBtnStop), // all buttons - robotHandler; + jqAllButtons = jqBtnPlan.add(jqBtnHint).add(jqBtnRun).add(jqBtnStop), // all buttons + robotHandler; // created when we enter the robot state and destroyed once we leave it var enterFun = function(problemDef, commonDef, currentSolution) { $('#navigation-problem-list').css('display', ''); @@ -41,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ robotHandler = createRobotHandler(problemDef, commonDef, currentSolution); }; - var robotHandler; //created when we enter the robot state and destroyed once we leave it codeq.globalStateMachine.register('robot', { 'jqScreen': jqScreen, @@ -59,8 +52,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ .done(); }, 'exit': function () { - jqAllButtons.off(); // unregister all event handlers - jqAllQuadrants.off(); jqScreen.css('display', 'none'); robotHandler.destroy(); robotHandler = null; @@ -88,10 +79,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ }); var createRobotHandler = function (problemDef, commonDef, currentSolution) { - var jqEditor = jqCode.find('.code_editor'), - jqTerminal = jqConsole.find('.console'), - jqHints = jqInfo.find('.hints'), + var jqEditor = jqScreen.find('.code_editor'), + jqHints = jqScreen.find('.hints'), jqStatus = jqConsole.find('.status'), + jqTerminal = jqConsole.find('.console'), editor = codeq.makeEditor(jqEditor[0], { mode: 'python', |