summaryrefslogtreecommitdiff
path: root/js/codeq
diff options
context:
space:
mode:
Diffstat (limited to 'js/codeq')
-rw-r--r--js/codeq/comms.js4
-rw-r--r--js/codeq/settings.js18
2 files changed, 22 insertions, 0 deletions
diff --git a/js/codeq/comms.js b/js/codeq/comms.js
index 5ac3d66..ecca6ff 100644
--- a/js/codeq/comms.js
+++ b/js/codeq/comms.js
@@ -301,6 +301,10 @@
return this.connect().then(performLogin);
},
+ 'updateSettings': function (new_settings){
+ return this.send({'action': 'settings', 'sid': sid, 'settings': new_settings});
+ },
+
sendActivity: function commsSendActivity (trace, solution, problem_id) {
return this.send({'action': 'activity', 'trace': trace, 'solution': solution, 'problem_id': problem_id});
},
diff --git a/js/codeq/settings.js b/js/codeq/settings.js
new file mode 100644
index 0000000..73bef14
--- /dev/null
+++ b/js/codeq/settings.js
@@ -0,0 +1,18 @@
+/**
+ * Created by robert on 9/29/15.
+ */
+(function(){
+ $("#gui_lang_select").on("change",function() {
+ var lang = $("#gui_lang_select").val();
+ if (lang in codeq.supportedLangs) {
+ codeq.log.debug("Changing lang to:" + lang);
+ codeq.comms.updateSettings({'lang': lang})
+ .then(function (data) {
+ if (data.code !== 0) throw new Error('Change language failed, code: ' + data.code + ', message: ' + data.message);
+ codeq.log.debug("success with settings");
+ codeq.setLang(lang);
+ })
+ .done();
+ }
+ })
+})(); \ No newline at end of file