ECOM-1472: fixed the tab issue for taking photo
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
* Interface for retrieving webcam photos.
|
||||
* Supports HTML5 and Flash.
|
||||
*/
|
||||
var edx = edx || {};
|
||||
var edx = edx || {},
|
||||
key = {
|
||||
enter: 13
|
||||
};
|
||||
|
||||
(function( $, _, Backbone, gettext ) {
|
||||
'use strict';
|
||||
@@ -12,6 +15,7 @@
|
||||
edx.verify_student.WebcamPhotoView = Backbone.View.extend({
|
||||
|
||||
template: "#webcam_photo-tpl",
|
||||
el: "#webcam",
|
||||
|
||||
backends: {
|
||||
"html5": {
|
||||
@@ -241,12 +245,18 @@
|
||||
);
|
||||
$( this.el ).html( renderedHtml );
|
||||
|
||||
var resetBtn = this.$el.find('#webcam_reset_button');
|
||||
var captureBtn = this.$el.find('#webcam_capture_button');
|
||||
|
||||
// Install event handlers
|
||||
$( "#webcam_reset_button", this.el ).on( 'click', _.bind( this.reset, this ) );
|
||||
$( "#webcam_capture_button", this.el ).on( 'click', _.bind( this.capture, this ) );
|
||||
resetBtn.on( 'click', _.bind( this.reset, this ) );
|
||||
captureBtn.on( 'click', _.bind( this.capture, this ) );
|
||||
|
||||
resetBtn.on( 'keyup', _.bind( this.reset_by_enter, this ) );
|
||||
captureBtn.on( 'keyup', _.bind( this.capture_by_enter, this ) );
|
||||
|
||||
// Show the capture button
|
||||
$( "#webcam_capture_button", this.el ).removeClass('is-hidden');
|
||||
captureBtn.removeClass('is-hidden');
|
||||
|
||||
return this;
|
||||
},
|
||||
@@ -266,6 +276,16 @@
|
||||
$( "#webcam_capture_button", this.el ).removeClass('is-hidden');
|
||||
},
|
||||
|
||||
capture_by_enter: function(event){
|
||||
if(event.keyCode == key.enter){
|
||||
this.capture();
|
||||
}
|
||||
},
|
||||
reset_by_enter: function(event){
|
||||
if(event.keyCode == key.enter){
|
||||
this.reset();
|
||||
}
|
||||
},
|
||||
capture: function() {
|
||||
// Take a snapshot of the video
|
||||
var success = this.backend.snapshot();
|
||||
|
||||
Reference in New Issue
Block a user