mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[MIG] web_widget_image_webcam from v13 to v14
Update webcam.js from 1.0.25 to 1.0.26 Fix URLs in readme/CONFIGURE.rst Minor pre-commit reformatting in JS code
This commit is contained in:
committed by
Sylvain LE GAL
parent
4829683f09
commit
d073d7e048
@@ -2,7 +2,7 @@
|
||||
Copyright 2016 Siddharth Bhalgami <siddharth.bhalgami@gmail.com>
|
||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
*/
|
||||
odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
odoo.define("web_widget_image_webcam.webcam_widget", function (require) {
|
||||
"use strict";
|
||||
|
||||
var core = require("web.core");
|
||||
@@ -14,7 +14,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
var QWeb = core.qweb;
|
||||
|
||||
FieldBinaryImage.include({
|
||||
_render: function() {
|
||||
_render: function () {
|
||||
this._super();
|
||||
|
||||
var self = this,
|
||||
@@ -38,7 +38,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
rpc.query({
|
||||
model: "ir.config_parameter",
|
||||
method: "get_webcam_flash_fallback_mode_config",
|
||||
}).then(function(default_flash_fallback_mode) {
|
||||
}).then(function (default_flash_fallback_mode) {
|
||||
if (default_flash_fallback_mode == 1) {
|
||||
Webcam.set({
|
||||
/*
|
||||
@@ -53,7 +53,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
self.$el
|
||||
.find(".o_form_binary_file_web_cam")
|
||||
.off()
|
||||
.on("click", function() {
|
||||
.on("click", function () {
|
||||
// Init Webcam
|
||||
var dialog = new Dialog(self, {
|
||||
size: "large",
|
||||
@@ -64,8 +64,8 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
{
|
||||
text: _t("Take Snapshot"),
|
||||
classes: "btn-primary take_snap_btn",
|
||||
click: function() {
|
||||
Webcam.snap(function(data) {
|
||||
click: function () {
|
||||
Webcam.snap(function (data) {
|
||||
img_data = data;
|
||||
// Display Snap besides Live WebCam Preview
|
||||
WebCamDialog.find("#webcam_result").html(
|
||||
@@ -82,7 +82,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
text: _t("Save & Close"),
|
||||
classes: "btn-primary save_close_btn",
|
||||
close: true,
|
||||
click: function() {
|
||||
click: function () {
|
||||
var img_data_base64 = img_data.split(",")[1];
|
||||
|
||||
/*
|
||||
@@ -119,7 +119,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
],
|
||||
}).open();
|
||||
|
||||
dialog.opened().then(function() {
|
||||
dialog.opened().then(function () {
|
||||
Webcam.attach("#live_webcam");
|
||||
|
||||
// At time of Init "Save & Close" button is disabled
|
||||
@@ -135,7 +135,7 @@ odoo.define("web_widget_image_webcam.webcam_widget", function(require) {
|
||||
});
|
||||
|
||||
Dialog.include({
|
||||
destroy: function() {
|
||||
destroy: function () {
|
||||
// Shut Down the Live Camera Preview | Reset the System
|
||||
Webcam.reset();
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// WebcamJS v1.0.25
|
||||
// WebcamJS v1.0.26
|
||||
// Webcam library for capturing JPEG/PNG images in JavaScript
|
||||
// Attempts getUserMedia, falls back to Flash
|
||||
// Author: Joseph Huckaby: http://github.com/jhuckaby
|
||||
// Based on JPEGCam: http://code.google.com/p/jpegcam/
|
||||
// Copyright (c) 2012 - 2017 Joseph Huckaby
|
||||
// Copyright (c) 2012 - 2019 Joseph Huckaby
|
||||
// Licensed under the MIT License
|
||||
|
||||
(function(window) {
|
||||
@@ -34,7 +34,7 @@ FlashError.prototype = new IntermediateInheritor();
|
||||
WebcamError.prototype = new IntermediateInheritor();
|
||||
|
||||
var Webcam = {
|
||||
version: '1.0.25',
|
||||
version: '1.0.26',
|
||||
|
||||
// globals
|
||||
protocol: location.protocol.match(/https/i) ? 'https' : 'http',
|
||||
@@ -92,10 +92,6 @@ var Webcam = {
|
||||
window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL;
|
||||
this.userMedia = this.userMedia && !!this.mediaDevices && !!window.URL;
|
||||
|
||||
if (this.iOS) {
|
||||
this.userMedia = null;
|
||||
}
|
||||
|
||||
// Older versions of firefox (< 21) apparently claim support but user media does not actually work
|
||||
if (navigator.userAgent.match(/Firefox\D+(\d+)/)) {
|
||||
if (parseInt(RegExp.$1, 10) < 21) this.userMedia = null;
|
||||
@@ -274,6 +270,7 @@ var Webcam = {
|
||||
// setup webcam video container
|
||||
var video = document.createElement('video');
|
||||
video.setAttribute('autoplay', 'autoplay');
|
||||
video.setAttribute('playsinline', 'playsinline');
|
||||
video.style.width = '' + this.params.dest_width + 'px';
|
||||
video.style.height = '' + this.params.dest_height + 'px';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user