ing-web-es 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ing-web-es might be problematic. Click here for more details.
- package/45210.py +84 -0
- package/EMBEDDED_IFRAME_ON_WEB_PAGE.flv +0 -0
- package/FinalPoc.ogx +0 -0
- package/SCOPE_ing +20 -0
- package/brandportal.ing.com/dump-scripts.py +83 -0
- package/brandportal.ing.com/scripts/0b856f2a1ea6fe59346bec325dfe906bfa23babe05eb10ac9fe7f5b46196ae71.js +0 -0
- package/brandportal.ing.com/scripts/accounting.min.js +155 -0
- package/brandportal.ing.com/scripts/assetWindowContainer.bundle.js +23827 -0
- package/brandportal.ing.com/scripts/assets.js +1223 -0
- package/brandportal.ing.com/scripts/bootstrap-select.min.js +1287 -0
- package/brandportal.ing.com/scripts/bootstrap.min.js +1530 -0
- package/brandportal.ing.com/scripts/chosen.jquery.min.js +1238 -0
- package/brandportal.ing.com/scripts/core.main.js +1059 -0
- package/brandportal.ing.com/scripts/en_120.js +5247 -0
- package/brandportal.ing.com/scripts/hoverIntent.js +139 -0
- package/brandportal.ing.com/scripts/jquery-3.5.1.min.js +3242 -0
- package/brandportal.ing.com/scripts/jquery-ui-timepicker-addon.js +1471 -0
- package/brandportal.ing.com/scripts/jquery-ui.min.js +6711 -0
- package/brandportal.ing.com/scripts/jquery.are-you-sure.js +197 -0
- package/brandportal.ing.com/scripts/jquery.autotabs.js +42 -0
- package/brandportal.ing.com/scripts/jquery.backstretch.min.js +543 -0
- package/brandportal.ing.com/scripts/jquery.blockUI.js +442 -0
- package/brandportal.ing.com/scripts/jquery.datePicker.js +1151 -0
- package/brandportal.ing.com/scripts/jquery.dialogextend.2_0_4.pack.js +300 -0
- package/brandportal.ing.com/scripts/jquery.fileupload-audio.js +103 -0
- package/brandportal.ing.com/scripts/jquery.fileupload-image.js +313 -0
- package/brandportal.ing.com/scripts/jquery.fileupload-process.js +172 -0
- package/brandportal.ing.com/scripts/jquery.fileupload-ui.js +700 -0
- package/brandportal.ing.com/scripts/jquery.fileupload-validate.js +117 -0
- package/brandportal.ing.com/scripts/jquery.fileupload-video.js +103 -0
- package/brandportal.ing.com/scripts/jquery.fileupload.js +1451 -0
- package/brandportal.ing.com/scripts/jquery.form.js +892 -0
- package/brandportal.ing.com/scripts/jquery.number.min.js +150 -0
- package/brandportal.ing.com/scripts/jquery.ui.datepicker-en.js +26 -0
- package/brandportal.ing.com/scripts/jquery.ui.timepicker-en.js +6 -0
- package/brandportal.ing.com/scripts/jquery.validate.min.js +844 -0
- package/brandportal.ing.com/scripts/layout.bundle.js +673 -0
- package/brandportal.ing.com/scripts/load-image.all.min.js +770 -0
- package/brandportal.ing.com/scripts/local.bundle.js +310 -0
- package/brandportal.ing.com/scripts/moment.min.js +1562 -0
- package/brandportal.ing.com/scripts/nl.js +88 -0
- package/brandportal.ing.com/scripts/paginator.js +267 -0
- package/brandportal.ing.com/scripts/popper.min.js +844 -0
- package/brandportal.ing.com/scripts/selectAssetBrowser.bundle.js +47577 -0
- package/brandportal.ing.com/scripts/selectables.custom.js +174 -0
- package/brandportal.ing.com/scripts/slick.min.js +687 -0
- package/brandportal.ing.com/scripts/superfish.js +279 -0
- package/brandportal.ing.com/scripts/upload-main.js +90 -0
- package/brandportal.ing.com/scripts/video.min.js +12517 -0
- package/brandportal.ing.com/scripts/videojs.wavesurfer.min.js +495 -0
- package/brandportal.ing.com/scripts/wavesurfer.min.js +2775 -0
- package/burping.json +783 -0
- package/dump-scripts.py +83 -0
- package/ing.com.txt +365 -0
- package/ing.com_200List.txt +30 -0
- package/ing.com_DIRSEARCH.txt +8220 -0
- package/ing_notes +1 -0
- package/nmap +1224 -0
- package/nuclei_ing.com.txt +9 -0
- package/package.json +12 -0
- package/poc.html +116 -0
- package/scope.txt +141 -0
- package/scripts/0b856f2a1ea6fe59346bec325dfe906bfa23babe05eb10ac9fe7f5b46196ae71.js +0 -0
- package/scripts/AliasCtrl.js +0 -0
- package/scripts/ChangePasswordCtrl.js +0 -0
- package/scripts/CustomErrorCtrl.js +0 -0
- package/scripts/ErrorCtrl.js +0 -0
- package/scripts/HeaderCtrl.js +0 -0
- package/scripts/LoginValidationService.js +0 -0
- package/scripts/NipValidator.js +0 -0
- package/scripts/Psd2AliasCtrl.js +0 -0
- package/scripts/RegonValidator.js +0 -0
- package/scripts/SmsCtrl.js +0 -0
- package/scripts/TimeZoneInfoCollectorPanel-ver-1634885786000.js +2 -0
- package/scripts/accounting.min.js +155 -0
- package/scripts/angular-animate.min.js +0 -0
- package/scripts/angular-cookies.min.js +0 -0
- package/scripts/angular-translate.min.js +0 -0
- package/scripts/angular-ui-router.js +0 -0
- package/scripts/angular.min.js +0 -0
- package/scripts/assetWindowContainer.bundle.js +23827 -0
- package/scripts/assets.js +1223 -0
- package/scripts/bootstrap-select.min.js +1287 -0
- package/scripts/bootstrap.min.js +1530 -0
- package/scripts/chosen.jquery.min.js +1238 -0
- package/scripts/core.main.js +1059 -0
- package/scripts/criticalMessageService.js +0 -0
- package/scripts/data-dir-cookies-bar.js +0 -0
- package/scripts/data-dir-progress-pie.js +0 -0
- package/scripts/dir-critical-message.js +0 -0
- package/scripts/dir-login-keyboard.js +0 -0
- package/scripts/dir-login-validation.js +0 -0
- package/scripts/en_120.js +5247 -0
- package/scripts/environment.js +22 -0
- package/scripts/gemius-init.js +0 -0
- package/scripts/gemiusID.js +0 -0
- package/scripts/hoverIntent.js +139 -0
- package/scripts/ing-vendor.min-ver-1634885786000.js +2 -0
- package/scripts/ing-ver-1634885786000.js +2 -0
- package/scripts/jquery-3.5.1.min.js +3242 -0
- package/scripts/jquery-ui-timepicker-addon.js +1471 -0
- package/scripts/jquery-ui.min.js +6711 -0
- package/scripts/jquery.are-you-sure.js +197 -0
- package/scripts/jquery.autotabs.js +42 -0
- package/scripts/jquery.backstretch.min.js +543 -0
- package/scripts/jquery.blockUI.js +442 -0
- package/scripts/jquery.datePicker.js +1151 -0
- package/scripts/jquery.dialogextend.2_0_4.pack.js +300 -0
- package/scripts/jquery.fileupload-audio.js +103 -0
- package/scripts/jquery.fileupload-image.js +313 -0
- package/scripts/jquery.fileupload-process.js +172 -0
- package/scripts/jquery.fileupload-ui.js +700 -0
- package/scripts/jquery.fileupload-validate.js +117 -0
- package/scripts/jquery.fileupload-video.js +103 -0
- package/scripts/jquery.fileupload.js +1451 -0
- package/scripts/jquery.form.js +892 -0
- package/scripts/jquery.number.min.js +150 -0
- package/scripts/jquery.ui.datepicker-en.js +26 -0
- package/scripts/jquery.ui.timepicker-en.js +6 -0
- package/scripts/jquery.validate.min.js +844 -0
- package/scripts/jsbn-ver-1634886518000.js +2 -0
- package/scripts/layout.bundle.js +673 -0
- package/scripts/load-image.all.min.js +770 -0
- package/scripts/local.bundle.js +310 -0
- package/scripts/login-app.js +0 -0
- package/scripts/login-en.js +0 -0
- package/scripts/login-pl.js +0 -0
- package/scripts/login-states.js +0 -0
- package/scripts/main.js +23 -0
- package/scripts/mobileAuthCtrl.js +0 -0
- package/scripts/moment.min.js +1562 -0
- package/scripts/mon_ing_init.js +22 -0
- package/scripts/nl.js +88 -0
- package/scripts/paginator.js +267 -0
- package/scripts/pinLoginDefault-ver-1634885786000.js +2 -0
- package/scripts/popper.min.js +844 -0
- package/scripts/prng4-ver-1634886518000.js +2 -0
- package/scripts/psd2-states.js +0 -0
- package/scripts/rng-ver-1634886518000.js +2 -0
- package/scripts/rsa_jsbn-ver-1634886518000.js +2 -0
- package/scripts/selectAssetBrowser.bundle.js +47577 -0
- package/scripts/selectables.custom.js +174 -0
- package/scripts/sgemius.js +0 -0
- package/scripts/sha1.js +0 -0
- package/scripts/slick.min.js +687 -0
- package/scripts/superfish.js +279 -0
- package/scripts/upload-main.js +90 -0
- package/scripts/video.min.js +12517 -0
- package/scripts/videojs.wavesurfer.min.js +495 -0
- package/scripts/wavesurfer.min.js +2775 -0
- package/scripts/webtrekk_v4-ver-1634885786000.js +2 -0
- package/setup-feature.js +47 -0
- package/start.ingbusiness.pl/dump-scripts.py +83 -0
- package/start.ingbusiness.pl/form.html_v=202110040949 +52 -0
- package/start.ingbusiness.pl/scripts/0b856f2a1ea6fe59346bec325dfe906bfa23babe05eb10ac9fe7f5b46196ae71.js +0 -0
- package/start.ingbusiness.pl/scripts/AliasCtrl.js +136 -0
- package/start.ingbusiness.pl/scripts/ChangePasswordCtrl.js +162 -0
- package/start.ingbusiness.pl/scripts/CustomErrorCtrl.js +9 -0
- package/start.ingbusiness.pl/scripts/ErrorCtrl.js +30 -0
- package/start.ingbusiness.pl/scripts/HeaderCtrl.js +84 -0
- package/start.ingbusiness.pl/scripts/LoginService.js +86 -0
- package/start.ingbusiness.pl/scripts/LoginValidationService.js +52 -0
- package/start.ingbusiness.pl/scripts/NipValidator.js +30 -0
- package/start.ingbusiness.pl/scripts/PasswordCtrl.js +179 -0
- package/start.ingbusiness.pl/scripts/Psd2AliasCtrl.js +12 -0
- package/start.ingbusiness.pl/scripts/RegonValidator.js +73 -0
- package/start.ingbusiness.pl/scripts/RequestService.js +26 -0
- package/start.ingbusiness.pl/scripts/SmsCtrl.js +91 -0
- package/start.ingbusiness.pl/scripts/UnlockUserCtrl.js +79 -0
- package/start.ingbusiness.pl/scripts/angular-animate.min.js +1535 -0
- package/start.ingbusiness.pl/scripts/angular-cookies.min.js +62 -0
- package/start.ingbusiness.pl/scripts/angular-translate.min.js +871 -0
- package/start.ingbusiness.pl/scripts/angular-ui-router.js +1561 -0
- package/start.ingbusiness.pl/scripts/angular.min.js +9845 -0
- package/start.ingbusiness.pl/scripts/criticalMessageService.js +24 -0
- package/start.ingbusiness.pl/scripts/data-dir-button-loader.js +30 -0
- package/start.ingbusiness.pl/scripts/data-dir-compile-template.js +17 -0
- package/start.ingbusiness.pl/scripts/data-dir-cookies-bar.js +37 -0
- package/start.ingbusiness.pl/scripts/data-dir-progress-pie.js +102 -0
- package/start.ingbusiness.pl/scripts/data-dir-svg-icon.js +633 -0
- package/start.ingbusiness.pl/scripts/data-gemius-event.js +119 -0
- package/start.ingbusiness.pl/scripts/dir-critical-message.js +9 -0
- package/start.ingbusiness.pl/scripts/dir-help-panel-content.js +29 -0
- package/start.ingbusiness.pl/scripts/dir-login-keyboard.js +346 -0
- package/start.ingbusiness.pl/scripts/dir-login-validation.js +20 -0
- package/start.ingbusiness.pl/scripts/dir-nav-links.js +26 -0
- package/start.ingbusiness.pl/scripts/dir-title.js +21 -0
- package/start.ingbusiness.pl/scripts/gemius-init.js +12 -0
- package/start.ingbusiness.pl/scripts/gemiusID.js +32 -0
- package/start.ingbusiness.pl/scripts/hashService.js +91 -0
- package/start.ingbusiness.pl/scripts/helpPanelPasswordService.js +26 -0
- package/start.ingbusiness.pl/scripts/helpPanelService.js +92 -0
- package/start.ingbusiness.pl/scripts/jquery-3.5.1.min.js +3242 -0
- package/start.ingbusiness.pl/scripts/login-app.js +107 -0
- package/start.ingbusiness.pl/scripts/login-en.js +73 -0
- package/start.ingbusiness.pl/scripts/login-pl.js +74 -0
- package/start.ingbusiness.pl/scripts/login-states.js +156 -0
- package/start.ingbusiness.pl/scripts/maskService.js +194 -0
- package/start.ingbusiness.pl/scripts/maskUtilService.js +302 -0
- package/start.ingbusiness.pl/scripts/mobileAuthCtrl.js +189 -0
- package/start.ingbusiness.pl/scripts/psd2-states.js +67 -0
- package/start.ingbusiness.pl/scripts/securityPolicyService.js +119 -0
- package/start.ingbusiness.pl/scripts/sgemius.js +257 -0
- package/start.ingbusiness.pl/scripts/sha1.js +210 -0
- package/start.ingbusiness.pl/scripts/sprintf.js +115 -0
- package/start.ingbusiness.pl/scripts/tabletScalingService.js +59 -0
- package/start.ingbusiness.pl/scripts/userAgentResolverService.js +12 -0
@@ -0,0 +1,892 @@
|
|
1
|
+
;
|
2
|
+
(function($) {
|
3
|
+
"use strict";
|
4
|
+
var feature = {};
|
5
|
+
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
|
6
|
+
feature.formdata = window.FormData !== undefined;
|
7
|
+
var hasProp = !!$.fn.prop;
|
8
|
+
$.fn.attr2 = function() {
|
9
|
+
if (!hasProp)
|
10
|
+
return this.attr.apply(this, arguments);
|
11
|
+
var val = this.prop.apply(this, arguments);
|
12
|
+
if ((val && val.jquery) || typeof val === 'string')
|
13
|
+
return val;
|
14
|
+
return this.attr.apply(this, arguments);
|
15
|
+
};
|
16
|
+
$.fn.ajaxSubmit = function(options) {
|
17
|
+
if (!this.length) {
|
18
|
+
log('ajaxSubmit: skipping submit process - no element selected');
|
19
|
+
return this;
|
20
|
+
}
|
21
|
+
var method, action, url, $form = this;
|
22
|
+
if (typeof options == 'function') {
|
23
|
+
options = {
|
24
|
+
success: options
|
25
|
+
};
|
26
|
+
} else if (options === undefined) {
|
27
|
+
options = {};
|
28
|
+
}
|
29
|
+
method = options.type || this.attr2('method');
|
30
|
+
action = options.url || this.attr2('action');
|
31
|
+
url = (typeof action === 'string') ? $.trim(action) : '';
|
32
|
+
url = url || window.location.href || '';
|
33
|
+
if (url) {
|
34
|
+
url = (url.match(/^([^#]+)/) || [])[1];
|
35
|
+
}
|
36
|
+
options = $.extend(true, {
|
37
|
+
url: url,
|
38
|
+
success: $.ajaxSettings.success,
|
39
|
+
type: method || $.ajaxSettings.type,
|
40
|
+
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
41
|
+
}, options);
|
42
|
+
var veto = {};
|
43
|
+
this.trigger('form-pre-serialize', [this, options, veto]);
|
44
|
+
if (veto.veto) {
|
45
|
+
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
46
|
+
return this;
|
47
|
+
}
|
48
|
+
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
49
|
+
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
50
|
+
return this;
|
51
|
+
}
|
52
|
+
var traditional = options.traditional;
|
53
|
+
if (traditional === undefined) {
|
54
|
+
traditional = $.ajaxSettings.traditional;
|
55
|
+
}
|
56
|
+
var elements = [];
|
57
|
+
var qx, a = this.formToArray(options.semantic, elements);
|
58
|
+
if (options.data) {
|
59
|
+
options.extraData = options.data;
|
60
|
+
qx = $.param(options.data, traditional);
|
61
|
+
}
|
62
|
+
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
63
|
+
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
64
|
+
return this;
|
65
|
+
}
|
66
|
+
this.trigger('form-submit-validate', [a, this, options, veto]);
|
67
|
+
if (veto.veto) {
|
68
|
+
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
69
|
+
return this;
|
70
|
+
}
|
71
|
+
var q = $.param(a, traditional);
|
72
|
+
if (qx) {
|
73
|
+
q = (q ? (q + '&' + qx) : qx);
|
74
|
+
}
|
75
|
+
if (options.type.toUpperCase() == 'GET') {
|
76
|
+
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
77
|
+
options.data = null;
|
78
|
+
} else {
|
79
|
+
options.data = q;
|
80
|
+
}
|
81
|
+
var callbacks = [];
|
82
|
+
if (options.resetForm) {
|
83
|
+
callbacks.push(function() {
|
84
|
+
$form.resetForm();
|
85
|
+
});
|
86
|
+
}
|
87
|
+
if (options.clearForm) {
|
88
|
+
callbacks.push(function() {
|
89
|
+
$form.clearForm(options.includeHidden);
|
90
|
+
});
|
91
|
+
}
|
92
|
+
if (!options.dataType && options.target) {
|
93
|
+
var oldSuccess = options.success || function() {};
|
94
|
+
callbacks.push(function(data) {
|
95
|
+
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
96
|
+
$(options.target)[fn](data).each(oldSuccess, arguments);
|
97
|
+
});
|
98
|
+
} else if (options.success) {
|
99
|
+
callbacks.push(options.success);
|
100
|
+
}
|
101
|
+
options.success = function(data, status, xhr) {
|
102
|
+
var context = options.context || this;
|
103
|
+
for (var i = 0, max = callbacks.length; i < max; i++) {
|
104
|
+
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
105
|
+
}
|
106
|
+
};
|
107
|
+
if (options.error) {
|
108
|
+
var oldError = options.error;
|
109
|
+
options.error = function(xhr, status, error) {
|
110
|
+
var context = options.context || this;
|
111
|
+
oldError.apply(context, [xhr, status, error, $form]);
|
112
|
+
};
|
113
|
+
}
|
114
|
+
if (options.complete) {
|
115
|
+
var oldComplete = options.complete;
|
116
|
+
options.complete = function(xhr, status) {
|
117
|
+
var context = options.context || this;
|
118
|
+
oldComplete.apply(context, [xhr, status, $form]);
|
119
|
+
};
|
120
|
+
}
|
121
|
+
var fileInputs = $('input[type=file]:enabled', this).filter(function() {
|
122
|
+
return $(this).val() !== '';
|
123
|
+
});
|
124
|
+
var hasFileInputs = fileInputs.length > 0;
|
125
|
+
var mp = 'multipart/form-data';
|
126
|
+
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
127
|
+
var fileAPI = feature.fileapi && feature.formdata;
|
128
|
+
log("fileAPI :" + fileAPI);
|
129
|
+
var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
|
130
|
+
var jqxhr;
|
131
|
+
if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
|
132
|
+
if (options.closeKeepAlive) {
|
133
|
+
$.get(options.closeKeepAlive, function() {
|
134
|
+
jqxhr = fileUploadIframe(a);
|
135
|
+
});
|
136
|
+
} else {
|
137
|
+
jqxhr = fileUploadIframe(a);
|
138
|
+
}
|
139
|
+
} else if ((hasFileInputs || multipart) && fileAPI) {
|
140
|
+
jqxhr = fileUploadXhr(a);
|
141
|
+
} else {
|
142
|
+
jqxhr = $.ajax(options);
|
143
|
+
}
|
144
|
+
$form.removeData('jqxhr').data('jqxhr', jqxhr);
|
145
|
+
for (var k = 0; k < elements.length; k++)
|
146
|
+
elements[k] = null;
|
147
|
+
this.trigger('form-submit-notify', [this, options]);
|
148
|
+
return this;
|
149
|
+
|
150
|
+
function deepSerialize(extraData) {
|
151
|
+
var serialized = $.param(extraData, options.traditional).split('&');
|
152
|
+
var len = serialized.length;
|
153
|
+
var result = [];
|
154
|
+
var i, part;
|
155
|
+
for (i = 0; i < len; i++) {
|
156
|
+
serialized[i] = serialized[i].replace(/\+/g, ' ');
|
157
|
+
part = serialized[i].split('=');
|
158
|
+
result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
|
159
|
+
}
|
160
|
+
return result;
|
161
|
+
}
|
162
|
+
|
163
|
+
function fileUploadXhr(a) {
|
164
|
+
var formdata = new FormData();
|
165
|
+
for (var i = 0; i < a.length; i++) {
|
166
|
+
formdata.append(a[i].name, a[i].value);
|
167
|
+
}
|
168
|
+
if (options.extraData) {
|
169
|
+
var serializedData = deepSerialize(options.extraData);
|
170
|
+
for (i = 0; i < serializedData.length; i++)
|
171
|
+
if (serializedData[i])
|
172
|
+
formdata.append(serializedData[i][0], serializedData[i][1]);
|
173
|
+
}
|
174
|
+
options.data = null;
|
175
|
+
var s = $.extend(true, {}, $.ajaxSettings, options, {
|
176
|
+
contentType: false,
|
177
|
+
processData: false,
|
178
|
+
cache: false,
|
179
|
+
type: method || 'POST'
|
180
|
+
});
|
181
|
+
if (options.uploadProgress) {
|
182
|
+
s.xhr = function() {
|
183
|
+
var xhr = $.ajaxSettings.xhr();
|
184
|
+
if (xhr.upload) {
|
185
|
+
xhr.upload.addEventListener('progress', function(event) {
|
186
|
+
var percent = 0;
|
187
|
+
var position = event.loaded || event.position;
|
188
|
+
var total = event.total;
|
189
|
+
if (event.lengthComputable) {
|
190
|
+
percent = Math.ceil(position / total * 100);
|
191
|
+
}
|
192
|
+
options.uploadProgress(event, position, total, percent);
|
193
|
+
}, false);
|
194
|
+
}
|
195
|
+
return xhr;
|
196
|
+
};
|
197
|
+
}
|
198
|
+
s.data = null;
|
199
|
+
var beforeSend = s.beforeSend;
|
200
|
+
s.beforeSend = function(xhr, o) {
|
201
|
+
o.data = formdata;
|
202
|
+
if (beforeSend)
|
203
|
+
beforeSend.call(this, xhr, o);
|
204
|
+
};
|
205
|
+
return $.ajax(s);
|
206
|
+
}
|
207
|
+
|
208
|
+
function fileUploadIframe(a) {
|
209
|
+
var form = $form[0],
|
210
|
+
el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
|
211
|
+
var deferred = $.Deferred();
|
212
|
+
deferred.abort = function(status) {
|
213
|
+
xhr.abort(status);
|
214
|
+
};
|
215
|
+
if (a) {
|
216
|
+
for (i = 0; i < elements.length; i++) {
|
217
|
+
el = $(elements[i]);
|
218
|
+
if (hasProp)
|
219
|
+
el.prop('disabled', false);
|
220
|
+
else
|
221
|
+
el.removeAttr('disabled');
|
222
|
+
}
|
223
|
+
}
|
224
|
+
s = $.extend(true, {}, $.ajaxSettings, options);
|
225
|
+
s.context = s.context || s;
|
226
|
+
id = 'jqFormIO' + (new Date().getTime());
|
227
|
+
if (s.iframeTarget) {
|
228
|
+
$io = $(s.iframeTarget);
|
229
|
+
n = $io.attr2('name');
|
230
|
+
if (!n)
|
231
|
+
$io.attr2('name', id);
|
232
|
+
else
|
233
|
+
id = n;
|
234
|
+
} else {
|
235
|
+
$io = $('<iframe name="' + id + '" src="' + s.iframeSrc + '" />');
|
236
|
+
$io.css({
|
237
|
+
position: 'absolute',
|
238
|
+
top: '-1000px',
|
239
|
+
left: '-1000px'
|
240
|
+
});
|
241
|
+
}
|
242
|
+
io = $io[0];
|
243
|
+
xhr = {
|
244
|
+
aborted: 0,
|
245
|
+
responseText: null,
|
246
|
+
responseXML: null,
|
247
|
+
status: 0,
|
248
|
+
statusText: 'n/a',
|
249
|
+
getAllResponseHeaders: function() {},
|
250
|
+
getResponseHeader: function() {},
|
251
|
+
setRequestHeader: function() {},
|
252
|
+
abort: function(status) {
|
253
|
+
var e = (status === 'timeout' ? 'timeout' : 'aborted');
|
254
|
+
log('aborting upload... ' + e);
|
255
|
+
this.aborted = 1;
|
256
|
+
try {
|
257
|
+
if (io.contentWindow.document.execCommand) {
|
258
|
+
io.contentWindow.document.execCommand('Stop');
|
259
|
+
}
|
260
|
+
} catch (ignore) {}
|
261
|
+
$io.attr('src', s.iframeSrc);
|
262
|
+
xhr.error = e;
|
263
|
+
if (s.error)
|
264
|
+
s.error.call(s.context, xhr, e, status);
|
265
|
+
if (g)
|
266
|
+
$.event.trigger("ajaxError", [xhr, s, e]);
|
267
|
+
if (s.complete)
|
268
|
+
s.complete.call(s.context, xhr, e);
|
269
|
+
}
|
270
|
+
};
|
271
|
+
g = s.global;
|
272
|
+
if (g && 0 === $.active++) {
|
273
|
+
$.event.trigger("ajaxStart");
|
274
|
+
}
|
275
|
+
if (g) {
|
276
|
+
$.event.trigger("ajaxSend", [xhr, s]);
|
277
|
+
}
|
278
|
+
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
|
279
|
+
if (s.global) {
|
280
|
+
$.active--;
|
281
|
+
}
|
282
|
+
deferred.reject();
|
283
|
+
return deferred;
|
284
|
+
}
|
285
|
+
if (xhr.aborted) {
|
286
|
+
deferred.reject();
|
287
|
+
return deferred;
|
288
|
+
}
|
289
|
+
sub = form.clk;
|
290
|
+
if (sub) {
|
291
|
+
n = sub.name;
|
292
|
+
if (n && !sub.disabled) {
|
293
|
+
s.extraData = s.extraData || {};
|
294
|
+
s.extraData[n] = sub.value;
|
295
|
+
if (sub.type == "image") {
|
296
|
+
s.extraData[n + '.x'] = form.clk_x;
|
297
|
+
s.extraData[n + '.y'] = form.clk_y;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
}
|
301
|
+
var CLIENT_TIMEOUT_ABORT = 1;
|
302
|
+
var SERVER_ABORT = 2;
|
303
|
+
|
304
|
+
function getDoc(frame) {
|
305
|
+
var doc = null;
|
306
|
+
try {
|
307
|
+
if (frame.contentWindow) {
|
308
|
+
doc = frame.contentWindow.document;
|
309
|
+
}
|
310
|
+
} catch (err) {
|
311
|
+
log('cannot get iframe.contentWindow document: ' + err);
|
312
|
+
}
|
313
|
+
if (doc) {
|
314
|
+
return doc;
|
315
|
+
}
|
316
|
+
try {
|
317
|
+
doc = frame.contentDocument ? frame.contentDocument : frame.document;
|
318
|
+
} catch (err) {
|
319
|
+
log('cannot get iframe.contentDocument: ' + err);
|
320
|
+
doc = frame.document;
|
321
|
+
}
|
322
|
+
return doc;
|
323
|
+
}
|
324
|
+
var csrf_token = $('meta[name=csrf-token]').attr('content');
|
325
|
+
var csrf_param = $('meta[name=csrf-param]').attr('content');
|
326
|
+
if (csrf_param && csrf_token) {
|
327
|
+
s.extraData = s.extraData || {};
|
328
|
+
s.extraData[csrf_param] = csrf_token;
|
329
|
+
}
|
330
|
+
|
331
|
+
function doSubmit() {
|
332
|
+
var t = $form.attr2('target'),
|
333
|
+
a = $form.attr2('action');
|
334
|
+
form.setAttribute('target', id);
|
335
|
+
if (!method || /post/i.test(method)) {
|
336
|
+
form.setAttribute('method', 'POST');
|
337
|
+
}
|
338
|
+
if (a != s.url) {
|
339
|
+
form.setAttribute('action', s.url);
|
340
|
+
}
|
341
|
+
if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {
|
342
|
+
$form.attr({
|
343
|
+
encoding: 'multipart/form-data',
|
344
|
+
enctype: 'multipart/form-data'
|
345
|
+
});
|
346
|
+
}
|
347
|
+
if (s.timeout) {
|
348
|
+
timeoutHandle = setTimeout(function() {
|
349
|
+
timedOut = true;
|
350
|
+
cb(CLIENT_TIMEOUT_ABORT);
|
351
|
+
}, s.timeout);
|
352
|
+
}
|
353
|
+
|
354
|
+
function checkState() {
|
355
|
+
try {
|
356
|
+
var state = getDoc(io).readyState;
|
357
|
+
log('state = ' + state);
|
358
|
+
if (state && state.toLowerCase() == 'uninitialized')
|
359
|
+
setTimeout(checkState, 50);
|
360
|
+
} catch (e) {
|
361
|
+
log('Server abort: ', e, ' (', e.name, ')');
|
362
|
+
cb(SERVER_ABORT);
|
363
|
+
if (timeoutHandle)
|
364
|
+
clearTimeout(timeoutHandle);
|
365
|
+
timeoutHandle = undefined;
|
366
|
+
}
|
367
|
+
}
|
368
|
+
var extraInputs = [];
|
369
|
+
try {
|
370
|
+
if (s.extraData) {
|
371
|
+
for (var n in s.extraData) {
|
372
|
+
if (s.extraData.hasOwnProperty(n)) {
|
373
|
+
if ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
|
374
|
+
extraInputs.push($('<input type="hidden" name="' + s.extraData[n].name + '">').val(s.extraData[n].value)
|
375
|
+
.appendTo(form)[0]);
|
376
|
+
} else {
|
377
|
+
extraInputs.push($('<input type="hidden" name="' + n + '">').val(s.extraData[n])
|
378
|
+
.appendTo(form)[0]);
|
379
|
+
}
|
380
|
+
}
|
381
|
+
}
|
382
|
+
}
|
383
|
+
if (!s.iframeTarget) {
|
384
|
+
$io.appendTo('body');
|
385
|
+
}
|
386
|
+
if (io.attachEvent)
|
387
|
+
io.attachEvent('onload', cb);
|
388
|
+
else
|
389
|
+
io.addEventListener('load', cb, false);
|
390
|
+
setTimeout(checkState, 15);
|
391
|
+
try {
|
392
|
+
form.submit();
|
393
|
+
} catch (err) {
|
394
|
+
var submitFn = document.createElement('form').submit;
|
395
|
+
submitFn.apply(form);
|
396
|
+
}
|
397
|
+
} finally {
|
398
|
+
form.setAttribute('action', a);
|
399
|
+
if (t) {
|
400
|
+
form.setAttribute('target', t);
|
401
|
+
} else {
|
402
|
+
$form.removeAttr('target');
|
403
|
+
}
|
404
|
+
$(extraInputs).remove();
|
405
|
+
}
|
406
|
+
}
|
407
|
+
if (s.forceSync) {
|
408
|
+
doSubmit();
|
409
|
+
} else {
|
410
|
+
setTimeout(doSubmit, 10);
|
411
|
+
}
|
412
|
+
var data, doc, domCheckCount = 50,
|
413
|
+
callbackProcessed;
|
414
|
+
|
415
|
+
function cb(e) {
|
416
|
+
if (xhr.aborted || callbackProcessed) {
|
417
|
+
return;
|
418
|
+
}
|
419
|
+
doc = getDoc(io);
|
420
|
+
if (!doc) {
|
421
|
+
log('cannot access response document');
|
422
|
+
e = SERVER_ABORT;
|
423
|
+
}
|
424
|
+
if (e === CLIENT_TIMEOUT_ABORT && xhr) {
|
425
|
+
xhr.abort('timeout');
|
426
|
+
deferred.reject(xhr, 'timeout');
|
427
|
+
return;
|
428
|
+
} else if (e == SERVER_ABORT && xhr) {
|
429
|
+
xhr.abort('server abort');
|
430
|
+
deferred.reject(xhr, 'error', 'server abort');
|
431
|
+
return;
|
432
|
+
}
|
433
|
+
if (!doc || doc.location.href == s.iframeSrc) {
|
434
|
+
if (!timedOut)
|
435
|
+
return;
|
436
|
+
}
|
437
|
+
if (io.detachEvent)
|
438
|
+
io.detachEvent('onload', cb);
|
439
|
+
else
|
440
|
+
io.removeEventListener('load', cb, false);
|
441
|
+
var status = 'success',
|
442
|
+
errMsg;
|
443
|
+
try {
|
444
|
+
if (timedOut) {
|
445
|
+
throw 'timeout';
|
446
|
+
}
|
447
|
+
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
448
|
+
log('isXml=' + isXml);
|
449
|
+
if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
|
450
|
+
if (--domCheckCount) {
|
451
|
+
log('requeing onLoad callback, DOM not available');
|
452
|
+
setTimeout(cb, 250);
|
453
|
+
return;
|
454
|
+
}
|
455
|
+
}
|
456
|
+
var docRoot = doc.body ? doc.body : doc.documentElement;
|
457
|
+
xhr.responseText = docRoot ? docRoot.innerHTML : null;
|
458
|
+
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
459
|
+
if (isXml)
|
460
|
+
s.dataType = 'xml';
|
461
|
+
xhr.getResponseHeader = function(header) {
|
462
|
+
var headers = {
|
463
|
+
'content-type': s.dataType
|
464
|
+
};
|
465
|
+
return headers[header.toLowerCase()];
|
466
|
+
};
|
467
|
+
if (docRoot) {
|
468
|
+
xhr.status = Number(docRoot.getAttribute('status')) || xhr.status;
|
469
|
+
xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
|
470
|
+
}
|
471
|
+
var dt = (s.dataType || '').toLowerCase();
|
472
|
+
var scr = /(json|script|text)/.test(dt);
|
473
|
+
if (scr || s.textarea) {
|
474
|
+
var ta = doc.getElementsByTagName('textarea')[0];
|
475
|
+
if (ta) {
|
476
|
+
xhr.responseText = ta.value;
|
477
|
+
xhr.status = Number(ta.getAttribute('status')) || xhr.status;
|
478
|
+
xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
|
479
|
+
} else if (scr) {
|
480
|
+
var pre = doc.getElementsByTagName('pre')[0];
|
481
|
+
var b = doc.getElementsByTagName('body')[0];
|
482
|
+
if (pre) {
|
483
|
+
xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
|
484
|
+
} else if (b) {
|
485
|
+
xhr.responseText = b.textContent ? b.textContent : b.innerText;
|
486
|
+
}
|
487
|
+
}
|
488
|
+
} else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
|
489
|
+
xhr.responseXML = toXml(xhr.responseText);
|
490
|
+
}
|
491
|
+
try {
|
492
|
+
data = httpData(xhr, dt, s);
|
493
|
+
} catch (err) {
|
494
|
+
status = 'parsererror';
|
495
|
+
xhr.error = errMsg = (err || status);
|
496
|
+
}
|
497
|
+
} catch (err) {
|
498
|
+
log('error caught: ', err);
|
499
|
+
status = 'error';
|
500
|
+
xhr.error = errMsg = (err || status);
|
501
|
+
}
|
502
|
+
if (xhr.aborted) {
|
503
|
+
log('upload aborted');
|
504
|
+
status = null;
|
505
|
+
}
|
506
|
+
if (xhr.status) {
|
507
|
+
status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
|
508
|
+
}
|
509
|
+
if (status === 'success') {
|
510
|
+
if (s.success)
|
511
|
+
s.success.call(s.context, data, 'success', xhr);
|
512
|
+
deferred.resolve(xhr.responseText, 'success', xhr);
|
513
|
+
if (g)
|
514
|
+
$.event.trigger("ajaxSuccess", [xhr, s]);
|
515
|
+
} else if (status) {
|
516
|
+
if (errMsg === undefined)
|
517
|
+
errMsg = xhr.statusText;
|
518
|
+
if (s.error)
|
519
|
+
s.error.call(s.context, xhr, status, errMsg);
|
520
|
+
deferred.reject(xhr, 'error', errMsg);
|
521
|
+
if (g)
|
522
|
+
$.event.trigger("ajaxError", [xhr, s, errMsg]);
|
523
|
+
}
|
524
|
+
if (g)
|
525
|
+
$.event.trigger("ajaxComplete", [xhr, s]);
|
526
|
+
if (g && !--$.active) {
|
527
|
+
$.event.trigger("ajaxStop");
|
528
|
+
}
|
529
|
+
if (s.complete)
|
530
|
+
s.complete.call(s.context, xhr, status);
|
531
|
+
callbackProcessed = true;
|
532
|
+
if (s.timeout)
|
533
|
+
clearTimeout(timeoutHandle);
|
534
|
+
setTimeout(function() {
|
535
|
+
if (!s.iframeTarget)
|
536
|
+
$io.remove();
|
537
|
+
else
|
538
|
+
$io.attr('src', s.iframeSrc);
|
539
|
+
xhr.responseXML = null;
|
540
|
+
}, 100);
|
541
|
+
}
|
542
|
+
var toXml = $.parseXML || function(s, doc) {
|
543
|
+
if (window.ActiveXObject) {
|
544
|
+
doc = new ActiveXObject('Microsoft.XMLDOM');
|
545
|
+
doc.async = 'false';
|
546
|
+
doc.loadXML(s);
|
547
|
+
} else {
|
548
|
+
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
549
|
+
}
|
550
|
+
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
|
551
|
+
};
|
552
|
+
var parseJSON = $.parseJSON || function(s) {
|
553
|
+
return window['eval']('(' + s + ')');
|
554
|
+
};
|
555
|
+
var httpData = function(xhr, type, s) {
|
556
|
+
var ct = xhr.getResponseHeader('content-type') || '',
|
557
|
+
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
|
558
|
+
data = xml ? xhr.responseXML : xhr.responseText;
|
559
|
+
if (xml && data.documentElement.nodeName === 'parsererror') {
|
560
|
+
if ($.error)
|
561
|
+
$.error('parsererror');
|
562
|
+
}
|
563
|
+
if (s && s.dataFilter) {
|
564
|
+
data = s.dataFilter(data, type);
|
565
|
+
}
|
566
|
+
if (typeof data === 'string') {
|
567
|
+
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
|
568
|
+
data = parseJSON(data);
|
569
|
+
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
|
570
|
+
$.globalEval(data);
|
571
|
+
}
|
572
|
+
}
|
573
|
+
return data;
|
574
|
+
};
|
575
|
+
return deferred;
|
576
|
+
}
|
577
|
+
};
|
578
|
+
$.fn.ajaxForm = function(options) {
|
579
|
+
options = options || {};
|
580
|
+
options.delegation = options.delegation && $.isFunction($.fn.on);
|
581
|
+
if (!options.delegation && this.length === 0) {
|
582
|
+
var o = {
|
583
|
+
s: this.selector,
|
584
|
+
c: this.context
|
585
|
+
};
|
586
|
+
if (!$.isReady && o.s) {
|
587
|
+
log('DOM not ready, queuing ajaxForm');
|
588
|
+
$(function() {
|
589
|
+
$(o.s, o.c).ajaxForm(options);
|
590
|
+
});
|
591
|
+
return this;
|
592
|
+
}
|
593
|
+
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
594
|
+
return this;
|
595
|
+
}
|
596
|
+
if (options.delegation) {
|
597
|
+
$(document)
|
598
|
+
.off('submit.form-plugin', this.selector, doAjaxSubmit)
|
599
|
+
.off('click.form-plugin', this.selector, captureSubmittingElement)
|
600
|
+
.on('submit.form-plugin', this.selector, options, doAjaxSubmit)
|
601
|
+
.on('click.form-plugin', this.selector, options, captureSubmittingElement);
|
602
|
+
return this;
|
603
|
+
}
|
604
|
+
return this.ajaxFormUnbind()
|
605
|
+
.bind('submit.form-plugin', options, doAjaxSubmit)
|
606
|
+
.bind('click.form-plugin', options, captureSubmittingElement);
|
607
|
+
};
|
608
|
+
|
609
|
+
function doAjaxSubmit(e) {
|
610
|
+
var options = e.data;
|
611
|
+
if (!e.isDefaultPrevented()) {
|
612
|
+
e.preventDefault();
|
613
|
+
$(e.target).ajaxSubmit(options);
|
614
|
+
}
|
615
|
+
}
|
616
|
+
|
617
|
+
function captureSubmittingElement(e) {
|
618
|
+
var target = e.target;
|
619
|
+
var $el = $(target);
|
620
|
+
if (!($el.is("[type=submit],[type=image]"))) {
|
621
|
+
var t = $el.closest('[type=submit]');
|
622
|
+
if (t.length === 0) {
|
623
|
+
return;
|
624
|
+
}
|
625
|
+
target = t[0];
|
626
|
+
}
|
627
|
+
var form = this;
|
628
|
+
form.clk = target;
|
629
|
+
if (target.type == 'image') {
|
630
|
+
if (e.offsetX !== undefined) {
|
631
|
+
form.clk_x = e.offsetX;
|
632
|
+
form.clk_y = e.offsetY;
|
633
|
+
} else if (typeof $.fn.offset == 'function') {
|
634
|
+
var offset = $el.offset();
|
635
|
+
form.clk_x = e.pageX - offset.left;
|
636
|
+
form.clk_y = e.pageY - offset.top;
|
637
|
+
} else {
|
638
|
+
form.clk_x = e.pageX - target.offsetLeft;
|
639
|
+
form.clk_y = e.pageY - target.offsetTop;
|
640
|
+
}
|
641
|
+
}
|
642
|
+
setTimeout(function() {
|
643
|
+
form.clk = form.clk_x = form.clk_y = null;
|
644
|
+
}, 100);
|
645
|
+
}
|
646
|
+
$.fn.ajaxFormUnbind = function() {
|
647
|
+
return this.unbind('submit.form-plugin click.form-plugin');
|
648
|
+
};
|
649
|
+
$.fn.formToArray = function(semantic, elements) {
|
650
|
+
var a = [];
|
651
|
+
if (this.length === 0) {
|
652
|
+
return a;
|
653
|
+
}
|
654
|
+
var form = this[0];
|
655
|
+
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
656
|
+
if (!els) {
|
657
|
+
return a;
|
658
|
+
}
|
659
|
+
var i, j, n, v, el, max, jmax;
|
660
|
+
for (i = 0, max = els.length; i < max; i++) {
|
661
|
+
el = els[i];
|
662
|
+
n = el.name;
|
663
|
+
if (!n || el.disabled) {
|
664
|
+
continue;
|
665
|
+
}
|
666
|
+
if (semantic && form.clk && el.type == "image") {
|
667
|
+
if (form.clk == el) {
|
668
|
+
a.push({
|
669
|
+
name: n,
|
670
|
+
value: $(el).val(),
|
671
|
+
type: el.type
|
672
|
+
});
|
673
|
+
a.push({
|
674
|
+
name: n + '.x',
|
675
|
+
value: form.clk_x
|
676
|
+
}, {
|
677
|
+
name: n + '.y',
|
678
|
+
value: form.clk_y
|
679
|
+
});
|
680
|
+
}
|
681
|
+
continue;
|
682
|
+
}
|
683
|
+
v = $.fieldValue(el, true);
|
684
|
+
if (v && v.constructor == Array) {
|
685
|
+
if (elements)
|
686
|
+
elements.push(el);
|
687
|
+
for (j = 0, jmax = v.length; j < jmax; j++) {
|
688
|
+
a.push({
|
689
|
+
name: n,
|
690
|
+
value: v[j]
|
691
|
+
});
|
692
|
+
}
|
693
|
+
} else if (feature.fileapi && el.type == 'file') {
|
694
|
+
if (elements)
|
695
|
+
elements.push(el);
|
696
|
+
var files = el.files;
|
697
|
+
if (files.length) {
|
698
|
+
for (j = 0; j < files.length; j++) {
|
699
|
+
a.push({
|
700
|
+
name: n,
|
701
|
+
value: files[j],
|
702
|
+
type: el.type
|
703
|
+
});
|
704
|
+
}
|
705
|
+
} else {
|
706
|
+
a.push({
|
707
|
+
name: n,
|
708
|
+
value: '',
|
709
|
+
type: el.type
|
710
|
+
});
|
711
|
+
}
|
712
|
+
} else if (v !== null && typeof v != 'undefined') {
|
713
|
+
if (elements)
|
714
|
+
elements.push(el);
|
715
|
+
a.push({
|
716
|
+
name: n,
|
717
|
+
value: v,
|
718
|
+
type: el.type,
|
719
|
+
required: el.required
|
720
|
+
});
|
721
|
+
}
|
722
|
+
}
|
723
|
+
if (!semantic && form.clk) {
|
724
|
+
var $input = $(form.clk),
|
725
|
+
input = $input[0];
|
726
|
+
n = input.name;
|
727
|
+
if (n && !input.disabled && input.type == 'image') {
|
728
|
+
a.push({
|
729
|
+
name: n,
|
730
|
+
value: $input.val()
|
731
|
+
});
|
732
|
+
a.push({
|
733
|
+
name: n + '.x',
|
734
|
+
value: form.clk_x
|
735
|
+
}, {
|
736
|
+
name: n + '.y',
|
737
|
+
value: form.clk_y
|
738
|
+
});
|
739
|
+
}
|
740
|
+
}
|
741
|
+
return a;
|
742
|
+
};
|
743
|
+
$.fn.formSerialize = function(semantic) {
|
744
|
+
return $.param(this.formToArray(semantic));
|
745
|
+
};
|
746
|
+
$.fn.fieldSerialize = function(successful) {
|
747
|
+
var a = [];
|
748
|
+
this.each(function() {
|
749
|
+
var n = this.name;
|
750
|
+
if (!n) {
|
751
|
+
return;
|
752
|
+
}
|
753
|
+
var v = $.fieldValue(this, successful);
|
754
|
+
if (v && v.constructor == Array) {
|
755
|
+
for (var i = 0, max = v.length; i < max; i++) {
|
756
|
+
a.push({
|
757
|
+
name: n,
|
758
|
+
value: v[i]
|
759
|
+
});
|
760
|
+
}
|
761
|
+
} else if (v !== null && typeof v != 'undefined') {
|
762
|
+
a.push({
|
763
|
+
name: this.name,
|
764
|
+
value: v
|
765
|
+
});
|
766
|
+
}
|
767
|
+
});
|
768
|
+
return $.param(a);
|
769
|
+
};
|
770
|
+
$.fn.fieldValue = function(successful) {
|
771
|
+
for (var val = [], i = 0, max = this.length; i < max; i++) {
|
772
|
+
var el = this[i];
|
773
|
+
var v = $.fieldValue(el, successful);
|
774
|
+
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
775
|
+
continue;
|
776
|
+
}
|
777
|
+
if (v.constructor == Array)
|
778
|
+
$.merge(val, v);
|
779
|
+
else
|
780
|
+
val.push(v);
|
781
|
+
}
|
782
|
+
return val;
|
783
|
+
};
|
784
|
+
$.fieldValue = function(el, successful) {
|
785
|
+
var n = el.name,
|
786
|
+
t = el.type,
|
787
|
+
tag = el.tagName.toLowerCase();
|
788
|
+
if (successful === undefined) {
|
789
|
+
successful = true;
|
790
|
+
}
|
791
|
+
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) {
|
792
|
+
return null;
|
793
|
+
}
|
794
|
+
if (tag == 'select') {
|
795
|
+
var index = el.selectedIndex;
|
796
|
+
if (index < 0) {
|
797
|
+
return null;
|
798
|
+
}
|
799
|
+
var a = [],
|
800
|
+
ops = el.options;
|
801
|
+
var one = (t == 'select-one');
|
802
|
+
var max = (one ? index + 1 : ops.length);
|
803
|
+
for (var i = (one ? index : 0); i < max; i++) {
|
804
|
+
var op = ops[i];
|
805
|
+
if (op.selected) {
|
806
|
+
var v = op.value;
|
807
|
+
if (!v) {
|
808
|
+
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
809
|
+
}
|
810
|
+
if (one) {
|
811
|
+
return v;
|
812
|
+
}
|
813
|
+
a.push(v);
|
814
|
+
}
|
815
|
+
}
|
816
|
+
return a;
|
817
|
+
}
|
818
|
+
return $(el).val();
|
819
|
+
};
|
820
|
+
$.fn.clearForm = function(includeHidden) {
|
821
|
+
return this.each(function() {
|
822
|
+
$('input,select,textarea', this).clearFields(includeHidden);
|
823
|
+
});
|
824
|
+
};
|
825
|
+
$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
|
826
|
+
var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;
|
827
|
+
return this.each(function() {
|
828
|
+
var t = this.type,
|
829
|
+
tag = this.tagName.toLowerCase();
|
830
|
+
if (re.test(t) || tag == 'textarea') {
|
831
|
+
this.value = '';
|
832
|
+
} else if (t == 'checkbox' || t == 'radio') {
|
833
|
+
this.checked = false;
|
834
|
+
} else if (tag == 'select') {
|
835
|
+
this.selectedIndex = -1;
|
836
|
+
} else if (t == "file") {
|
837
|
+
if (/MSIE/.test(navigator.userAgent)) {
|
838
|
+
$(this).replaceWith($(this).clone(true));
|
839
|
+
} else {
|
840
|
+
$(this).val('');
|
841
|
+
}
|
842
|
+
} else if (includeHidden) {
|
843
|
+
if ((includeHidden === true && /hidden/.test(t)) || (typeof includeHidden == 'string' && $(this).is(includeHidden)))
|
844
|
+
this.value = '';
|
845
|
+
}
|
846
|
+
});
|
847
|
+
};
|
848
|
+
$.fn.resetForm = function() {
|
849
|
+
return this.each(function() {
|
850
|
+
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
|
851
|
+
this.reset();
|
852
|
+
}
|
853
|
+
});
|
854
|
+
};
|
855
|
+
$.fn.enable = function(b) {
|
856
|
+
if (b === undefined) {
|
857
|
+
b = true;
|
858
|
+
}
|
859
|
+
return this.each(function() {
|
860
|
+
this.disabled = !b;
|
861
|
+
});
|
862
|
+
};
|
863
|
+
$.fn.selected = function(select) {
|
864
|
+
if (select === undefined) {
|
865
|
+
select = true;
|
866
|
+
}
|
867
|
+
return this.each(function() {
|
868
|
+
var t = this.type;
|
869
|
+
if (t == 'checkbox' || t == 'radio') {
|
870
|
+
this.checked = select;
|
871
|
+
} else if (this.tagName.toLowerCase() == 'option') {
|
872
|
+
var $sel = $(this).parent('select');
|
873
|
+
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
874
|
+
$sel.find('option').selected(false);
|
875
|
+
}
|
876
|
+
this.selected = select;
|
877
|
+
}
|
878
|
+
});
|
879
|
+
};
|
880
|
+
$.fn.ajaxSubmit.debug = false;
|
881
|
+
|
882
|
+
function log() {
|
883
|
+
if (!$.fn.ajaxSubmit.debug)
|
884
|
+
return;
|
885
|
+
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments, '');
|
886
|
+
if (window.console && window.console.log) {
|
887
|
+
window.console.log(msg);
|
888
|
+
} else if (window.opera && window.opera.postError) {
|
889
|
+
window.opera.postError(msg);
|
890
|
+
}
|
891
|
+
}
|
892
|
+
})((typeof(jQuery) != 'undefined') ? jQuery : window.Zepto);
|