Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
147
Merge Requests
147
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
8c0ebd93
Commit
8c0ebd93
authored
Sep 23, 2019
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: stop using addEventListener and alert
Use onEvent instead of addEventListener
parent
dd04c06e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
18 deletions
+13
-18
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/gadget_document_scanner.js.js
...skins/erp5_document_scanner/gadget_document_scanner.js.js
+13
-18
No files found.
erp5_document_scanner/SkinTemplateItem/portal_skins/erp5_document_scanner/gadget_document_scanner.js.js
View file @
8c0ebd93
/*jslint indent: 2 */
/*global rJS, RSVP, window, document, navigator, Cropper,
alert
, FileReader, jIO */
(
function
(
rJS
,
RSVP
,
window
,
document
,
navigator
,
Cropper
,
alert
,
FileReader
,
jIO
)
{
/*global rJS, RSVP, window, document, navigator, Cropper,
console
, FileReader, jIO */
(
function
(
rJS
,
RSVP
,
window
,
document
,
navigator
,
Cropper
,
console
,
FileReader
,
jIO
)
{
"
use strict
"
;
var
imageWidth
,
...
...
@@ -141,17 +141,6 @@
imageHeight
=
photoCapabilities
.
imageHeight
.
max
;
document
.
querySelector
(
"
textarea[name='field_your_description']
"
).
value
=
"
Max =>
"
+
imageWidth
+
"
x
"
+
imageHeight
;
video
.
play
();
})
.
push
(
function
()
{
/*
XXX remove addEventListener. Instead, use renderJS declareService / onEvent,
which will handle unloading the listener and correctly catching errors
Remove soon
*/
startbutton
.
addEventListener
(
"
click
"
,
function
(
evt
)
{
evt
.
preventDefault
();
takePicture
(
gadget
);
},
false
);
});
}
...
...
@@ -216,16 +205,22 @@
return
startup
(
root
,
evt
.
target
.
value
);
}
});
})
.
then
(
undefined
,
function
(
e
)
{
alert
(
e
);
});
})
.
declareMethod
(
'
getContent
'
,
function
()
{
var
input
=
this
.
element
.
querySelector
(
'
.photoInput
'
),
result
=
{};
result
.
field_your_document_scanner_gadget
=
input
.
value
;
return
result
;
});
})
.
onEvent
(
"
click
"
,
function
(
evt
)
{
if
(
evt
.
target
.
className
==
"
startbutton
"
)
{
return
this
.
getElement
()
.
push
(
function
(
gadget
)
{
return
takePicture
(
gadget
);
});
}
},
false
,
true
);
}(
rJS
,
RSVP
,
window
,
document
,
navigator
,
Cropper
,
alert
,
FileReader
,
jIO
));
\ No newline at end of file
}(
rJS
,
RSVP
,
window
,
document
,
navigator
,
Cropper
,
console
,
FileReader
,
jIO
));
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment