-
Notifications
You must be signed in to change notification settings - Fork 11
/
index_no_release.html
169 lines (161 loc) · 6.86 KB
/
index_no_release.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html lang="en" class="">
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<title>Install Tasmota</title>
<style>
div,fieldset,input,select{padding:5px;font-size:1em;}
fieldset{background:#4f4f4f;}
p{margin:0.5em 0;}
input{width:100%;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;background:#dddddd;color:#000000;}
input[type=checkbox],input[type=radio]{width:1em;margin-right:6px;vertical-align:-1px;}
input[type=range]{width:99%;}
select{width:100%;background:#dddddd;color:#000000;}
textarea{resize:vertical;width:98%;height:318px;padding:5px;overflow:auto;background:#1f1f1f;color:#65c115;}
body{text-align:center;font-family:verdana,sans-serif;background:#252525;}
td{padding:0px;}
button{border:0;border-radius:0.3rem;background:#1fa3ec;color:#faffff;line-height:2.4rem;font-size:1.2rem;width:100%;-webkit-transition-duration:0.4s;transition-duration:0.4s;cursor:pointer;}
button:hover{background:#0e70a4;}
.bred{background:#d43535;}
.bred:hover{background:#931f1f;}
.bgrn{background:#47c266;}
.bgrn:hover{background:#5aaf6f;}
a{color:#1fa3ec;text-decoration:none;}
.p{float:left;text-align:left;}
.q{float:right;text-align:right;}
.r{border-radius:0.3em;padding:2px;margin:6px 2px;}
.pick-variant{margin-bottom:16px;}
</style>
<script
type="module"
src="https://unpkg.com/tasmota-esp-web-tools@8.1.2/dist/web/install-button.js?module"
></script>
<script>
var backup_data; //fetch once, filter a copy on demand
var selected_soc = ["ESP8266","ESP32","ESP32-S2","ESP32-S3","ESP32-C3"];
function makeSelector(){
fetch('https://tasmota.github.io/install/manifests_new.json')
.then(response => response.json())
.then(data => {backup_data = data; make_select(data)});
}
function make_select(data){
var sel=document.querySelector("#pick-variant-selector");
// console.log(data);
for (opt_group in data){
var og=document.createElement('optgroup');
og.label = opt_group;
sel.appendChild(og);
// console.log(opt_group,data[opt_group]);
for (fw of data[opt_group]){
// console.log(data[opt_group][fw]);
var opt=document.createElement('option');
opt.label = fw['name'];
opt.value = fw['path'];
opt.title = "Supported chipfamilies:\n"
for (chipFamily of fw['chipFamilies']){
opt.title += chipFamily + "\n";
}
// console.log( opt.value);
og.appendChild(opt);
}
}
}
function makeChipSelector(){
const chipSel = document.querySelector("#selected_chip");
var opt=document.createElement('option');
opt.label = 'All';
opt.value = 'All';
opt.title = "All chipfamilies"
chipSel.appendChild(opt);
for(chip of selected_soc){
opt=document.createElement('option');
opt.label = chip;
opt.value = chip;
chipSel.appendChild(opt);
}
chipSel.addEventListener("change", () => {
handleCB_SOC(chipSel.value);
});
}
window.addEventListener("load", function(event) {
makeChipSelector();
makeSelector();
try{
const button = document.querySelector("esp-web-install-button");
button.overrides = {
checkSameFirmware(manifest, improvInfo) {
const manifestFirmware = manifest.name.toLowerCase();
const deviceFirmware = improvInfo.firmware.toLowerCase();
return manifestFirmware.includes(deviceFirmware);
}
};
console.log(button.shadowRoot.firstChild.name);
if(button.shadowRoot.firstChild.name == 'activate'){
//success: add the select picker and some info
const selectEl = document.querySelector("#pick-variant-selector");
button.manifest = "https://tasmota.github.io/install/manifest_ext/release.tasmota.manifest.json";
selectEl.addEventListener("change", () => {
button.manifest = selectEl.value;
// console.log(button.manifest);
});
}
}
catch(e){
console.log(e);
}
},{ once: true });
function handleCB_SOC(chip) {
if(chip=='All'){
picker_data = backup_data;
}
else{
var picker_data = {};
for(section of Object.entries(backup_data)){
picker_data[section[0]]= [];
for(line of backup_data[section[0]]){
if (line["chipFamilies"].includes(chip)){
picker_data[section[0]].push(line);
}
}
}
}
var sel=document.querySelector("#pick-variant-selector");
sel.innerHTML = '';
make_select(picker_data);
}
</script>
</head>
<body>
<div style='display:inline-block;color:#eaeaea;min-width:340px;'>
<h1>Install Tasmota</h1>
<div class='pick-variant'>
<ol style='text-align:left'>
<li>Connect the ESP device to your computer</br>using USB or serial-to-USB adapter</li></br>
<li>Select the firmware variant suitable for</br>your device</li></br>
<li>Hit "Install" and select the correct port</br>or find help if <a href="https://tasmota.github.io/docs/Getting-Started/" target='_blank' style='color:#aaa;'>no device found</a></li>
</ol>
</br>
</br>
<span>
<select style="width:70%;" id="pick-variant-selector"></select>
<select style="width:25%;" id="selected_chip"></select>
</span>
<p>
</br>
<esp-web-install-button id="inst" style='text-align:center'>
<i slot="unsupported">
Your browser does not support Web Serial.</br>Open this page in Google Chrome or</br>Microsoft Edge instead
<span class="not-supported-i hidden">(but not on your mobile device)</span>.
</i>
</esp-web-install-button>
</p>
</div>
<div style='text-align:right;font-size:11px;'>
<hr/>
<a href="https://esphome.github.io/esp-web-tools/" target='_blank' style='color:#aaa;'>Tasmota Installer inspired by ESP Web Tools</a>
</div>
</div>
</body>
</html>