web/static-dist/libs/jquery-form.js
(开头部分) 14KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
!function(e){function t(a){if(r[a])return r[a].exports;var n=r[a]={exports:{},id:a,loaded:!1};return e[a].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="/static-dist/",t(0)}({"84d5deae17924a3a8dae":function(e,t){var r=!1;(function(){!function(e){"use strict";"function"==typeof r&&r.amd?r(["jquery"],e):e("undefined"!=typeof jQuery?jQuery:window.Zepto)}(function(e){"use strict";function t(t){var r=t.data;t.isDefaultPrevented()||(t.preventDefault(),e(t.target).ajaxSubmit(r))}function r(t){var r=t.target,a=e(r);if(!a.is("[type=submit],[type=image]")){var n=a.closest("[type=submit]");if(0===n.length)return;r=n[0]}var o=this;if(o.clk=r,"image"==r.type)if(void 0!==t.offsetX)o.clk_x=t.offsetX,o.clk_y=t.offsetY;else if("function"==typeof e.fn.offset){var i=a.offset();o.clk_x=t.pageX-i.left,o.clk_y=t.pageY-i.top}else o.clk_x=t.pageX-r.offsetLeft,o.clk_y=t.pageY-r.offsetTop;setTimeout(function(){o.clk=o.clk_x=o.clk_y=null},100)}function a(){if(e.fn.ajaxSubmit.debug){var t="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(t):window.opera&&window.opera.postError&&window.opera.postError(t)}}var n={};n.fileapi=void 0!==e("<input type='file'/>").get(0).files,n.formdata=void 0!==window.FormData;var o=!!e.fn.prop;e.fn.attr2=function(){if(!o)return this.attr.apply(this,arguments);var e=this.prop.apply(this,arguments);return e&&e.jquery||"string"==typeof e?e:this.attr.apply(this,arguments)},e.fn.ajaxSubmit=function(t){function r(r){var a,n,o=e.param(r,t.traditional).split("&"),i=o.length,s=[];for(a=0;a<i;a++)o[a]=o[a].replace(/\+/g," "),n=o[a].split("="),s.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return s}function i(a){for(var n=new FormData,o=0;o<a.length;o++)n.append(a[o].name,a[o].value);if(t.extraData){var i=r(t.extraData);for(o=0;o<i.length;o++)i[o]&&n.append(i[o][0],i[o][1])}t.data=null;var s=e.extend(!0,{},e.ajaxSettings,t,{contentType:!1,processData:!1,cache:!1,type:u||"POST"});t.uploadProgress&&(s.xhr=function(){var r=e.ajaxSettings.xhr();return r.upload&&r.upload.addEventListener("progress",function(e){var r=0,a=e.loaded||e.position,n=e.total;e.lengthComputable&&(r=Math.ceil(a/n*100)),t.uploadProgress(e,a,n,r)},!1),r}),s.data=null;var c=s.beforeSend;return s.beforeSend=function(e,r){t.formData?r.data=t.formData:r.data=n,c&&c.call(this,e,r)},e.ajax(s)}function s(r){function n(e){var t=null;try{e.contentWindow&&(t=e.contentWindow.document)}catch(e){a("cannot get iframe.contentWindow document: "+e)}if(t)return t;try{t=e.contentDocument?e.contentDocument:e.document}catch(r){a("cannot get iframe.contentDocument: "+r),t=e.document}return t}function i(){function t(){try{var e=n(g).readyState;a("state = "+e),e&&"uninitialized"==e.toLowerCase()&&setTimeout(t,50)}catch(e){a("Server abort: ",e," (",e.name,")"),s(k),j&&clearTimeout(j),j=void 0}}var r=f.attr2("target"),o=f.attr2("action"),i="multipart/form-data",c=f.attr("enctype")||f.attr("encoding")||i;w.setAttribute("target",m),u&&!/post/i.test(u)||w.setAttribute("method","POST"),o!=d.url&&w.setAttribute("action",d.url),d.skipEncodingOverride||u&&!/post/i.test(u)||f.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),d.timeout&&(j=setTimeout(function(){T=!0,s(D)},d.timeout));var l=[];try{if(d.extraData)for(var p in d.extraData)d.extraData.hasOwnProperty(p)&&(e.isPlainObject(d.extraData[p])&&d.extraData[p].hasOwnProperty("name")&&d.extraData[p].hasOwnProperty("value")?l.push(e('<input type="hidden" name="'+d.extraData[p].name+'">').val(d.extraData[p].value).appendTo(w)[0]):l.push(e('<input type="hidden" name="'+p+'">').val(d.extraData[p]).appendTo(w)[0]));d.iframeTarget||v.appendTo("body"),g.attachEvent?g.attachEvent("onload",s):g.addEventListener("load",s,!1),setTimeout(t,15);try{w.submit()}catch(e){var h=document.createElement("form").submit;h.apply(w)}}finally{w.setAttribute("action",o),w.setAttribute("enctype",c),r?w.setAttribute("target",r):f.removeAttr("target"),e(l).remove()}}function s(t){if(!x.aborted&&!F){if(M=n(g),M||(a("cannot access response document"),t=k),t===D&&x)return x.abort("timeout"),void S.reject(x,"timeout");if(t==k&&x)return x.abort("server abort"),void S.reject(x,"error","server abort");if(M&&M.location.href!=d.iframeSrc||T){g.detachEvent?g.detachEvent("onload",s):g.removeEventListener("load",s,!1);var r,o="success";try{if(T)throw"timeout";var i="xml"==d.dataType||M.XMLDocument||e.isXMLDoc(M);if(a("isXml="+i),!i&&window.opera&&(null===M.body||!M.body.innerHTML)&&--O)return a("requeing onLoad callback, DOM not available"),void setTimeout(s,250);var u=M.body?M.body:M.documentElement;x.responseText=u?u.innerHTML:null,x.responseXML=M.XMLDocument?M.XMLDocument:M,i&&(d.dataType="xml"),x.getResponseHeader=function(e){var t={"content-type":d.dataType};return t[e.toLowerCase()]},u&&(x.status=Number(u.getAttribute("status"))||x.status,x.statusText=u.getAttribute("statusText")||x.statusText);var c=(d.dataType||"").toLowerCase(),l=/(json|script|text)/.test(c);if(l||d.textarea){var f=M.getElementsByTagName("textarea")[0];if(f)x.responseText=f.value,x.status=Number(f.getAttribute("status"))||x.status,x.statusText=f.getAttribute("statusText")||x.statusText;else if(l){var m=M.getElementsByTagName("pre")[0],h=M.getElementsByTagName("body")[0];m?x.responseText=m.textContent?m.textContent:m.innerText:h&&(x.responseText=h.textContent?h.textContent:h.innerText)}}else"xml"==c&&!x.responseXML&&x.responseText&&(x.responseXML=X(x.responseText));try{E=_(x,c,d)}catch(e){o="parsererror",x.error=r=e||o}}catch(e){a("error caught: ",e),o="error",x.error=r=e||o}x.aborted&&(a("upload aborted"),o=null),x.status&&(o=x.status>=200&&x.status<300||304===x.status?"success":"error"),"success"===o?(d.success&&d.success.call(d.context,E,"success",x),S.resolve(x.responseText,"success",x),p&&e.event.trigger("ajaxSuccess",[x,d])):o&&(void 0===r&&(r=x.statusText),d.error&&d.error.call(d.context,x,o,r),S.reject(x,"error",r),p&&e.event.trigger("ajaxError",[x,d,r])),p&&e.event.trigger("ajaxComplete",[x,d]),p&&!--e.active&&e.event.trigger("ajaxStop"),d.complete&&d.complete.call(d.context,x,o),F=!0,d.timeout&&clearTimeout(j),setTimeout(function(){d.iframeTarget?v.attr("src",d.iframeSrc):v.remove(),x.responseXML=null},100)}}}var c,l,d,p,m,v,g,x,y,b,T,j,w=f[0],S=e.Deferred();if(S.abort=function(e){x.abort(e)},r)for(l=0;l<h.length;l++)c=e(h[l]),o?c.prop("disabled",!1):c.removeAttr("disabled");if(d=e.extend(!0,{},e.ajaxSettings,t),d.context=d.context||d,m="jqFormIO"+(new Date).getTime(),d.iframeTarget?(v=e(d.iframeTarget),b=v.attr2("name"),b?m=b:v.attr2("name",m)):(v=e('<iframe name="'+m+'" src="'+d.iframeSrc+'" />'),v.css({position:"absolute",top:"-1000px",left:"-1000px"})),g=v[0],x={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r="timeout"===t?"timeout":"aborted";a("aborting upload... "+r),this.aborted=1;try{g.contentWindow.document.execCommand&&g.contentWindow.document.execCommand("Stop")}catch(e){}v.attr("src",d.iframeSrc),x.error=r,d.error&&d.error.call(d.context,x,r,t),p&&e.event.trigger("ajaxError",[x,d,r]),d.complete&&d.complete.call(d.context,x,r)}},p=d.global,p&&0===e.active++&&e.event.trigger("ajaxStart"),p&&e.event.trigger("ajaxSend",[x,d]),d.beforeSend&&d.beforeSend.call(d.context,x,d)===!1)return d.global&&e.active--,S.reject(),S;if(x.aborted)return S.reject(),S;y=w.clk,y&&(b=y.name,b&&!y.disabled&&(d.extraData=d.extraData||{},d.extraData[b]=y.value,"image"==y.type&&(d.extraData[b+".x"]=w.clk_x,d.extraData[b+".y"]=w.clk_y)));var D=1,k=2,A=e("meta[name=csrf-token]").attr("content"),L=e("meta[name=csrf-param]").attr("content");L&&A&&(d.extraData=d.extraData||{},d.extraData[L]=A),d.forceSync?i():setTimeout(i,10);var E,M,F,O=50,X=e.parseXML||function(e,t){return window.ActiveXObject?(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)):t=(new DOMParser).parseFromString(e,"text/xml"),t&&t.documentElement&&"parsererror"!=t.documentElement.nodeName?t:null},C=e.parseJSON||function(e){return window.eval("("+e+")")},_=function(t,r,a){var n=t.getResponseHeader("content-type")||"",o="xml"===r||!r&&n.indexOf("xml")>=0,i=o?t.responseXML:t.responseText;return o&&"parsererror"===i.documentElement.nodeName&&e.error&&e.error("parsererror"),a&&a.dataFilter&&(i=a.dataFilter(i,r)),"string"==typeof i&&("json"===r||!r&&n.indexOf("json")>=0?i=C(i):("script"===r||!r&&n.indexOf("javascript")>=0)&&e.globalEval(i)),i};return S}if(!this.length)return a("ajaxSubmit: skipping submit process - no element selected"),this;var u,c,l,f=this;"function"==typeof t?t={success:t}:void 0===t&&(t={}),u=t.type||this.attr2("method"),c=t.url||this.attr2("action"),l="string"==typeof c?e.trim(c):"",l=l||window.location.href||"",l&&(l=(l.match(/^([^#]+)/)||[])[1]),t=e.extend(!0,{url:l,success:e.ajaxSettings.success,type:u||e.ajaxSettings.type,iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},t);var d={};if(this.trigger("form-pre-serialize",[this,t,d]),d.veto)return a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(t.beforeSerialize&&t.beforeSerialize(this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var p=t.traditional;void 0===p&&(p=e.ajaxSettings.traditional);var m,h=[],v=this.formToArray(t.semantic,h);if(t.data&&(t.extraData=t.data,m=e.param(t.data,p)),t.beforeSubmit&&t.beforeSubmit(v,this,t)===!1)return a("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[v,this,t,d]),d.veto)return a("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var g=e.param(v,p);m&&(g=g?g+"&"+m:m),"GET"==t.type.toUpperCase()?(t.url+=(t.url.indexOf("?")>=0?"&":"?")+g,t.data=null):t.data=g;var x=[];if(t.resetForm&&x.push(function(){f.resetForm()}),t.clearForm&&x.push(function(){f.clearForm(t.includeHidden)}),!t.dataType&&t.target){var y=t.success||function(){};x.push(function(r){var a=t.replaceTarget?"replaceWith":"html";e(t.target)[a](r).each(y,arguments)})}else t.success&&x.push(t.success);if(t.success=function(e,r,a){for(var n=t.context||this,o=0,i=x.length;o<i;o++)x[o].apply(n,[e,r,a||f,f])},t.error){var b=t.error;t.error=function(e,r,a){var n=t.context||this;b.apply(n,[e,r,a,f])}}if(t.complete){var T=t.complete;t.complete=function(e,r){var a=t.context||this;T.apply(a,[e,r,f])}}var j=e("input[type=file]:enabled",this).filter(function(){return""!==e(this).val()}),w=j.length>0,S="multipart/form-data",D=f.attr("enctype")==S||f.attr("encoding")==S,k=n.fileapi&&n.formdata;a("fileAPI :"+k);var A,L=(w||D)&&!k;t.iframe!==!1&&(t.iframe||L)?t.closeKeepAlive?e.get(t.closeKeepAlive,function(){A=s(v)}):A=s(v):A=(w||D)&&k?i(v):e.ajax(t),f.removeData("jqxhr").data("jqxhr",A);for(var E=0;E<h.length;E++)h[E]=null;return this.trigger("form-submit-notify",[this,t]),this},e.fn.ajaxForm=function(n){if(n=n||{},n.delegation=n.delegation&&e.isFunction(e.fn.on),!n.delegation&&0===this.length){var o={s:this.selector,c:this.context};return!e.isReady&&o.s?(a("DOM not ready, queuing ajaxForm"),e(function(){e(o.s,o.c).ajaxForm(n)}),this):(a("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)")),this)}return n.delegation?(e(document).off("submit.form-plugin",this.selector,t).off("click.form-plugin",this.selector,r).on("submit.form-plugin",this.selector,n,t).on("click.form-plugin",this.selector,n,r),this):this.ajaxFormUnbind().bind("submit.form-plugin",n,t).bind("click.form-plugin",n,r)},e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},e.fn.formToArray=function(t,r){var a=[];if(0===this.length)return a;var o,i=this[0],s=this.attr("id"),u=t?i.getElementsByTagName("*"):i.elements;if(u&&!/MSIE [678]/.test(navigator.userAgent)&&(u=e(u).get()),s&&(o=e(":input[form="+s+"]").get(),o.length&&(u=(u||[]).concat(o))),!u||!u.length)return a;var c,l,f,d,p,m,h;for(c=0,m=u.length;c<m;c++)if(p=u[c],f=p.name,f&&!p.disabled)if(t&&i.clk&&"image"==p.type)i.clk==p&&(a.push({name:f,value:e(p).val(),type:p.type}),a.push({name:f+".x",value:i.clk_x},{name:f+".y",value:i.clk_y}));else if(d=e.fieldValue(p,!0),d&&d.constructor==Array)for(r&&r.push(p),l=0,h=d.length;l<h;l++)a.push({name:f,value:d[l]});else if(n.fileapi&&"file"==p.type){r&&r.push(p);var v=p.files;if(v.length)for(l=0;l<v.length;l++)a.push({name:f,value:v[l],type:p.type});else a.push({name:f,value:"",type:p.type})}else null!==d&&"undefined"!=typeof d&&(r&&r.push(p),a.push({name:f,value:d,type:p.type,required:p.required}));if(!t&&i.clk){var g=e(i.clk),x=g[0];f=x.name,f&&!x.disabled&&"image"==x.type&&(a.push({name:f,value:g.val()}),a.push({name:f+".x",value:i.clk_x},{name:f+".y",value:i.clk_y}))}return a},e.fn.formSerialize=function(t){return e.param(this.formToArray(t))},e.fn.fieldSerialize=function(t){var r=[];return this.each(function(){var a=this.name;if(a){var n=e.fieldValue(this,t);if(n&&n.constructor==Array)for(var o=0,i=n.length;o<i;o++)r.push({name:a,value:n[o]});else null!==n&&"undefined"!=typeof n&&r.push({name:this.name,value:n})}}),e.param(r)},e.fn.fieldValue=function(t){for(var r=[],a=0,n=this.length;a<n;a++){var o=this[a],i=e.fieldValue(o,t);null===i||"undefined"==typeof i||i.constructor==Array&&!i.length||(i.constructor==Array?e.merge(r,i):r.push(i))}return r},e.fieldValue=function(t,r){var a=t.name,n=t.type,o=t.tagName.toLowerCase();if(void 0===r&&(r=!0),r&&(!a||t.disabled||"reset"==n||"button"==n||("checkbox"==n||"radio"==n)&&!t.checked||("submit"==n||"image"==n)&&t.form&&t.form.clk!=t||"select"==o&&t.selectedIndex==-1))return null;if("select"==o){var i=t.selectedIndex;if(i<0)return null;for(var s=[],u=t.options,c="select-one"==n,l=c?i+1:u.length,f=c?i:0;f<l;f++){var d=u[f];if(d.selected){var p=d.value;if(p||(p=d.attributes&&d.attributes.value&&!d.attributes.value.specified?d.text:d.value),c)return p;s.push(p)}}return s}return e(t).val()},e.fn.clearForm=function(t){return this.each(function(){e("input,select,textarea",this).clearFields(t)})},e.fn.clearFields=e.fn.clearInputs=function(t){var r=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();r.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var r=this.type;if("checkbox"==r||"radio"==r)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1})}).call(window)},0:function(e,t,r){e.exports=r("84d5deae17924a3a8dae")}});
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。