PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.4.5.2
JetFormBuilder — Dynamic Blocks Form Builder v3.4.5.2
3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / assets / build / frontend / media.field.js
jetformbuilder / assets / build / frontend Last commit date
advanced.reporting.asset.php 1 year ago advanced.reporting.js 1 year ago calculated.field.asset.php 1 year ago calculated.field.js 1 year ago conditional.block.asset.php 1 year ago conditional.block.js 1 year ago dynamic.value.asset.php 1 year ago dynamic.value.js 1 year ago main.asset.php 1 year ago main.css 1 year ago main.js 1 year ago media.field.asset.php 1 year ago media.field.js 1 year ago media.field.restrictions.asset.php 1 year ago media.field.restrictions.js 1 year ago multi.step.asset.php 1 year ago multi.step.js 1 year ago
media.field.js
1 lines
1 (()=>{"use strict";function e(e){const t=new DataTransfer;for(const i of e)t.items.add(i);return t.files}function t(e){return"file"===e.type}const{InputData:i}=window.JetFormBuilderAbstract;function r(){i.call(this),this.isMultiple=!1,this.prevFiles=null,this.template=null,this.previewsContainer=null,this.wrapper=null,this.isSupported=function(e){return t(e)},this.addListeners=function(){const[t]=this.nodes;t.addEventListener("change",(t=>{var i;this.value.current=e(this.isMultiple?[...null!==(i=this.prevFiles)&&void 0!==i?i:[],...t.target.files]:[...t.target.files])}))},this.setNode=function(e){i.prototype.setNode.call(this,e),this.isMultiple=e.multiple,this.wrapper=e.closest(".jet-form-builder-file-upload"),this.previewsContainer=this.wrapper.querySelector(".jet-form-builder-file-upload__files"),this.template=this.wrapper.closest(".field-type-media-field").querySelector(".jet-form-builder__preview-template")},this.setValue=function(){this.callable.loadFiles()},this.initNotifyValue=()=>{},this.reQueryValue=()=>{}}r.prototype=Object.create(i.prototype),r.prototype.wrapper=null,r.prototype.previewsContainer=null,r.prototype.template=null;const n=r,{BaseSignal:o}=window.JetFormBuilderAbstract;function l(){o.call(this),this.lock.current=!0,this.isSupported=function(e){return t(e)},this.runSignal=function(){const[t]=this.input.nodes,i=[],{current:r}=this.input.value,n=null!=r?r:[];for(const e of n)i.push(this.getPreview(e));!function(e,t){const i=e.querySelectorAll(".jet-form-builder-file-upload__file");for(const e of i)t.some((t=>t.isEqualNode(e)))||e.remove();for(const i in t){if(!t.hasOwnProperty(i))continue;const r=t[i];r.isConnected||e.appendChild(r)}}(this.input.previewsContainer,i),t.files=e([...n]),this.input.prevFiles=n,this.sortable()}}l.prototype=Object.create(o.prototype),l.prototype.loadFiles=function(){const t=this.input.previewsContainer.querySelectorAll(".jet-form-builder-file-upload__file"),i=[];for(const e of t){this.addRemoveHandler(e);const t=e.dataset.file,r=e.querySelector(".jet-form-builder-file-upload__file-remove"),{fileName:n}=r.dataset;i.push([t,n])}i.length?Promise.allSettled(i.map((([e,t])=>new Promise(((i,r)=>{fetch(e).then((e=>e.blob())).then((e=>i(function(e,t){return new File([e],t,e)}(e,t)))).catch(r)}))))).then((t=>{const i=t.map((({value:e})=>e));this.lock.current=!1,this.input.silenceSet(e(i))})).catch((()=>{this.lock.current=!1})):this.lock.current=!1},l.prototype.sortable=function(){jQuery(this.input.previewsContainer).unbind(),jQuery(this.input.previewsContainer).sortable({items:".jet-form-builder-file-upload__file",forcePlaceholderSize:!0}).bind("sortupdate",(()=>this.onSortCallback()))},l.prototype.onSortCallback=function(){const e=new DataTransfer,[t]=this.input.nodes,i=this.input.previewsContainer.querySelectorAll(".jet-form-builder-file-upload__file-remove");for(const r of i){const{fileName:i}=r.dataset;for(const r of t.files)r.name===i&&e.items.add(r)}this.input.value.current=e.files},l.prototype.addRemoveHandler=function(e){e.querySelector(".jet-form-builder-file-upload__file-remove").addEventListener("click",this.removeFile.bind(this))},l.prototype.getPreview=function(e){const t=this.input.previewsContainer.querySelector(`[data-file-name="${e.name}"]`);if(!t){const t=this.createPreview(e);return this.addRemoveHandler(t),t}return t.closest(".jet-form-builder-file-upload__file")},l.prototype.createPreview=function(e){const t=URL.createObjectURL(e);let{innerHTML:i}=this.input.template;i=i.replace("%file_url%",t),i=i.replace("%file_name%",e.name);const r=document.createElement("template");r.innerHTML=i;const n=r.content.firstChild;if(/^image\//.test(e.type)){const i=document.createElement("img");i.src=t,i.alt=e.name,n.prepend(i)}return n},l.prototype.removeFile=function({target:e}){const t=".jet-form-builder-file-upload__file-remove",{value:i}=this.input;e.matches(t)||(e=e.closest(t));const{fileName:r}=e.dataset,n=new DataTransfer;for(const e of i.current)r!==e.name&&n.items.add(e);i.current=n.files},l.prototype.getFileNode=function(e){const t=`data-file-name="${e}"`;return this.input.previewsContainer.querySelector(`.jet-form-builder-file-upload__file-remove[${t}]`).closest(".jet-form-builder-file-upload__file")};const s=l,{addFilter:a}=JetPlugins.hooks;a("jet.fb.inputs","jet-form-builder/media-field",(function(e){return[n,...e]})),a("jet.fb.signals","jet-form-builder/media-field",(function(e){return[s,...e]}))})();