Commit a3c78a4d authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: use onEvent instead of addEventListener

parent e5e70990
...@@ -173,18 +173,7 @@ ...@@ -173,18 +173,7 @@
selector.appendChild(el); selector.appendChild(el);
} }
} }
})
.push(function () {
selector.addEventListener("change", function (evt) {
if (video) {
video.pause();
}
if (evt.target.value) {
return startup(root, evt.target.value);
}
});
}); });
}) })
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
var input = this.element.querySelector('.photoInput'), var input = this.element.querySelector('.photoInput'),
...@@ -192,6 +181,20 @@ ...@@ -192,6 +181,20 @@
result.field_your_document_scanner_gadget = input.value; result.field_your_document_scanner_gadget = input.value;
return result; return result;
}) })
.onEvent("change", function (evt) {
if (evt.target.type == "select-one") {
return this.getElement()
.push(function (root) {
if (video) {
video.pause();
}
if (evt.target.value) {
return startup(root, evt.target.value);
}
});
}
}, false, true)
.onEvent("click", function (evt) { .onEvent("click", function (evt) {
var canvasData; var canvasData;
if (evt.target.className == "startbutton") { if (evt.target.className == "startbutton") {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment