2 lines
5.4 KiB
JavaScript
2 lines
5.4 KiB
JavaScript
(()=>{"use strict";$(document).ready((function(){const e=0,a=2;function i(){$.get(OC.generateUrl("/apps/facerecognition/process")).done((function(e){if(e.status){var a="";if(e.processedImages==e.totalImages)a=t("facerecognition","The analysis is finished"),a+=" - ",a+=n("facerecognition","%n image was analyzed","%n images were analyzed",e.totalImages);else{var i=e.totalImages-e.processedImages,s=Date.now()+1e3*e.estimatedFinalize;a=t("facerecognition","Analyzing images"),a+=" - ",a+=n("facerecognition","%n image detected","%n images detected",e.totalImages),a+=" - ",a+=n("facerecognition","%n image in queue","%n images in queue",i),a+=" - ",a+=t("facerecognition","Ends approximately {estimatedFinalize}",{estimatedFinalize:OC.Util.relativeModifiedDate(s)})}$("#progress-text").html(a),$("#progress-bar").attr("value",e.processedImages),$("#progress-bar").attr("max",e.totalImages)}else{$("#progress-bar").attr("value",0);a=t("facerecognition","The analysis is not started yet");a+=" - ",a+=n("facerecognition","%n image in queue","%n images in queue",e.totalImages),$("#progress-text").html(a)}}))}function s(){$.ajax({type:"GET",url:OC.generateUrl("apps/facerecognition/getappvalue"),data:{type:"analysis_image_area"},success:function(a){if(a.status===e){var n=parseInt(a.value);$("#image-area-range").val(n),$("#image-area-value").html(l(n))}}})}function o(){$.ajax({type:"GET",url:OC.generateUrl("apps/facerecognition/getappvalue"),data:{type:"sensitivity"},success:function(a){if(a.status===e){var n=parseFloat(a.value);$("#sensitivity-range").val(n),$("#sensitivity-value").html(n)}}})}function r(){$.ajax({type:"GET",url:OC.generateUrl("apps/facerecognition/getappvalue"),data:{type:"min_confidence"},success:function(a){if(a.status===e){var n=parseFloat(a.value);$("#min-confidence-range").val(n),$("#min-confidence-value").html(n)}}})}function c(){$.ajax({type:"GET",url:OC.generateUrl("apps/facerecognition/getappvalue"),data:{type:"min_faces_in_cluster"},success:function(a){if(a.status===e){var n=parseInt(a.value);$("#min-no-faces-range").val(n),$("#min-no-faces-value").html(n)}}})}function l(e){var a=Math.sqrt(4*e/3),n=3*a/4;return Math.floor(a)+"x"+Math.floor(n)+" (4x3)"}$("#image-area-range").on("input",(function(){$("#image-area-value").html(l(this.value)),$("#restore-image-area").show(),$("#save-image-area").show()})),$("#restore-image-area").on("click",(function(e){e.preventDefault(),s(),$("#restore-image-area").hide(),$("#save-image-area").hide()})),$("#save-image-area").on("click",(function(e){e.preventDefault();var n=$("#image-area-range").val().toString();$.ajax({type:"POST",url:OC.generateUrl("apps/facerecognition/setappvalue"),data:{type:"analysis_image_area",value:n},success:function(e){if(e.status===a)OC.Notification.showTemporary(t("facerecognition","The changes were saved. It will be taken into account in the next analysis.")),$("#restore-image-area").hide(),$("#save-image-area").hide();else{var n=parseInt(e.value);$("#image-area-range").val(n),$("#image-area-value").html(l(n));var i=t("facerecognition","The change could not be applied.");i+=" - "+e.message,OC.Notification.showTemporary(i)}}})})),$("#sensitivity-range").on("input",(function(){$("#sensitivity-value").html(this.value),$("#restore-sensitivity").show(),$("#save-sensitivity").show()})),$("#restore-sensitivity").on("click",(function(e){e.preventDefault(),o(),$("#restore-sensitivity").hide(),$("#save-sensitivity").hide()})),$("#save-sensitivity").on("click",(function(e){e.preventDefault();var n=$("#sensitivity-range").val().toString();$.ajax({type:"POST",url:OC.generateUrl("apps/facerecognition/setappvalue"),data:{type:"sensitivity",value:n},success:function(e){e.status===a&&(OC.Notification.showTemporary(t("facerecognition","The changes were saved. It will be taken into account in the next analysis.")),$("#restore-sensitivity").hide(),$("#save-sensitivity").hide())}})})),$("#min-confidence-range").on("input",(function(){$("#min-confidence-value").html(this.value),$("#restore-min-confidence").show(),$("#save-min-confidence").show()})),$("#restore-min-confidence").on("click",(function(e){e.preventDefault(),r(),$("#restore-min-confidence").hide(),$("#save-min-confidence").hide()})),$("#save-min-confidence").on("click",(function(e){e.preventDefault();var n=$("#min-confidence-range").val().toString();$.ajax({type:"POST",url:OC.generateUrl("apps/facerecognition/setappvalue"),data:{type:"min_confidence",value:n},success:function(e){e.status===a&&(OC.Notification.showTemporary(t("facerecognition","The changes were saved. It will be taken into account in the next analysis.")),$("#restore-min-confidence").hide(),$("#save-min-confidence").hide())}})})),$("#min-no-faces-range").on("input",(function(){$("#min-no-faces-value").html(this.value),$("#restore-min-no-faces").show(),$("#save-min-no-faces").show()})),$("#restore-min-no-faces").on("click",(function(e){e.preventDefault(),c(),$("#restore-min-no-faces").hide(),$("#save-min-no-faces").hide()})),$("#save-min-no-faces").on("click",(function(e){e.preventDefault();var n=$("#min-no-faces-range").val().toString();$.ajax({type:"POST",url:OC.generateUrl("apps/facerecognition/setappvalue"),data:{type:"min_faces_in_cluster",value:n},success:function(e){e.status===a&&(OC.Notification.showTemporary(t("facerecognition","Done")),$("#restore-min-no-faces").hide(),$("#save-min-no-faces").hide())}})})),s(),o(),r(),c(),i(),window.setInterval(i,5e3)}))})();
|
|
//# sourceMappingURL=facerecognition-admin.js.map?v=7c6e1b844b240ad8d11a
|