diff options
Diffstat (limited to 'js/codeq/prolog.js')
-rw-r--r-- | js/codeq/prolog.js | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index 6c53777..1978ba4 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -1,17 +1,19 @@ /** * Created by robert on 9/17/15. + * + * The prolog state of the state machine. When it is entered it'll prepare the console and code editor and load a sub-state machine which represents the 4 different parts fo the screen. */ (function() { - var problems,//this will the actual (sub)state machine - stateNameTag = 'stateName'; + var subScreens,//this will the actual (sub)state machine + stateNameTag = 'stateName';//a tag for data which is added to some html elements //get the divs which are the main elements being change on transitions between states in the sub-state machine var divs = {}; - divs['description'] = $('#description_outer_div');//$('div.col-lg-3.col-md-6.col-sm-12:has(#description)'); - divs['code'] = $('#code_editor_outer_div');//$('div.col-lg-3.col-md-6.col-sm-12:has(#code_editor)'); - divs['console'] = $('#console_outer_div');//$('div.col-lg-3.col-md-6.col-sm-12:has(#console)'); - divs['info'] = $('#info_outer_div');//$('div.col-lg-3.col-md-6.col-sm-12:has(#info)'); + divs['description'] = $('#description_outer_div'); + divs['code'] = $('#code_editor_outer_div'); + divs['console'] = $('#console_outer_div'); + divs['info'] = $('#info_outer_div'); //these tags connect the div to their respective state in the sub-state machine divs['description'].data(stateNameTag, 'description'); @@ -24,7 +26,7 @@ * the general function which should be called on the mousedown event to trigger the transition between states */ mouseDownEventFunction = function () { - problems.transition($(this).data(stateNameTag)); + subScreens.transition($(this).data(stateNameTag)); }, /** * removes the above function from the divs @@ -82,12 +84,12 @@ */ mouseDownEventIgnoreFun = function(event){ event.stopPropagation(); - } + }, /** * The transition from the buttons to the hints screen will be triggered with this function */ clickListenerTransitionFun = function(){ - problems.transition(divs['info'].data(stateNameTag)); + subScreens.transition(divs['info'].data(stateNameTag)); }, /** * add the above function to the buttons @@ -197,8 +199,8 @@ $('#disabled').css('display', ''); $('#screen_prolog').css('display', '');//we have to show the screen now so the code editor shopws its initial values correctly prologHandler = createPrologHandler(data.data)//codeq.createProgrammingLanguageHandler('prolog',data.data,codeq.makePrologTerminalHandler); - problems = codeq.makeStateMachine(substates); - problems.transition(divs['description'].data(stateNameTag)); + subScreens = codeq.makeStateMachine(substates); + subScreens.transition(divs['description'].data(stateNameTag)); Q.delay(100).then(function(){ $('div.col-lg-3.col-md-6.col-sm-12').addClass('transition');//for smooth animations - need to be delayed, because otherwise we get some weird "animations" while the page is loading }).done(); @@ -209,7 +211,7 @@ $('#screen_prolog').css('display', 'none'); $('div.col-lg-3.col-md-6.col-sm-12').removeClass('transition'); prologHandler.destroy(); - problems.destroy(); + subScreens.destroy(); } }); |