-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconcertinaScript.js
More file actions
37 lines (33 loc) · 1.11 KB
/
concertinaScript.js
File metadata and controls
37 lines (33 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
let currentLayout = '';
let currentKey = '';
function switchConfiguration(config, layout, key) {
currentLayout= layout;
currentKey = key;
for (const property in config) {
$("#" + property)
.find(".top")
.text(config[property][0].toUpperCase());
$("#" + property)
.find(".bottom")
.text(config[property][1].toUpperCase());
}
}
$(document).ready(function () {
switchConfiguration(angloConfigs['CG']['Wheatstone'], 'Wheatstone', 'CG');
// Switch keys
$(".keyButton").on("click", function () {
$(".keyButton").css("background-color", "rgba(255, 255, 255, 0.56)");
$(this).css("background-color", "rgba(255, 255, 255)");
const key = $(this).attr('id');
console.log(key);
switchConfiguration(angloConfigs[key][currentLayout], currentLayout, key);
});
// Switch layouts
$("#switchButton").on("click", function () {
if(currentLayout === 'Wheatstone') {
switchConfiguration(angloConfigs[currentKey]['Jeffries'], 'Jeffries', currentKey);
} else {
switchConfiguration(angloConfigs[currentKey]['Wheatstone'], 'Wheatstone', currentKey);
}
});
});