summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
authorMarko Pušnik <marko.pusnik@guru.si>2015-09-29 08:32:59 +0200
committerMarko Pušnik <marko.pusnik@guru.si>2015-09-29 08:32:59 +0200
commit10de7241f22a10d65f53c891a8b07fe8650b4878 (patch)
tree2101756ddb2c994b25b03fd0e65a74e7d3e991eb /js/codeq
parent116ee90e005a01dd7c9b08519ad658dcbdce8992 (diff)
login removed from navbar
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/language.js56
-rw-r--r--js/codeq/login.js88
-rw-r--r--js/codeq/navigation.js4
-rw-r--r--js/codeq/problem.js2
-rw-r--r--js/codeq/prolog.js2
-rw-r--r--js/codeq/python.js2
6 files changed, 68 insertions, 86 deletions
diff --git a/js/codeq/language.js b/js/codeq/language.js
index be2a319..aac4e78 100644
--- a/js/codeq/language.js
+++ b/js/codeq/language.js
@@ -1,30 +1,28 @@
-/**
- * Created by robert on 9/18/15.
- */
-
-(function(){
- var jqScreen = $('#screen_language'),
- jqProlog = $('#choose-prolog'),
- jqPython = $('#choose-python'),
- chooseProlog = function () {codeq.globalStateMachine.transition('problem', 'prolog');},
- choosePython = function () {codeq.globalStateMachine.transition('problem', 'python');};
-
- codeq.globalStateMachine.register('language',{
- 'enter': function(){
- $('#navigation-login').css('display', '');
- $("#navigation-language").addClass("active").css('display', '');
-
- jqScreen.css('display', '');
- jqProlog.on('click', chooseProlog);
- jqPython.on('click', choosePython);
- },
- 'exit' : function(){
- jqProlog.off();
- jqPython.off();
- jqScreen.css('display', 'none');
-
- $('#navigation-login').css('display', 'none');
- $('#navigation-language').css('display', 'none').removeClass("active");
- }
- });
+/**
+ * Created by robert on 9/18/15.
+ */
+
+(function(){
+ var jqScreen = $('#screen_language'),
+ jqProlog = $('#choose-prolog'),
+ jqPython = $('#choose-python'),
+ chooseProlog = function () {codeq.globalStateMachine.transition('problem', 'prolog');},
+ choosePython = function () {codeq.globalStateMachine.transition('problem', 'python');};
+
+ codeq.globalStateMachine.register('language',{
+ 'enter': function(){
+ $("#navigation-language").addClass("active").css('display', '');
+
+ jqScreen.css('display', '');
+ jqProlog.on('click', chooseProlog);
+ jqPython.on('click', choosePython);
+ },
+ 'exit' : function(){
+ jqProlog.off();
+ jqPython.off();
+ jqScreen.css('display', 'none');
+
+ $('#navigation-language').css('display', 'none').removeClass("active");
+ }
+ });
})(); \ No newline at end of file
diff --git a/js/codeq/login.js b/js/codeq/login.js
index bb92325..c400f06 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -1,48 +1,42 @@
-/**
- * Created by robert on 9/17/15.
- */
-
-(function(){
- var loginFun = function(){
- $('#disabled').css('display', '');
- $('#disabled').css('cursor', 'wait');
- codeq.comms.connect()
- .then(function () {
- return codeq.comms.login($('#username').val(), $('#password').val());
- })
- .then(function (data) {
- $('#disabled').css('display', 'none');
- $('#disabled').css('cursor', '');
- if (data.code !== 0) throw new Error('Login failed, code: ' + data.code + ', message: ' + data.message);
- codeq.globalStateMachine.transition('language');
- //codeq.activateState('language');
- })
- .fail(function (reason) {
- $('#disabled').css('display', 'none');
- $('#disabled').css('cursor', '');
- codeq.log.error('Login failed: ' + reason, reason);
- alert('Login request failed: ' + reason);
- $('#disabled').css('display', 'none');
- })
- .done();
- };
- codeq.globalStateMachine.register('login',{
- 'enter': function(){
- $("#submit").on('click', loginFun);
-
- $("#navigation-login").addClass("active");
- $('#navigation-login').css('display', '');
-
- $("#screen_login").css('display', '');
- $('#disabled').css('display', 'none');
- },
- 'exit' : function(){
- $("#submit").off('click', loginFun);
- $("#screen_login").css('display', 'none');
- $("#password").val('');
-
- $('#navigation-login').css('display', 'none');
- $("#navigation-login").removeClass("active");
- }
- });
+/**
+ * Created by robert on 9/17/15.
+ */
+
+(function(){
+ var loginFun = function(){
+ $('#disabled').css('display', '');
+ $('#disabled').css('cursor', 'wait');
+ codeq.comms.connect()
+ .then(function () {
+ return codeq.comms.login($('#username').val(), $('#password').val());
+ })
+ .then(function (data) {
+ $('#disabled').css('display', 'none');
+ $('#disabled').css('cursor', '');
+ if (data.code !== 0) throw new Error('Login failed, code: ' + data.code + ', message: ' + data.message);
+ codeq.globalStateMachine.transition('language');
+ //codeq.activateState('language');
+ })
+ .fail(function (reason) {
+ $('#disabled').css('display', 'none');
+ $('#disabled').css('cursor', '');
+ codeq.log.error('Login failed: ' + reason, reason);
+ alert('Login request failed: ' + reason);
+ $('#disabled').css('display', 'none');
+ })
+ .done();
+ };
+ codeq.globalStateMachine.register('login',{
+ 'enter': function(){
+ $("#submit").on('click', loginFun);
+
+ $("#screen_login").css('display', '');
+ $('#disabled').css('display', 'none');
+ },
+ 'exit' : function(){
+ $("#submit").off('click', loginFun);
+ $("#screen_login").css('display', 'none');
+ $("#password").val('');
+ }
+ });
})(); \ No newline at end of file
diff --git a/js/codeq/navigation.js b/js/codeq/navigation.js
index 30503e0..1a7799f 100644
--- a/js/codeq/navigation.js
+++ b/js/codeq/navigation.js
@@ -81,10 +81,6 @@
//setup all the buttons in the banner
- $('#navigation-login').on('click', function(e){
- codeq.globalStateMachine.transition('login');
- e.preventDefault();//prevent this since we'll trigger a page reload otherwise
- });
$('#navigation-language').on('click', function(e){
codeq.globalStateMachine.transition('language');
e.preventDefault();
diff --git a/js/codeq/problem.js b/js/codeq/problem.js
index 35b45af..464dc12 100644
--- a/js/codeq/problem.js
+++ b/js/codeq/problem.js
@@ -303,7 +303,6 @@
'enter': function(language){
var data = null; // language data
- $('#navigation-login').css('display', '');
$('#navigation-language').css('display', '');
$("#navigation-problem").addClass("active").css('display', '');
@@ -329,7 +328,6 @@
},
'exit' : function(){
jqScreen.css('display', 'none');
- $('#navigation-login').css('display', 'none');
$('#navigation-language').css('display', 'none');
$('#navigation-problem').css('display', 'none').removeClass("active");
}
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index 980a60c..d827139 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -67,7 +67,6 @@
var prologHandler; //created when we enter the prolog state and destroyed once we leave it
codeq.globalStateMachine.register('prolog', {
'enter': function (problemDef, commonHints, currentSolution) {
- $('#navigation-login').css('display', '');
$('#navigation-language').css('display', '');
$('#navigation-problem').css('display', '');
$("#navigation-prolog").addClass("active");
@@ -99,7 +98,6 @@
subScreens = null;
jqScreen.addClass('block1');
- $('#navigation-login').css('display', 'none');
$('#navigation-language').css('display', 'none');
$('#navigation-problem').css('display', 'none');
$("#navigation-prolog").removeClass("active");
diff --git a/js/codeq/python.js b/js/codeq/python.js
index 009c4a5..cf2199a 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -72,7 +72,6 @@
var pythonHandler; //created when we enter the python state and destroyed once we leave it
codeq.globalStateMachine.register('python', {
'enter': function (problemDef, commonHints, currentSolution) {
- $('#navigation-login').css('display', '');
$('#navigation-language').css('display', '');
$('#navigation-problem').css('display', '');
$("#navigation-python").addClass("active");
@@ -109,7 +108,6 @@
subScreens = null;
jqScreen.addClass('block1');
- $('#navigation-login').css('display', 'none');
$('#navigation-language').css('display', 'none');
$('#navigation-problem').css('display', 'none');
$("#navigation-python").removeClass("active");