From 3eaecb641fd8328212e6c503bc056794f7290b17 Mon Sep 17 00:00:00 2001 From: Robert Zorko Date: Fri, 18 Sep 2015 14:39:14 +0200 Subject: changes for th latest changes --- js/codeq/mainScreen.js | 126 ------------------------------------------------- 1 file changed, 126 deletions(-) delete mode 100644 js/codeq/mainScreen.js (limited to 'js/codeq/mainScreen.js') diff --git a/js/codeq/mainScreen.js b/js/codeq/mainScreen.js deleted file mode 100644 index e842ee3..0000000 --- a/js/codeq/mainScreen.js +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Created by robert on 9/17/15. - */ - -(function() { - var problems,//this will the actual (sub)state machine - stateNameTag = 'stateName'; - - var divs = {}; - divs['description'] = $('div.col-lg-3.col-md-6.col-sm-12:has(#description)');//lets actually find the needed divs for later use - divs['code'] = $('div.col-lg-3.col-md-6.col-sm-12:has(#code_editor)'); - divs['console'] = $('div.col-lg-3.col-md-6.col-sm-12:has(#console)');//named 'consoleDiv', because 'console' is already in use - divs['info'] = $('div.col-lg-3.col-md-6.col-sm-12:has(#info)'); - - divs['description'].data(stateNameTag, 'description'); - divs['code'].data(stateNameTag, 'code'); - divs['console'].data(stateNameTag, 'console'); - divs['info'].data(stateNameTag, 'info'); - - var eventName = 'mousedown',//event name of the event which will trigger the transition between these substates - mouseDownEventFunction = function () { - problems.transition($(this).data(stateNameTag)); - }, - removeListenersFromDivs = function () { - $.each(divs, function (i, value) { - value.off(eventName, mouseDownEventFunction); - }); - }, - removeBlockClassesFromDivs = function () { - $.each(divs, function (i, value) { - value.removeClass('block'); - }); - }, - removeChangedClassesFromDivs = function () { - $.each(divs, function (i, value) { - value.removeClass('block-focus block-less-width block-less-height block-less-everything').addClass('block');//these class names were chosen for the view where the screen is partitioned in 4 quarters (2 by 2) - }); - }, - setTransitionsBetweenDivs = function (current) { - $.each(divs, function (key, value) { - if (current !== key) value.on(eventName, mouseDownEventFunction); - }); - }, - addClassesToDivs = function (divsWithClasses) { - $.each(divsWithClasses, function (divName, className) { - divs[divName].addClass(className); - }); - }, - substates = { - 'description': { - 'enter': function () { - removeBlockClassesFromDivs(); - addClassesToDivs({ - 'description': 'block-focus', - 'code': 'block-less-width', - 'console': 'block-less-height', - 'info': 'block-less-everything' - }); - setTransitionsBetweenDivs('description'); - }, - 'exit': function () { - removeChangedClassesFromDivs(); - removeListenersFromDivs(); - } - }, - 'code': { - 'enter': function () { - removeBlockClassesFromDivs(); - addClassesToDivs({ - 'description': 'block-less-width', - 'code': 'block-focus', - 'console': 'block-less-everything', - 'info': 'block-less-height' - }); - setTransitionsBetweenDivs('code'); - }, - 'exit': function () { - removeChangedClassesFromDivs(); - removeListenersFromDivs(); - } - }, - 'info': { - 'enter': function () { - removeBlockClassesFromDivs(); - addClassesToDivs({ - 'description': 'block-less-everything', - 'code': 'block-less-height', - 'console': 'block-less-width', - 'info': 'block-focus' - }); - setTransitionsBetweenDivs('info'); - }, - 'exit': function () { - removeChangedClassesFromDivs(); - removeListenersFromDivs(); - } - }, - 'console': { - 'enter': function () { - removeBlockClassesFromDivs(); - addClassesToDivs({ - 'description': 'block-less-height', - 'code': 'block-less-everything', - 'console': 'block-focus', - 'info': 'block-less-width' - }); - setTransitionsBetweenDivs('console'); - }, - 'exit': function () { - removeChangedClassesFromDivs(); - removeListenersFromDivs(); - } - } - }; - codeq.globalStateMachine.register('main', { - 'enter': function () { - $('#screen_prolog').css('display', ''); - problems = codeq.makeStateMachine(substates); - problems.transition(divs['description'].data(stateNameTag)); - }, - 'exit': function () { - $('#screen_prolog').css('display', 'none'); - problems.destroy(); - } - }); -})(); \ No newline at end of file -- cgit v1.2.1