1 |
- !function(e){function a(a){for(var n,o,s=a[0],l=a[1],d=a[2],c=0,f=[];c<s.length;c++)o=s[c],r[o]&&f.push(r[o][0]),r[o]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(u&&u(a);f.length;)f.shift()();return i.push.apply(i,d||[]),t()}function t(){for(var e,a=0;a<i.length;a++){for(var t=i[a],n=!0,s=1;s<t.length;s++){var l=t[s];0!==r[l]&&(n=!1)}n&&(i.splice(a--,1),e=o(o.s=t[0]))}return e}var n={},r={0:0},i=[];function o(a){if(n[a])return n[a].exports;var t=n[a]={i:a,l:!1,exports:{}};return e[a].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=e,o.c=n,o.d=function(e,a,t){o.o(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:t})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,a){if(1&a&&(e=o(e)),8&a)return e;if(4&a&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(o.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&a&&"string"!=typeof e)for(var n in e)o.d(t,n,function(a){return e[a]}.bind(null,n));return t},o.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(a,"a",a),a},o.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},o.p="";var s=window.webpackJsonp=window.webpackJsonp||[],l=s.push.bind(s);s.push=a,s=s.slice();for(var d=0;d<s.length;d++)a(s[d]);var u=l;i.push([2,1]),t()}([function(e,a){e.exports=jQuery},function(e,a){e.exports=GravForm},function(e,a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.Instances=void 0;var n,r=t(3),i=(n=r)&&n.__esModule?n:{default:n};t(11),a.Instances=i.default},function(e,a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var n=i(t(4)),r=i(t(9));function i(e){return e&&e.__esModule?e:{default:e}}a.default={FileInstances:n.default,ArrayInstances:r.default}},function(e,a,t){"use strict";(function(e){Object.defineProperty(a,"__esModule",{value:!0}),a.Instances=void 0;var n=function(){function e(e,a){for(var t=0;t<a.length;t++){var n=a[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(a,t,n){return t&&e(a.prototype,t),n&&e(a,n),a}}();a.UriToMarkdown=function(e){return(e=(e=(e=e.replace(/@3x|@2x|@1x/,"")).replace(/\(/g,"%28")).replace(/\)/g,"%29")).match(/\.(jpe?g|png|gif|svg)$/i)?"![]("+e+")":"["+decodeURI(e)+"]("+e+")"};var r=l(t(0)),i=l(t(6)),o=l(t(8)),s=t(1);function l(e){return e&&e.__esModule?e:{default:e}}var d={dictCancelUpload:s.translations.PLUGIN_FORM.DROPZONE_CANCEL_UPLOAD,dictCancelUploadConfirmation:s.translations.PLUGIN_FORM.DROPZONE_CANCEL_UPLOAD_CONFIRMATION,dictDefaultMessage:s.translations.PLUGIN_FORM.DROPZONE_DEFAULT_MESSAGE,dictFallbackMessage:s.translations.PLUGIN_FORM.DROPZONE_FALLBACK_MESSAGE,dictFallbackText:s.translations.PLUGIN_FORM.DROPZONE_FALLBACK_TEXT,dictFileTooBig:s.translations.PLUGIN_FORM.DROPZONE_FILE_TOO_BIG,dictInvalidFileType:s.translations.PLUGIN_FORM.DROPZONE_INVALID_FILE_TYPE,dictMaxFilesExceeded:s.translations.PLUGIN_FORM.DROPZONE_MAX_FILES_EXCEEDED,dictRemoveFile:s.translations.PLUGIN_FORM.DROPZONE_REMOVE_FILE,dictRemoveFileConfirmation:s.translations.PLUGIN_FORM.DROPZONE_REMOVE_FILE_CONFIRMATION,dictResponseError:s.translations.PLUGIN_FORM.DROPZONE_RESPONSE_ERROR};i.default.autoDiscover=!1;var u={createImageThumbnails:{thumbnailWidth:150},addRemoveLinks:!1,dictDefaultMessage:d.dictDefaultMessage,dictRemoveFileConfirmation:d.dictRemoveFileConfirmation,previewTemplate:""};window.EXIF=o.default;var c=function(){function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.container,n=void 0===t?".dropzone.files-upload":t,o=e.options,l=void 0===o?{}:o;!function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,a),this.container=(0,r.default)(n),this.container.length&&(this.urls={},u.previewTemplate=(0,r.default)("#dropzone-template").html(),this.options=Object.assign({},d,u,{klass:this,url:this.container.data("file-url-add")||s.config.current_url,acceptedFiles:this.container.data("media-types"),init:this.initDropzone},this.container.data("dropzone-options"),l),this.dropzone=new i.default(n,this.options),this.dropzone.on("complete",this.onDropzoneComplete.bind(this)),this.dropzone.on("success",this.onDropzoneSuccess.bind(this)),this.dropzone.on("removedfile",this.onDropzoneRemovedFile.bind(this)),this.dropzone.on("sending",this.onDropzoneSending.bind(this)),this.dropzone.on("error",this.onDropzoneError.bind(this)))}return n(a,[{key:"initDropzone",value:function(){var e=this,a=this.options.klass.container.find("[data-file]"),t=this;a.length&&a.each(function(a,n){var o=(n=(0,r.default)(n)).data("file"),s={name:o.name,size:o.size,type:o.type,status:i.default.ADDED,accepted:!0,url:e.options.url,removeUrl:o.remove};t.files.push(s),t.options.addedfile.call(t,s),s.type.match(/^image\//)&&t.options.thumbnail.call(t,s,o.path),n.remove()})}},{key:"getURI",value:function(){return this.container.data("mediaUri")||""}},{key:"onDropzoneSending",value:function(e,a,t){t.append("__form-name__",this.container.closest("form").find('[name="__form-name__"]').val()),t.append("__form-file-uploader__",1),t.append("name",this.options.dotNotation),t.append("form-nonce",s.config.form_nonce),t.append("task","filesupload"),t.append("uri",this.getURI())}},{key:"onDropzoneSuccess",value:function(a,t,n){if(this.options.reloadPage&&e.location.reload(),t.session){a.sessionParams=t.session,a.removeUrl=this.options.url;var r=this.container.find('[name][type="hidden"]'),i=r.val();r.val(i+" ")}return this.handleError({file:a,data:t,mode:"removeFile",msg:"<p>"+s.translations.PLUGIN_FORM.FILE_ERROR_UPLOAD+" <strong>"+a.name+"</strong></p>\n <pre>"+t.message+"</pre>"})}},{key:"onDropzoneComplete",value:function(a){if(!a.accepted&&!a.rejected){var t={status:"error",message:s.translations.PLUGIN_FORM.FILE_UNSUPPORTED+": "+a.name.match(/\..+/).join("")};return this.handleError({file:a,data:t,mode:"removeFile",msg:"<p>"+s.translations.PLUGIN_FORM.FILE_ERROR_ADD+" <strong>"+a.name+"</strong></p>\n <pre>"+t.message+"</pre>"})}this.options.reloadPage&&e.location.reload()}},{key:"onDropzoneRemovedFile",value:function(a){var t=this;if(a.accepted&&!a.rejected){var n=a.removeUrl||this.urls.delete||location.href+".json",i=(n||"").match(/path:(.*)\//),o=new FormData;o.append("filename",a.name),o.append("__form-name__",this.container.closest("form").find('[name="__form-name__"]').val()),o.append("name",this.options.dotNotation),o.append("form-nonce",s.config.form_nonce),o.append("uri",this.getURI()),a.sessionParams&&(o.append("__form-file-remover__","1"),o.append("session",a.sessionParams)),r.default.ajax({url:n,data:o,method:"POST",contentType:!1,processData:!1,success:function(){if(i){i=e.atob(i[1]);var a=t.container.find('[name][type="hidden"]'),n=JSON.parse(a.val()||"{}");delete n[i],a.val(JSON.stringify(n))}}})}}},{key:"onDropzoneError",value:function(e,a,t){var n=t&&a.error?a.error.message:a;return(0,r.default)(e.previewElement).find("[data-dz-errormessage]").html(n),this.handleError({file:e,data:{status:"error"},msg:"<pre>"+n+"</pre>"})}},{key:"handleError",value:function(e){return!0}}]),a}();a.default=c;var f=[],p=(0,r.default)(),v=function(e,a){var t=(0,r.default)(a).find(".dropzone.files-upload");t.length&&t.each(function(e,a){a=(0,r.default)(a),~p.index(a)||h(a)})},h=function(e){var a=(e=(0,r.default)(e)).find('input[type="file"]'),t=e.data("grav-file-settings")||{};t.accept&&~t.accept.indexOf("*")&&(t.accept=[""]);var n={url:e.data("file-url-add")||(e.closest("form").attr("action")||s.config.current_url)+".json",paramName:t.paramName||"file",dotNotation:t.name||"file",acceptedFiles:t.accept?t.accept.join(","):a.attr("accept")||e.data("media-types"),maxFilesize:t.filesize||256,maxFiles:t.limit||null,resizeWidth:t.resizeWidth||null,resizeHeight:t.resizeHeight||null,resizeQuality:t.resizeQuality||null,accept:function(e,a){var n=t.resolution;if(!n)return a();setTimeout(function(){var r="";return n.min&&Object.keys(n.min).forEach(function(a){e[a]<n.min[a]&&(r+=s.translations.PLUGIN_FORM.RESOLUTION_MIN.replace(/{{attr}}/g,a).replace(/{{min}}/g,n.min[a]))}),t.resizeWidth||t.resizeHeight||n.max&&Object.keys(n.max).forEach(function(a){e[a]>n.max[a]&&(r+=s.translations.PLUGIN_FORM.RESOLUTION_MAX.replace(/{{attr}}/g,a).replace(/{{max}}/g,n.max[a]))}),a(r)},50)}};p=p.add(e),e=e[0],f.push(new c({container:e,options:n}))};a.Instances=((0,r.default)(".dropzone.files-upload").each(function(e,a){return h(a)}),(0,r.default)("body").on("mutation._grav",v),f)}).call(this,t(5))},,,,,function(e,a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.Instance=void 0;var n=function(){function e(e,a){for(var t=0;t<a.length;t++){var n=a[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(a,t,n){return t&&e(a.prototype,t),n&&e(a,n),a}}(),r=o(t(0)),i=o(t(10));function o(e){return e&&e.__esModule?e:{default:e}}function s(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}var l=(0,r.default)("body"),d=function(){function e(a){s(this,e),this.container=(0,r.default)(a),void 0===this.getName()&&(this.container=this.container.closest("[data-grav-array-name]"))}return n(e,[{key:"getName",value:function(){return this.container.data("grav-array-name")||""}},{key:"getKeyPlaceholder",value:function(){return this.container.data("grav-array-keyname")||"Key"}},{key:"getValuePlaceholder",value:function(){return this.container.data("grav-array-valuename")||"Value"}},{key:"isValueOnly",value:function(){return this.container.find('[data-grav-array-mode="value_only"]:first').length||!1}},{key:"isTextArea",value:function(){return this.container.data("grav-array-textarea")||!1}},{key:"shouldBeDisabled",value:function(){var e=this.container.closest(".form-field").find('[data-grav-field="toggleable"] input[type="checkbox"]');return e.length&&e.is(":not(:checked)")}},{key:"getNewRow",value:function(){var e="",a=this.isTextArea()?"<textarea "+(this.shouldBeDisabled()?'disabled="disabled"':"")+' data-grav-array-type="value" name="" placeholder="'+this.getValuePlaceholder()+'"></textarea>':"<input "+(this.shouldBeDisabled()?'disabled="disabled"':"")+' data-grav-array-type="value" type="text" name="" value="" placeholder="'+this.getValuePlaceholder()+'" />';return this.isValueOnly()?e+='\n <div class="form-row array-field-value_only" data-grav-array-type="row">\n <span data-grav-array-action="sort" class="fa fa-bars"></span>\n '+a+"\n ":e+='\n <div class="form-row" data-grav-array-type="row">\n <span data-grav-array-action="sort" class="fa fa-bars"></span>\n <input '+(this.shouldBeDisabled()?'disabled="disabled"':"")+' data-grav-array-type="key" type="text" value="" placeholder="'+this.getKeyPlaceholder()+'" />\n '+a+"\n ",e+='\n <span data-grav-array-action="rem" class="fa fa-minus"></span>\n <span data-grav-array-action="add" class="fa fa-plus"></span>\n </div>'}}]),e}(),u=function(){function e(){var a=this;s(this,e),l.on("input",'[data-grav-array-type="key"], [data-grav-array-type="value"]',function(e){return a.actionInput(e)}),l.on("click touch",'[data-grav-array-action]:not([data-grav-array-action="sort"])',function(e){return a.actionEvent(e)}),this.arrays=(0,r.default)(),(0,r.default)('[data-grav-field="array"]').each(function(e,t){return a.addArray(t)}),(0,r.default)("body").on("mutation._grav",this._onAddedNodes.bind(this))}return n(e,[{key:"addArray",value:function(e){(e=(0,r.default)(e)).find('[data-grav-array-type="container"]').each(function(e,a){(a=(0,r.default)(a)).data("array-sort")||a[0].hasAttribute("data-array-nosort")||a.data("array-sort",new i.default(a.get(0),{handle:".fa-bars",animation:150}))})}},{key:"actionInput",value:function(e){var a=(0,r.default)(e.target),t=a.data("grav-array-type");this._setTemplate(a);var n=a.data("array-template"),i="key"===t?a:a.siblings('[data-grav-array-type="key"]:first'),o="value"===t?a:a.siblings('[data-grav-array-type="value"]:first'),s=n.isValueOnly()?this.getIndexFor(a):i.val();s=s.toString().replace(/\[/g,"%5B").replace(/]/g,"%5D");var l=n.getName()+"["+s+"]";o.attr("name",o.val()?l:n.getName()),this.refreshNames(n)}},{key:"actionEvent",value:function(e){e&&e.preventDefault();var a=(0,r.default)(e.target),t=a.data("grav-array-action"),n=a.parents('[data-grav-array-type="container"]');this._setTemplate(a),this[t+"Action"](a),n[n.find("> div").length>1?"removeClass":"addClass"]("one-child")}},{key:"addAction",value:function(e){var a=e.data("array-template");e.closest('[data-grav-array-type="row"]').after(a.getNewRow())}},{key:"remAction",value:function(e){var a=e.data("array-template"),t=e.closest('[data-grav-array-type="row"]');if(!t.siblings().length){var n=(0,r.default)(a.getNewRow());t.after(n),n.find('[data-grav-array-type="value"]:last').attr("name",a.getName())}t.remove(),this.refreshNames(a)}},{key:"refreshNames",value:function(e){if(e.isValueOnly()){var a=e.container.find('> div > [data-grav-array-type="row"]'),t=a.find('[name]:not([name=""])');t.each(function(e,a){var t=(a=(0,r.default)(a)).attr("name");t=t.replace(/\[\d+\]$/,"["+e+"]"),a.attr("name",t)}),t.length||a.find('[data-grav-array-type="value"]').attr("name",e.getName())}}},{key:"getIndexFor",value:function(e){var a=e.data("array-template"),t=e.closest('[data-grav-array-type="row"]');return a.container.find((a.isValueOnly()?"> div ":"")+' > [data-grav-array-type="row"]').index(t)}},{key:"_setTemplate",value:function(e){e.data("array-template")||e.data("array-template",new d(e.closest("[data-grav-array-name]")))}},{key:"_onAddedNodes",value:function(e,a){var t=this,n=(0,r.default)(a).find('[data-grav-field="array"]');n.length&&n.each(function(e,a){a=(0,r.default)(a),~t.arrays.index(a)||t.addArray(a)})}}]),e}();a.default=u;a.Instance=new u},,function(e,a,t){"use strict";var n,r=t(0),i=(n=r)&&n.__esModule?n:{default:n},o=t(1);if((0,i.default)("[data-grav-keepalive]").length){var s=o.config.session_timeout/1.5*1e3;setInterval(function(){i.default.ajax({url:o.config.base_url_relative+"/task"+o.config.param_sep+"keep-alive"})},s)}}]);
|