+ let thumbpreview = document.getElementById('thumbpreview');
+ if (thumbpreview && imgpreview) {
+ thumbpreview.onclick = e => {
+ let imgselect = imgpreview; /* TODO clone */
+ imgselect.hidden = false;
+ imgselect.classList.add('popup');
+ imgselect.onmousemove = e => {
+ let border = imgselect.getBoundingClientRect();
+ let pos = [
+ Math.round(1000 * (e.clientX - border.x) / border.width),
+ Math.round(1000 * (e.clientY - border.y) / border.height)
+ ];
+ return pos;
+ };
+ imgselect.onclick = e => {
+ let imgoption = document.getElementById('thumb');
+ imgoption.value += (imgoption.value && '-') + imgselect.onmousemove(e);
+ imgselect.hidden = true;
+ imgselect.classList.remove('popup');
+ };
+ };
+ }
+