abchospitality/wp-includes/js/jquery/jquery.form.min.js

1 line
16 KiB
JavaScript
Raw Normal View History

2024-04-18 09:47:23 +00:00
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),a(t),t}:a(jQuery)}(function(O){"use strict";var d=/\r?\n/g,h={},X=(h.fileapi=void 0!==O('<input type="file">').get(0).files,h.formdata=void 0!==window.FormData,!!O.fn.prop);function o(e){var t=e.data;e.isDefaultPrevented()||(e.preventDefault(),O(e.target).closest("form").ajaxSubmit(t))}function i(e){var t=e.target,a=O(t);if(!a.is("[type=submit],[type=image]")){var r=a.closest("[type=submit]");if(0===r.length)return;t=r[0]}var n=t.form;"image"===(n.clk=t).type&&(void 0!==e.offsetX?(n.clk_x=e.offsetX,n.clk_y=e.offsetY):"function"==typeof O.fn.offset?(r=a.offset(),n.clk_x=e.pageX-r.left,n.clk_y=e.pageY-r.top):(n.clk_x=e.pageX-t.offsetLeft,n.clk_y=e.pageY-t.offsetTop)),setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}function C(){var e;O.fn.ajaxSubmit.debug&&(e="[jquery.form] "+Array.prototype.join.call(arguments,""),window.console&&window.console.log?window.console.log(e):window.opera&&window.opera.postError&&window.opera.postError(e))}O.fn.attr2=function(){var e;return X&&((e=this.prop.apply(this,arguments))&&e.jquery||"string"==typeof e)?e:this.attr.apply(this,arguments)},O.fn.ajaxSubmit=function(F,e,t,a){if(this.length){var E,L=this,e=("function"==typeof F?F={success:F}:"string"==typeof F||!1===F&&0<arguments.length?(F={url:F,data:e,dataType:t},"function"==typeof a&&(F.success=a)):void 0===F&&(F={}),E=F.method||F.type||this.attr2("method"),t=(t=(t="string"==typeof(e=F.url||this.attr2("action"))?O.trim(e):"")||window.location.href||"")&&(t.match(/^([^#]+)/)||[])[1],a=/(MSIE|Trident)/.test(navigator.userAgent||"")&&/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",F=O.extend(!0,{url:t,success:O.ajaxSettings.success,type:E||O.ajaxSettings.type,iframeSrc:a},F),{});if(this.trigger("form-pre-serialize",[this,F,e]),e.veto)C("ajaxSubmit: submit vetoed via form-pre-serialize trigger");else if(F.beforeSerialize&&!1===F.beforeSerialize(this,F))C("ajaxSubmit: submit aborted via beforeSerialize callback");else{var t=F.traditional,M=(void 0===t&&(t=O.ajaxSettings.traditional),[]),r=this.formToArray(F.semantic,M,F.filtering);if(F.data&&(a=O.isFunction(F.data)?F.data(r):F.data,F.extraData=a,l=O.param(a,t)),F.beforeSubmit&&!1===F.beforeSubmit(r,this,F))C("ajaxSubmit: submit aborted via beforeSubmit callback");else if(this.trigger("form-submit-validate",[r,this,F,e]),e.veto)C("ajaxSubmit: submit vetoed via form-submit-validate trigger");else{var o,n,i,a=O.param(r,t),s=(l&&(a=a?a+"&"+l:l),"GET"===F.type.toUpperCase()?(F.url+=(0<=F.url.indexOf("?")?"&":"?")+a,F.data=null):F.data=a,[]);F.resetForm&&s.push(function(){L.resetForm()}),F.clearForm&&s.push(function(){L.clearForm(F.includeHidden)}),!F.dataType&&F.target?(o=F.success||function(){},s.push(function(e,t,a){var r=arguments,n=F.replaceTarget?"replaceWith":"html";O(F.target)[n](e).each(function(){o.apply(this,r)})})):F.success&&(O.isArray(F.success)?O.merge(s,F.success):s.push(F.success)),F.success=function(e,t,a){for(var r=F.context||this,n=0,o=s.length;n<o;n++)s[n].apply(r,[e,t,a||L,L])},F.error&&(n=F.error,F.error=function(e,t,a){var r=F.context||this;n.apply(r,[e,t,a,L])}),F.complete&&(i=F.complete,F.complete=function(e,t){var a=F.context||this;i.apply(a,[e,t,L])});var c,e=0<O("input[type=file]:enabled",this).filter(function(){return""!==O(this).val()}).length,t="multipart/form-data",l=L.attr("enctype")===t||L.attr("encoding")===t,a=h.fileapi&&h.formdata;C("fileAPI :"+a),!1!==F.iframe&&(F.iframe||(e||l)&&!a)?F.closeKeepAlive?O.get(F.closeKeepAlive,function(){c=f(r)}):c=f(r):c=(e||l)&&a?function(e){for(var a=new FormData,t=0;t<e.length;t++)a.append(e[t].name,e[t].value);if(F.extraData){var r=function(e){var t,a,r=O.param(e,F.traditional).split("&"),n=r.length,o=[];for(t=0;t<n;t++)r[t]=r[t].replace(/\+/g," "),a=r[t].split("="),o.push([decodeURIComponent(a[0]),decodeURIComponent(a[1])]);return o}(F.extraData);for(t=0;t<r.length;t+