update JQuery to 1.7 and jQuery form to 2.87
This commit is contained in:
parent
00757d8d33
commit
68a921c40e
|
@ -8,7 +8,7 @@
|
|||
<link href="./images/favicon.ico" rel="icon" />
|
||||
<link href="./images/favicon.png" rel="shortcut icon" />
|
||||
<link rel="apple-touch-icon" href="./images/webclip-icon.png"/>
|
||||
<script type="text/javascript" src="./javascript/jquery/jquery-1.6.4.min.js"></script>
|
||||
<script type="text/javascript" src="./javascript/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="./javascript/jquery/jqueryui-1.8.16.min.js"></script>
|
||||
<link rel="stylesheet" href="./style/jqueryui/jqueryui-1.8.16.css" type="text/css" media="all" />
|
||||
<!--
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
* jQuery Form Plugin
|
||||
* version: 2.84 (12-AUG-2011)
|
||||
* version: 2.87 (20-OCT-2011)
|
||||
* @requires jQuery v1.3.2 or later
|
||||
*
|
||||
* Examples and documentation at: http://malsup.com/jquery/form/
|
||||
|
@ -87,21 +87,15 @@ $.fn.ajaxSubmit = function(options) {
|
|||
return this;
|
||||
}
|
||||
|
||||
var n,v,a = this.formToArray(options.semantic);
|
||||
var traditional = options.traditional;
|
||||
if ( traditional === undefined ) {
|
||||
traditional = $.ajaxSettings.traditional;
|
||||
}
|
||||
|
||||
var qx,n,v,a = this.formToArray(options.semantic);
|
||||
if (options.data) {
|
||||
options.extraData = options.data;
|
||||
for (n in options.data) {
|
||||
if( $.isArray(options.data[n]) ) {
|
||||
for (var k in options.data[n]) {
|
||||
a.push( { name: n, value: options.data[n][k] } );
|
||||
}
|
||||
}
|
||||
else {
|
||||
v = options.data[n];
|
||||
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
|
||||
a.push( { name: n, value: v } );
|
||||
}
|
||||
}
|
||||
qx = $.param(options.data, traditional);
|
||||
}
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
|
@ -117,7 +111,9 @@ $.fn.ajaxSubmit = function(options) {
|
|||
return this;
|
||||
}
|
||||
|
||||
var q = $.param(a);
|
||||
var q = $.param(a, traditional);
|
||||
if (qx)
|
||||
q = ( q ? (q + '&' + qx) : qx );
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
|
@ -132,7 +128,7 @@ $.fn.ajaxSubmit = function(options) {
|
|||
callbacks.push(function() { $form.resetForm(); });
|
||||
}
|
||||
if (options.clearForm) {
|
||||
callbacks.push(function() { $form.clearForm(); });
|
||||
callbacks.push(function() { $form.clearForm(options.includeHidden); });
|
||||
}
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
|
@ -173,7 +169,7 @@ $.fn.ajaxSubmit = function(options) {
|
|||
}
|
||||
else {
|
||||
// IE7 massage (see issue 57)
|
||||
if ($.browser.msie && method == 'get') {
|
||||
if ($.browser.msie && method == 'get' && typeof options.type === "undefined") {
|
||||
var ieMeth = $form[0].getAttribute('method');
|
||||
if (typeof ieMeth === 'string')
|
||||
options.type = ieMeth;
|
||||
|
@ -192,11 +188,18 @@ $.fn.ajaxSubmit = function(options) {
|
|||
var useProp = !!$.fn.prop;
|
||||
|
||||
if (a) {
|
||||
// ensure that every serialized input is still enabled
|
||||
for (i=0; i < a.length; i++) {
|
||||
el = $(form[a[i].name]);
|
||||
el[ useProp ? 'prop' : 'attr' ]('disabled', false);
|
||||
}
|
||||
if ( useProp ) {
|
||||
// ensure that every serialized input is still enabled
|
||||
for (i=0; i < a.length; i++) {
|
||||
el = $(form[a[i].name]);
|
||||
el.prop('disabled', false);
|
||||
}
|
||||
} else {
|
||||
for (i=0; i < a.length; i++) {
|
||||
el = $(form[a[i].name]);
|
||||
el.removeAttr('disabled');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if ($(':input[name=submit],:input[id=submit]', form).length) {
|
||||
|
@ -433,8 +436,8 @@ $.fn.ajaxSubmit = function(options) {
|
|||
xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
|
||||
}
|
||||
|
||||
var dt = s.dataType || '';
|
||||
var scr = /(json|script|text)/.test(dt.toLowerCase());
|
||||
var dt = (s.dataType || '').toLowerCase();
|
||||
var scr = /(json|script|text)/.test(dt);
|
||||
if (scr || s.textarea) {
|
||||
// see if user embedded response in textarea
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
|
@ -449,19 +452,19 @@ $.fn.ajaxSubmit = function(options) {
|
|||
var pre = doc.getElementsByTagName('pre')[0];
|
||||
var b = doc.getElementsByTagName('body')[0];
|
||||
if (pre) {
|
||||
xhr.responseText = pre.textContent ? pre.textContent : pre.innerHTML;
|
||||
xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
|
||||
}
|
||||
else if (b) {
|
||||
xhr.responseText = b.innerHTML;
|
||||
xhr.responseText = b.textContent ? b.textContent : b.innerText;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
else if (dt == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
xhr.responseXML = toXml(xhr.responseText);
|
||||
}
|
||||
|
||||
try {
|
||||
data = httpData(xhr, s.dataType, s);
|
||||
data = httpData(xhr, dt, s);
|
||||
}
|
||||
catch (e) {
|
||||
status = 'parsererror';
|
||||
|
@ -823,20 +826,20 @@ $.fieldValue = function(el, successful) {
|
|||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
$.fn.clearForm = function(includeHidden) {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
$('input,select,textarea', this).clearFields(includeHidden);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements.
|
||||
*/
|
||||
$.fn.clearFields = $.fn.clearInputs = function() {
|
||||
$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
|
||||
var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
|
||||
return this.each(function() {
|
||||
var t = this.type, tag = this.tagName.toLowerCase();
|
||||
if (re.test(t) || tag == 'textarea') {
|
||||
if (re.test(t) || tag == 'textarea' || (includeHidden && /hidden/.test(t)) ) {
|
||||
this.value = '';
|
||||
}
|
||||
else if (t == 'checkbox' || t == 'radio') {
|
||||
|
@ -897,8 +900,13 @@ $.fn.selected = function(select) {
|
|||
});
|
||||
};
|
||||
|
||||
// expose debug var
|
||||
$.fn.ajaxSubmit.debug = false;
|
||||
|
||||
// helper fn for console logging
|
||||
function log() {
|
||||
if (!$.fn.ajaxSubmit.debug)
|
||||
return;
|
||||
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
||||
if (window.console && window.console.log) {
|
||||
window.console.log(msg);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue