forked from ibnuda/dactyl-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wrapper.html
115 lines (111 loc) · 4.01 KB
/
wrapper.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dactyl Generator</title>
<link rel="stylesheet" href="normalize.css" />
<link rel="stylesheet" href="milligram.min.css" />
<link rel="stylesheet" href="main.css" />
<script>
function toggle_connectors_fields() {
const use_external_holder = document.getElementById("connector.external")
.value;
const impacted_ids = ["connector.trrs", "connector.micro-usb"];
if (use_external_holder === "true") {
impacted_ids.forEach((id) => {
document.querySelector("label[for='" + id + "']").style.display =
"none"; // Hide the label
document.querySelector("select[id='" + id + "']").style.display =
"none"; // Hide the select
});
} else {
impacted_ids.forEach((id) => {
document.querySelector("label[for='" + id + "']").style.display =
"block"; // Show the label
document.querySelector("select[id='" + id + "']").style.display =
"block"; // Hide the select
});
}
}
function toggle_custom_thumb_fields() {
const use_custom_thumb = document.getElementById("form.custom-thumb-tenting").value;
const id = "custom-thumb-tenting";
if (use_custom_thumb === "false") {
document.querySelector("div[id='" + id + "']").style.display = "none"; // Hide the select
} else {
document.querySelector("div[id='" + id + "']").style.display = "block"; // Hide the select
}
}
function shove_json() {
var file = document.getElementById("jsonloader").files[0];
if (file) {
var reader = new FileReader();
reader.readAsText(file, "utf-8");
reader.onload = function (evt) {
json_val_to_form(JSON.parse(evt.target.result));
};
reader.onerror = function (evt) {
document.getElementById("somewhere").innerHTML = "fail";
};
}
}
function json_val_to_form(something) {
var i = 0;
for (const topkey in something) {
if (something.hasOwnProperty(topkey)) {
const key = something[topkey];
var j = 0;
for (const element in key) {
if (key.hasOwnProperty(element)) {
const somethingvalue = key[element];
console.log(topkey + "." + element + "=" + somethingvalue);
document.getElementById(
topkey + "." + element
).value = somethingvalue;
}
}
}
}
}
</script>
</head>
<body>
<div class="wrapper">
<nav class="navigation">
<section class="container">
<a class="navigation-title" href="/" title="Dactyl Generator">
<h1 class="title">Generator</h1>
</a>
<ul class="navigation-list float-right">
<li class="navigation-item">
<a href="/api" class="navigation-link">API</a>
</li>
<li class="navigation-item">
<a href="/manuform" class="navigation-link">Manuform</a>
</li>
<li class="navigation-item">
<a href="/lightcycle" class="navigation-link">Lightcycle</a>
</li>
<li class="navigation-item">
<a href="/example" class="navigation-link">Example</a>
</li>
</ul>
</section>
</nav>
<div id="content" class="container">
{% block content %} {% endblock %}
</div>
<footer class="footer">
<section class="container">
<p class="copyright">
Written by<a href="https://github.com/ibnuda" rel="noopener" target="_blank" title="Rick's GH page.">
Ibnu D. Aji</a>. Licenced under the<a href="https://github.com/ibnuda/dactyl-keyboard/tree/refaktor#license"
rel="noopener" target="_blank" title="GNU Affero General Public License Version 3">
GNU Affero General Public License V3</a>.
</p>
</section>
</footer>
</div>
</body>
</html>