summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-12-17 14:02:20 +0100
committerRobert Zorko <robertz@gurucue.com>2015-12-17 14:02:20 +0100
commit27d9966693bc88495617ba165f290c7f2e54abd0 (patch)
treec8c7854e8777f149bd6d41c4a42b2060f71e1f64 /js/codeq
parenta7fa6cfffebe3026198ad8beb0e06543d3503bb6 (diff)
added 'use strict', coirrected some errors which were revealed by it and fixed the argument of the call of the wait function used in the reset function (core.js)
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/aaiLogin.js3
-rw-r--r--js/codeq/about.js5
-rw-r--r--js/codeq/change_password.js5
-rw-r--r--js/codeq/comms.js12
-rw-r--r--js/codeq/console.js2
-rw-r--r--js/codeq/core.js3
-rw-r--r--js/codeq/editor.js1
-rw-r--r--js/codeq/hint.js1
-rw-r--r--js/codeq/init.js1
-rw-r--r--js/codeq/language.js2
-rw-r--r--js/codeq/login.js2
-rw-r--r--js/codeq/misc.js1
-rw-r--r--js/codeq/navigation.js3
-rw-r--r--js/codeq/problem_list.js3
-rw-r--r--js/codeq/profile.js3
-rw-r--r--js/codeq/prolog.js1
-rw-r--r--js/codeq/python.js1
-rw-r--r--js/codeq/robot.js1
-rw-r--r--js/codeq/settings.js4
-rw-r--r--js/codeq/signup.js4
-rw-r--r--js/codeq/translation.js2
-rw-r--r--js/codeq/upgrade_to_aai.js3
22 files changed, 48 insertions, 15 deletions
diff --git a/js/codeq/aaiLogin.js b/js/codeq/aaiLogin.js
index abe7283..dce047e 100644
--- a/js/codeq/aaiLogin.js
+++ b/js/codeq/aaiLogin.js
@@ -16,9 +16,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/**
* Created by robert on 10/14/15.
+ *
*/
(function(){
-
+ "use strict";
var jqScreen = $('#screen_aai_login'),
jqNavBarRight = $('.nav.navbar-nav.navbar-right'),
jqNavigationHomeBtn = $('#navigation-home'),
diff --git a/js/codeq/about.js b/js/codeq/about.js
index f56d9fd..69327fc 100644
--- a/js/codeq/about.js
+++ b/js/codeq/about.js
@@ -14,11 +14,14 @@ details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
/**
* Created by markop on 11/09/15.
+ *
*/
(function(){
-
+ "use strict";
var jqScreen = $("#screen_about"),
jqBtnGoBack = $("#btnAboutGoBack");
diff --git a/js/codeq/change_password.js b/js/codeq/change_password.js
index 6ebd6dd..20c26d5 100644
--- a/js/codeq/change_password.js
+++ b/js/codeq/change_password.js
@@ -14,11 +14,14 @@ details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+
/**
* Created by robert on 10/14/15.
+ *
*/
(function(){
-
+ "use strict";
var jqScreen = $("#screen_change_pass"),
jqNew = $("#modalChangePasswordNew"),
jqVerify = $("#modalChangePasswordVerify"),
diff --git a/js/codeq/comms.js b/js/codeq/comms.js
index 5e046b7..fcce6df 100644
--- a/js/codeq/comms.js
+++ b/js/codeq/comms.js
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
(function () {
+ "use strict";
// ================================================================================
// Errors generated in this module
// ================================================================================
@@ -22,7 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
var BinaryMessageError = function (message) {
var e = new Error(message);
this.message = message;
- if (e.stack) this.stack = e.stack;
+ if (e.stack) {
+ this.stack = e.stack;
+ }
};
BinaryMessageError.prototype = new Error();
BinaryMessageError.prototype.name = 'BinaryMessageError';
@@ -32,12 +35,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
if (message instanceof Error) {
e = message;
this.message = 'Message parse error: ' + e.toString();
- }
- else {
+ } else {
e = new Error(message);
this.message = message;
}
- if (e.stack) this.stack = e.stack;
+ if (e.stack) {
+ this.stack = e.stack;
+ }
};
MessageParseError.prototype = new Error();
MessageParseError.prototype.name = 'MessageParseError';
diff --git a/js/codeq/console.js b/js/codeq/console.js
index e275d50..26d0be8 100644
--- a/js/codeq/console.js
+++ b/js/codeq/console.js
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
*/
(function () {
-
+ "use strict";
var noop = function () { return false; }, // ignore keypress
defaultKeyMappings = { // keyed by modifiers, each either 1 or 0: shift || ctrl || alt
diff --git a/js/codeq/core.js b/js/codeq/core.js
index b53ce70..84331d4 100644
--- a/js/codeq/core.js
+++ b/js/codeq/core.js
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
(function () {
+ "use strict";
window.siteDefinition = {logLevel: 'debug'/*, 'logService': '/ws/clientlog'*/}; // for debug purposes
// ================================================================================
@@ -622,7 +623,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
.fail(function (e) {
codeq.log.debug(e)
}) // ignore errors*/
- codeq.comms.forceReset
+ codeq.comms.forceReset()
)
.fin(function () {
if (reason) {
diff --git a/js/codeq/editor.js b/js/codeq/editor.js
index 4b0ba6f..157c70e 100644
--- a/js/codeq/editor.js
+++ b/js/codeq/editor.js
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
codeq.makeEditor = function (elt, options, onEscape) {
+ "use strict";
var statusBar = $(elt).siblings(".block-statusbar")[0],
updateStatusBar = function (pos) {
statusBar.innerHTML = 'line ' + (pos.line+1) + ', column ' + (pos.ch+1);
diff --git a/js/codeq/hint.js b/js/codeq/hint.js
index 565b54f..3df4cb2 100644
--- a/js/codeq/hint.js
+++ b/js/codeq/hint.js
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
*/
(function () {
+ "use strict";
// constants
var firstCharacterPos = {'line': 0, 'ch': 0},
sel_no_scroll = {'scroll': false};
diff --git a/js/codeq/init.js b/js/codeq/init.js
index f9506ec..f96fb95 100644
--- a/js/codeq/init.js
+++ b/js/codeq/init.js
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
(function () {
+ "use strict";
var loadGuiTranslations = function () {
var langs = codeq.availableLangs,
loaders = [],
diff --git a/js/codeq/language.js b/js/codeq/language.js
index cacdb32..708074b 100644
--- a/js/codeq/language.js
+++ b/js/codeq/language.js
@@ -16,9 +16,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/**
* Created by robert on 9/18/15.
+ *
*/
(function(){
+ "use strict";
var jqScreen = $('#screen_language'),
jqProlog = $('#choose-prolog'),
jqPython = $('#choose-python'),
diff --git a/js/codeq/login.js b/js/codeq/login.js
index f7ddeb3..79371be 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -16,9 +16,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/**
* Created by robert on 9/17/15.
+ *
*/
(function(){
+ "use strict";
var jqScreen = $("#screen_login"),
jqNavBarRight = $('.nav.navbar-nav.navbar-right'),
jqNavigationHomeBtn = $('#navigation-home'),
diff --git a/js/codeq/misc.js b/js/codeq/misc.js
index 367e62b..d81094c 100644
--- a/js/codeq/misc.js
+++ b/js/codeq/misc.js
@@ -16,6 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Detect if we're on a phone, browser and platform type */
(function browserDetection() {
+ "use strict";
var platform = navigator.platform,
userAgent = navigator.userAgent,
runningOnPhone = false, // default value, will be changed if detected otherwise
diff --git a/js/codeq/navigation.js b/js/codeq/navigation.js
index d806eea..ce67084 100644
--- a/js/codeq/navigation.js
+++ b/js/codeq/navigation.js
@@ -16,8 +16,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/**
* Created by robert on 9/15/15.
+ *
*/
+
(function() {
+ "use strict";
codeq.makeStateMachine = function (def) {
var currState = null;
return {
diff --git a/js/codeq/problem_list.js b/js/codeq/problem_list.js
index 645a58a..1384066 100644
--- a/js/codeq/problem_list.js
+++ b/js/codeq/problem_list.js
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
(function(){
+ "use strict";
var jqScreen = $('#screen_problem_list'),
languageCache = {}, // keyed by language identifier: processed data about languages
translationCache = [], // keys are autogenerated in ta(), a value is a dictionary of translations of a translation key for every language
@@ -310,7 +311,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
showAttempts = function (languageData, attempts) {
var i;
for (i = 0; i < languageData.refs.length; i++) {
- ref = languageData.refs[i];
+ var ref = languageData.refs[i];
if (ref.id in attempts) {
jqScreen.find('a.problem-'+i)
.removeClass('solved attempted')
diff --git a/js/codeq/profile.js b/js/codeq/profile.js
index f863140..4b2f9ce 100644
--- a/js/codeq/profile.js
+++ b/js/codeq/profile.js
@@ -16,10 +16,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/**
* Created by markop on 9/29/15.
+ *
*/
(function(){
-
+ "use strict";
var jqScreen = $("#screen_profile"),
jqBtnChangePass = $("#change_pass_profile"),
jqBtnGoBack = $("#btnProfileGoBack");
diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js
index b772685..7ff0af6 100644
--- a/js/codeq/prolog.js
+++ b/js/codeq/prolog.js
@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
*/
(function() {
+ "use strict";
var subScreens, //this will be the actual (sub)state machine
stateNameTag = 'stateName', //a tag for data which is added to some html elements
jqScreen = $('#screen_prolog'), // the screen container element
diff --git a/js/codeq/python.js b/js/codeq/python.js
index 0fb7d2b..d688c7c 100644
--- a/js/codeq/python.js
+++ b/js/codeq/python.js
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
*/
(function() {
+ "use strict";
var subScreens, //this will be the actual (sub)state machine
stateNameTag = 'stateName', //a tag for data which is added to some html elements
jqScreen = $('#screen_python'), // the screen container element
diff --git a/js/codeq/robot.js b/js/codeq/robot.js
index ee6eda6..15067b1 100644
--- a/js/codeq/robot.js
+++ b/js/codeq/robot.js
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
*/
(function() {
+ "use strict";
var subScreens, //this will be the actual (sub)state machine
stateNameTag = 'stateName', //a tag for data which is added to some html elements
jqScreen = $('#screen_robot'), // the screen container element
diff --git a/js/codeq/settings.js b/js/codeq/settings.js
index 6fec614..980aba3 100644
--- a/js/codeq/settings.js
+++ b/js/codeq/settings.js
@@ -16,9 +16,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/**
* Created by robert on 9/29/15.
+ *
*/
-(function(){
+(function(){
+ "use strict";
var guiLangSelect = $('#gui_lang_select'),
robotAddressInput = $('#robot_address_input'),
jqDisabledOverlay = $('#disabled'),
diff --git a/js/codeq/signup.js b/js/codeq/signup.js
index 5f3f2be..e1d9a09 100644
--- a/js/codeq/signup.js
+++ b/js/codeq/signup.js
@@ -16,9 +16,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/**
* Created by robert on 10/14/15.
+ *
*/
-(function(){
+(function(){
+ "use strict";
var jqScreen = $("#screen_signup"),
jqUsername = $("#modalSignUpUsername"),
jqName = $("#modalSignUpName"),
diff --git a/js/codeq/translation.js b/js/codeq/translation.js
index 945cb52..b453876 100644
--- a/js/codeq/translation.js
+++ b/js/codeq/translation.js
@@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
(function () {
-
+ "use strict";
var dicts = {},
translateElement = function (jqElt, tkey, lang) {
var dictionaryKey = jqElt.data('dict') || 'gui',
diff --git a/js/codeq/upgrade_to_aai.js b/js/codeq/upgrade_to_aai.js
index 5357a29..ad57fed 100644
--- a/js/codeq/upgrade_to_aai.js
+++ b/js/codeq/upgrade_to_aai.js
@@ -16,9 +16,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/**
* Created by markop on 11/02/15.
+ *
*/
(function(){
-
+ "use strict";
var jqScreen = $("#screen_upgrade_to_aai"),
jqForm = $('#formUpgradeToAAI'),
jqNoBtn = $('#btnUpgradeToAAINo'),