-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
67 lines (61 loc) · 2.24 KB
/
index.html
File metadata and controls
67 lines (61 loc) · 2.24 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
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
<!DOCTYPE html>
<html>
<head>
<title>CYD Web Installer</title>
<meta charset="utf-8">
<script type="module" src="https://unpkg.com/esp-web-tools@9/dist/web/install-button.js?module"></script>
<script>
function loadExamples(type) {
if(!type) {
return;
}
let examples = document.getElementById('examples');
examples.innerHTML = '';
fetch('programs.json')
.then(response => response.json())
.then(json => {
json.programs.sort().forEach((element) => {
let w = document.importNode(document.getElementById('webflash').content, true);
w.querySelector('button').textContent = 'Install ' + element;
w.querySelector('esp-web-install-button').setAttribute('manifest', element + '/' + type + '/manifest.json');
examples.appendChild(w);
});
});
}
</script>
</head>
<body>
<h1>Cheap Yellow Display (CYD) Web Installer</h1>
<form onsubmit="return false;" class="flashable">
<label>Choose your CYD:
<select name="cyd" onchange="loadExamples(this.value)">
<option value=""></option>
<option value="cyd">CYD</option>
<option value="cyd2usb">CYD with 2 USBs</option>
</select>
</label>
</form>
<p class="flashable">Make sure to close anything using your devices com port (e.g. Serial monitor). Just hit the button to install the example on your CYD.</p>
<div id="examples" style="display: none;" class="flashable">
</div>
<template id="webflash">
<div style="margin-bottom: 10px;">
<esp-web-install-button class="installButton">
<button slot="activate"></button>
</esp-web-install-button>
</div>
</template>
<p id="notSupported" style="display: none; color: red;">
Your browser does not support the Web Serial API. Please open this page using a Chromium based browser like Edge or Chrome.
</p>
<script>
if(navigator.serial){
document.getElementById('examples').style.display = 'block';
} else {
console.log('Serial not supported');
[...document.getElementsByClassName('flashable')].forEach((e) => {e.style.display = 'none';});
document.getElementById('notSupported').style.display = 'block';
}
</script>
</body>
</html>