Add js click handlers for the web UI buttons added in
b1f9c9a6e0a3dce73507e6b60782987ee2459f48 in the esphome repository.
Since this change doesn't make the .js file incompatible with esphome
versions before the referenced commit I guess there's no need to
rename the file to -v2.
There are probably better ways to write those click handlers, for
example we could have a common function to launch the POST request to a
URL that it reads from the button object like this:
var button_onclick = function(evt) {
const xhr = new XMLHttpRequest();
xhr.open("POST", evt.target.onlick_post_url, true);
xhr.send();
};
row.children[2].children[0].addEventListener('click', button_onlick);
row.children[2].children[0].onclick_post_url = '/light/' + id.substr(6) + '/toggle';
The only problem with this is that iirc ``evt.target`` is
browser-specific.