Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
1f9e9e20
Commit
1f9e9e20
authored
Mar 22, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formplugin library 3.29.0-2013.03.22.
parent
0aa2a433
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1009 additions
and
546 deletions
+1009
-546
bt5/erp5_jquery_plugin_formplugin/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/formplugin/formplugin.js.xml
...ns/erp5_jquery/jquery/plugin/formplugin/formplugin.js.xml
+1000
-540
bt5/erp5_jquery_plugin_formplugin/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/formplugin/formplugin.min.js.xml
...rp5_jquery/jquery/plugin/formplugin/formplugin.min.js.xml
+7
-4
bt5/erp5_jquery_plugin_formplugin/bt/description
bt5/erp5_jquery_plugin_formplugin/bt/description
+1
-1
bt5/erp5_jquery_plugin_formplugin/bt/revision
bt5/erp5_jquery_plugin_formplugin/bt/revision
+1
-1
No files found.
bt5/erp5_jquery_plugin_formplugin/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/formplugin/formplugin.js.xml
View file @
1f9e9e20
...
@@ -6,9 +6,13 @@
...
@@ -6,9 +6,13 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts
54097163.4
7
</string>
</value>
<value>
<string>
ts
63959149.8
7
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
...
@@ -24,373 +28,714 @@
...
@@ -24,373 +28,714 @@
/*!\n
/*!\n
* jQuery Form Plugin\n
* jQuery Form Plugin\n
* version:
2.43 (12-MAR-2010)
\n
* version:
3.29.0-2013.03.22
\n
* @requires jQuery v1.
3.2
or later\n
* @requires jQuery v1.
5
or later\n
*\n
*\n
* Examples and documentation at: http://malsup.com/jquery/form/\n
* Examples and documentation at: http://malsup.com/jquery/form/\n
* Project repository: https://github.com/malsup/form\n
* Dual licensed under the MIT and GPL licenses:\n
* Dual licensed under the MIT and GPL licenses:\n
*
http://www.opensource.org/licenses/mit-license.php
\n
*
http://malsup.github.com/mit-license.txt
\n
*
http://www.gnu.org/licenses/gpl.html
\n
*
http://malsup.github.com/gpl-license-v2.txt
\n
*/\n
*/\n
/*global ActiveXObject alert */\n
;(function($) {\n
;(function($) {\n
"use strict";\n
\n
\n
/*\n
/*\n
\tUsage Note:\n
Usage Note:\n
\t-----------\n
-----------\n
\tDo not use both ajaxSubmit and ajaxForm on the same form. These\n
Do not use both ajaxSubmit and ajaxForm on the same form. These\n
\tfunctions are intended to be exclusive. Use ajaxSubmit if you want\n
functions are mutually exclusive. Use ajaxSubmit if you want\n
\tto bind your own submit handler to the form. For example,\n
to bind your own submit handler to the form. For example,\n
\n
\n
\t$(document).ready(function() {\n
$(document).ready(function() {\n
\t\t$(\'#myForm\').bind(\'submit\', function() {\n
$(\'#myForm\').on(\'submit\', function(e) {\n
\t\t\t$(this).ajaxSubmit({\n
e.preventDefault(); // <-- important\n
\t\t\t\ttarget: \'#output\'\n
$(this).ajaxSubmit({\n
\t\t\t});\n
target: \'#output\'\n
\t\t\treturn false; // <-- important!\n
});\n
\t\t});\n
});\n
\t});\n
});\n
\n
\n
\tUse ajaxForm when you want the plugin to manage all the event binding\n
Use ajaxForm when you want the plugin to manage all the event binding\n
\tfor you. For example,\n
for you. For example,\n
\n
\n
\t$(document).ready(function() {\n
$(document).ready(function() {\n
\t\t$(\'#myForm\').ajaxForm({\n
$(\'#myForm\').ajaxForm({\n
\t\t\ttarget: \'#output\'\n
target: \'#output\'\n
\t\t});\n
});\n
\t});\n
});\n
\n
\n
\tWhen using ajaxForm, the ajaxSubmit function will be invoked for you\n
You can also use ajaxForm with delegation (requires jQuery v1.7+), so the\n
\tat the appropriate time.\n
form does not have to exist when you invoke ajaxForm:\n
\n
$(\'#myForm\').ajaxForm({\n
delegation: true,\n
target: \'#output\'\n
});\n
\n
When using ajaxForm, the ajaxSubmit function will be invoked for you\n
at the appropriate time.\n
*/\n
*/\n
\n
\n
/**\n
* Feature detection\n
*/\n
var feature = {};\n
feature.fileapi = $("<input type=\'file\'/>
").get(0).files !== undefined;\n
feature.formdata = window.FormData !== undefined;\n
\n
/**\n
/**\n
* ajaxSubmit() provides a mechanism for immediately submitting\n
* ajaxSubmit() provides a mechanism for immediately submitting\n
* an HTML form using AJAX.\n
* an HTML form using AJAX.\n
*/\n
*/\n
$.fn.ajaxSubmit = function(options) {\n
$.fn.ajaxSubmit = function(options) {\n
\t// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n
/*jshint scripturl:true */\n
\tif (!this.length) {\n
\n
\t\tlog(\'ajaxSubmit: skipping submit process - no element selected\');\n
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)\n
\t\treturn this;\n
if (!this.length) {\n
\t}\n
log(\'ajaxSubmit: skipping submit process - no element selected\');\n
\n
return this;\n
\tif (typeof options == \'function\')\n
}\n
\t\toptions = { success: options };\n
\n
\n
var method, action, url, $form = this;\n
\tvar url = $.trim(this.attr(\'action\'));\n
\n
\tif (url) {\n
if (typeof options == \'function\') {\n
\t\t// clean url (don\'t include hash vaue)\n
options = { success: options };\n
\t\turl = (url.match(/^([^#]+)/)||[])[1];\n
}\n
\t}\n
\n
\turl = url || window.location.href || \'\';\n
method = this.attr(\'method\');\n
\n
action = this.attr(\'action\');\n
\toptions = $.extend({\n
url = (typeof action === \'string\') ? $.trim(action) : \'\';\n
\t\turl: url,\n
url = url || window.location.href || \'\';\n
\t\ttype: this.attr(\'method\') || \'GET\',\n
if (url) {\n
\t\tiframeSrc: /^https/i.test(window.location.href || \'\') ? \'javascript:false\' : \'about:blank\'\n
// clean url (don\'t include hash vaue)\n
\t}, options || {});\n
url = (url.match(/^([^#]+)/)||[])[1];\n
\n
}\n
\t// hook for manipulating the form data before it is extracted;\n
\n
\t// convenient for use with rich editors like tinyMCE or FCKEditor\n
options = $.extend(true, {\n
\tvar veto = {};\n
url: url,\n
\tthis.trigger(\'form-pre-serialize\', [this, options, veto]);\n
success: $.ajaxSettings.success,\n
\tif (veto.veto) {\n
type: method || \'GET\',\n
\t\tlog(\'ajaxSubmit: submit vetoed via form-pre-serialize trigger\');\n
iframeSrc: /^https/i.test(window.location.href || \'\') ? \'javascript:false\' : \'about:blank\'\n
\t\treturn this;\n
}, options);\n
\t}\n
\n
\n
// hook for manipulating the form data before it is extracted;\n
\t// provide opportunity to alter form data before it is serialized\n
// convenient for use with rich editors like tinyMCE or FCKEditor\n
\tif (options.beforeSerialize && options.beforeSerialize(this, options) === false) {\n
var veto = {};\n
\t\tlog(\'ajaxSubmit: submit aborted via beforeSerialize callback\');\n
this.trigger(\'form-pre-serialize\', [this, options, veto]);\n
\t\treturn this;\n
if (veto.veto) {\n
\t}\n
log(\'ajaxSubmit: submit vetoed via form-pre-serialize trigger\');\n
\n
return this;\n
\tvar a = this.formToArray(options.semantic);\n
}\n
\tif (options.data) {\n
\n
\t\toptions.extraData = options.data;\n
// provide opportunity to alter form data before it is serialized\n
\t\tfor (var n in options.data) {\n
if (options.beforeSerialize
&&
options.beforeSerialize(this, options) === false) {\n
\t\t if(options.data[n] instanceof Array) {\n
log(\'ajaxSubmit: submit aborted via beforeSerialize callback\');\n
\t\t\tfor (var k in options.data[n])\n
return this;\n
\t\t\t a.push( { name: n, value: options.data[n][k] } );\n
}\n
\t\t }\n
\n
\t\t else\n
var traditional = options.traditional;\n
\t\t\t a.push( { name: n, value: options.data[n] } );\n
if ( traditional === undefined ) {\n
\t\t}\n
traditional = $.ajaxSettings.traditional;\n
\t}\n
}\n
\n
\n
\t// give pre-submit callback an opportunity to abort the submit\n
var elements = [];\n
\tif (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {\n
var qx, a = this.formToArray(options.semantic, elements);\n
\t\tlog(\'ajaxSubmit: submit aborted via beforeSubmit callback\');\n
if (options.data) {\n
\t\treturn this;\n
options.extraData = options.data;\n
\t}\n
qx = $.param(options.data, traditional);\n
\n
}\n
\t// fire vetoable \'validate\' event\n
\n
\tthis.trigger(\'form-submit-validate\', [a, this, options, veto]);\n
// give pre-submit callback an opportunity to abort the submit\n
\tif (veto.veto) {\n
if (options.beforeSubmit
&&
options.beforeSubmit(a, this, options) === false) {\n
\t\tlog(\'ajaxSubmit: submit vetoed via form-submit-validate trigger\');\n
log(\'ajaxSubmit: submit aborted via beforeSubmit callback\');\n
\t\treturn this;\n
return this;\n
\t}\n
}\n
\n
\n
\tvar q = $.param(a);\n
// fire vetoable \'validate\' event\n
\n
this.trigger(\'form-submit-validate\', [a, this, options, veto]);\n
\tif (options.type.toUpperCase() == \'GET\') {\n
if (veto.veto) {\n
\t\toptions.url += (options.url.indexOf(\'?\') >
= 0 ? \'
&
\' : \'?\') + q;\n
log(\'ajaxSubmit: submit vetoed via form-submit-validate trigger\');\n
\t\toptions.data = null; // data is null for \'get\'\n
return this;\n
\t}\n
}\n
\telse\n
\n
\t\toptions.data = q; // data is the query string for \'post\'\n
var q = $.param(a, traditional);\n
\n
if (qx) {\n
\tvar $form = this, callbacks = [];\n
q = ( q ? (q + \'
&
\' + qx) : qx );\n
\tif (options.resetForm) callbacks.push(function() { $form.resetForm(); });\n
}\n
\tif (options.clearForm) callbacks.push(function() { $form.clearForm(); });\n
if (options.type.toUpperCase() == \'GET\') {\n
\n
options.url += (options.url.indexOf(\'?\') >= 0 ? \'
&
\' : \'?\') + q;\n
\t// perform a load on the target only if dataType is not provided\n
options.data = null; // data is null for \'get\'\n
\tif (!options.dataType
&&
options.target) {\n
}\n
\t\tvar oldSuccess = options.success || function(){};\n
else {\n
\t\tcallbacks.push(function(data) {\n
options.data = q; // data is the query string for \'post\'\n
\t\t\tvar fn = options.replaceTarget ? \'replaceWith\' : \'html\';\n
}\n
\t\t\t$(options.target)[fn](data).each(oldSuccess, arguments);\n
\n
\t\t});\n
var callbacks = [];\n
\t}\n
if (options.resetForm) {\n
\telse if (options.success)\n
callbacks.push(function() { $form.resetForm(); });\n
\t\tcallbacks.push(options.success);\n
}\n
\n
if (options.clearForm) {\n
\toptions.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg\n
callbacks.push(function() { $form.clearForm(options.includeHidden); });\n
\t\tfor (var i=0, max=callbacks.length; i
< max
;
i++)\n
}\n
\t\t\tcallbacks[i].apply(options,
[data,
status,
xhr
||
$form,
$form]);\n
\n
\t};\n
// perform a load on the target only if dataType is not provided\n
\n
if (!options.dataType
&&
options.target) {\n
\t//
are
there
files
to
upload?\n
var oldSuccess = options.success || function(){};\n
\tvar
files =
$(\'input:file\',
this).fieldValue();\n
callbacks.push(function(data) {\n
\tvar
found =
false;\n
var fn = options.replaceTarget ? \'replaceWith\' : \'html\';\n
\tfor
(var
j=
0;
j
<
files.length;
j++)\n
$(options.target)[fn](data).each(oldSuccess, arguments);\n
\t\tif
(files[j])\n
});\n
\t\t\
tfound =
true;\n
}\n
\n
else if (options.success) {\n
\tvar
multipart =
false;\n
callbacks.push(options.success);\n
//\tvar
mp =
\'multipart/form-data\';\n
}\n
//\
tmultipart =
($form.attr(\'enctype\')
==
mp
||
$form.attr(\'encoding\')
==
mp);\n
\n
\n
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg\n
\t//
options.iframe
allows
user
to
force
iframe
mode\n
var context = options.context || this ; // jQuery 1.4+ supports scope context\n
\t//
06-NOV-09:
now
defaulting
to
iframe
mode
if
file
input
is
detected\n
for (var i=0, max=callbacks.length; i
< max
;
i++)
{\n
if
((files.length
&&
options.iframe
!==
false)
||
options.iframe
||
found
||
multipart)
{\n
callbacks[i].apply(context,
[data,
status,
xhr
||
$form,
$form]);\n
\t
//
hack
to
fix
Safari
hang
(thanks
to
Tim
Molendijk
for
this)\n
}\n
\t
//
see:
http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n
};\n
\t
if
(options.closeKeepAlive)\n
\n
\t\t
$.get(options.closeKeepAlive,
fileUpload);\n
//
are
there
files
to
upload?\n
\t
else\n
\n
\t\t
fileUpload();\n
//
[value]
(issue
#113),
also
see
comment:\n
\t
}\n
//
https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219\n
else\n
var
fileInputs =
$(\'input[type=file]:enabled[value!=""]\',
this);\n
\t
$.ajax(options);\n
\n
\n
var
hasFileInputs =
fileInputs.length
>
0;\n
\t//
fire
\'notify\'
event\n
var mp = \'multipart/form-data\';\n
\tthis.trigger(\'form-submit-notify\',
[this,
options]);\n
var multipart = ($form.attr(\'enctype\') == mp || $form.attr(\'encoding\') == mp);\n
\treturn
this;\n
\n
\n
var fileAPI = feature.fileapi
&&
feature.formdata;\n
\n
log("fileAPI :" + fileAPI);\n
\t//
private
function
for
handling
file
uploads
(hat
tip
to
YAHOO!)\n
var shouldUseFrame = (hasFileInputs || multipart)
&&
!fileAPI;\n
\tfunction
fileUpload()
{\n
\n
\t\tvar
form =
$form[0];\n
var jqxhr;\n
\n
\n
\t\tif
($(\':input[
name=
submit]\',
form).length)
{\n
// options.iframe allows user to force iframe mode\n
\t\t\talert(\'Error:
Form
elements
must
not
be
named
"submit".\');\n
// 06-NOV-09: now defaulting to iframe mode if file input is detected\n
\t\t\treturn;\n
if (options.iframe !== false
&&
(options.iframe || shouldUseFrame)) {\n
\t\t}\n
// hack to fix Safari hang (thanks to Tim Molendijk for this)\n
\n
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d\n
\t\tvar
opts =
$.extend({},
$.ajaxSettings,
options);\n
if (options.closeKeepAlive) {\n
\t\tvar
s =
$.extend(true,
{},
$.extend(true,
{},
$.ajaxSettings),
opts);\n
$.get(options.closeKeepAlive, function() {\n
\n
jqxhr = fileUploadIframe(a);\n
\t\tvar
id =
\'jqFormIO\'
+
(new
Date().getTime());\n
});\n
\t\tvar
$
io =
$(\'<iframe
id=
"\' + id + \'"
name=
"\' + id + \'"
src=
"\'+ opts.iframeSrc +\'"
onload=
"(jQuery(this).data(\\\'form-plugin-onload\\\'))()"
/>
\');\n
}\n
\t\tvar io = $io[0];\n
else {\n
\n
jqxhr = fileUploadIframe(a);\n
\t\t$io.css({ position: \'absolute\', top: \'-1000px\', left: \'-1000px\' });\n
}\n
\n
}\n
\t\tvar xhr = { // mock object\n
else if ((hasFileInputs || multipart)
&&
fileAPI) {\n
\t\t\taborted: 0,\n
jqxhr = fileUploadXhr(a);\n
\t\t\tresponseText: null,\n
}\n
\t\t\tresponseXML: null,\n
else {\n
\t\t\tstatus: 0,\n
jqxhr = $.ajax(options);\n
\t\t\tstatusText: \'n/a\',\n
}\n
\t\t\tgetAllResponseHeaders: function() {},\n
\n
\t\t\tgetResponseHeader: function() {},\n
$form.removeData(\'jqxhr\').data(\'jqxhr\', jqxhr);\n
\t\t\tsetRequestHeader: function() {},\n
\n
\t\t\tabort: function() {\n
// clear element array\n
\t\t\t\tthis.aborted = 1;\n
for (var k=0; k
< elements.length
;
k++)\n
\t\t\t\t$io.attr(\'src\', opts.iframeSrc); // abort op in progress\n
elements[k]
=
null;\n
\t\t\t}\n
\n
\t\t};\n
//
fire
\'notify\'
event\n
\n
this.trigger(\'form-submit-notify\',
[this,
options]);\n
\t\tvar g = opts.global;\n
return
this;\n
\t\t// trigger ajax global events so that activity/block indicators work like normal\n
\n
\t\tif (g
&&
! $.active++) $.event.trigger("ajaxStart");\n
//
utility
fn
for
deep
serialization\n
\t\tif (g) $.event.trigger("ajaxSend", [xhr, opts]);\n
function
deepSerialize(extraData){\n
\n
var
serialized =
$.param(extraData).split(\'&\');\n
\t\tif (s.beforeSend
&&
s.beforeSend(xhr, s) === false) {\n
var
len =
serialized.length;\n
\t\t\ts.global
&&
$.active--;\n
var
result =
[];\n
\t\t\treturn;\n
var
i,
part;\n
\t\t}\n
for
(
i=
0;
i
<
len;
i++)
{\n
\t\tif (xhr.aborted)\n
//
#252;
undo
param
space
replacement\n
\t\t\treturn;\n
serialized[i]
=
serialized[i].replace(/\\+/g,\'
\');\n
\n
part =
serialized[i].split(\'=\');\n
\t\tvar cbInvoked = false;\n
//
#278;
use
array
instead
of
object
storage,
favoring
array
serializations\n
\t\tvar timedOut = 0;\n
result.push([decodeURIComponent(part[0]),
decodeURIComponent(part[1])]);\n
\n
}\n
\t\t// add submitting element to data if we know it\n
return
result;\n
\t\tvar sub = form.clk;\n
}\n
\t\tif (sub) {\n
\n
\t\t\tvar n = sub.name;\n
//
XMLHttpRequest
Level
2
file
uploads
(big
hat
tip
to
francois2metz)\n
\t\t\tif (n
&&
!sub.disabled) {\n
function
fileUploadXhr(a)
{\n
\t\t\t\topts.extraData = opts.extraData || {};\n
var
formdata =
new
FormData();\n
\t\t\t\topts.extraData[n] = sub.value;\n
\n
\t\t\t\tif (sub.type == "image") {\n
for
(var
i=
0;
i
<
a.length;
i++)
{\n
\t\t\t\t\topts.extraData[n+\'.x\'] = form.clk_x;\n
formdata.append(a[i].name,
a[i].value);\n
\t\t\t\t\topts.extraData[n+\'.y\'] = form.clk_y;\n
}\n
\t\t\t\t}\n
\n
\t\t\t}\n
if
(options.extraData)
{\n
\t\t}\n
var
serializedData =
deepSerialize(options.extraData);\n
\n
for
(
i=
0;
i
<
serializedData.length;
i++)\n
\t\t// take a breath so that pending repaints get some cpu time before the upload starts\n
if
(serializedData[i])\n
\t\tfunction doSubmit() {\n
formdata.append(serializedData[i][0],
serializedData[i][1]);\n
\t\t\t// make sure form attrs are set\n
}\n
\t\t\tvar t = $form.attr(\'target\'), a = $form.attr(\'action\');\n
\n
\n
options.data =
null;\n
\t\t\t// update form attrs in IE friendly way\n
\n
\t\t\tform.setAttribute(\'target\',id);\n
var
s =
$.extend(true,
{},
$.ajaxSettings,
options,
{\n
\t\t\tif (form.getAttribute(\'method\') != \'POST\')\n
contentType:
false,\n
\t\t\t\tform.setAttribute(\'method\', \'POST\');\n
processData:
false,\n
\t\t\tif (form.getAttribute(\'action\') != opts.url)\n
cache:
false,\n
\t\t\t\tform.setAttribute(\'action\', opts.url);\n
type:
method
||
\'POST\'\n
\n
});\n
\t\t\t// ie borks in some cases when setting encoding\n
\n
\t\t\tif (! opts.skipEncodingOverride) {\n
if
(options.uploadProgress)
{\n
\t\t\t\t$form.attr({\n
//
workaround
because
jqXHR
does
not
expose
upload
property\n
\t\t\t\t\tencoding: \'multipart/form-data\',\n
s.xhr =
function()
{\n
\t\t\t\t\tenctype: \'multipart/form-data\'\n
var
xhr =
jQuery.ajaxSettings.xhr();\n
\t\t\t\t});\n
if
(xhr.upload)
{\n
\t\t\t}\n
xhr.upload.addEventListener(\'progress\',
function(event)
{\n
\n
var
percent =
0;\n
\t\t\t// support timout\n
var
position =
event.loaded
||
event.position;
/*event.position
is
deprecated*/\n
\t\t\tif (opts.timeout)\n
var
total =
event.total;\n
\t\t\t\tsetTimeout(function() { timedOut = true; cb(); }, opts.timeout);\n
if
(event.lengthComputable)
{\n
\n
percent =
Math.ceil(position
/
total
*
100);\n
\t\t\t// add "extra" data to form if provided in options\n
}\n
\t\t\tvar extraInputs = [];\n
options.uploadProgress(event,
position,
total,
percent);\n
\t\t\ttry {\n
},
false);\n
\t\t\t\tif (opts.extraData)\n
}\n
\t\t\t\t\tfor (var n in opts.extraData)\n
return
xhr;\n
\t\t\t\t\t\textraInputs.push(\n
};\n
\t\t\t\t\t\t\t$(\'
<input
type=
"hidden"
name=
"\'+n+\'"
value=
"\'+opts.extraData[n]+\'"
/>
\')\n
}\n
\t\t\t\t\t\t\t\t.appendTo(form)[0]);\n
\n
\n
s.data =
null;\n
\t\t\t\t// add iframe to doc and submit the form\n
var
beforeSend =
s.beforeSend;\n
\t\t\t\t$io.appendTo(\'body\');\n
s.beforeSend =
function(xhr,
o)
{\n
\t\t\t\t$io.data(\'form-plugin-onload\', cb);\n
o.data =
formdata;\n
\t\t\t\tform.submit();\n
if(beforeSend)\n
\t\t\t}\n
beforeSend.call(this,
xhr,
o);\n
\t\t\tfinally {\n
};\n
\t\t\t\t// reset attrs and remove "extra" input elements\n
return
$.ajax(s);\n
\t\t\t\tform.setAttribute(\'action\',a);\n
}\n
\t\t\t\tt ? form.setAttribute(\'target\', t) : $form.removeAttr(\'target\');\n
\n
\t\t\t\t$(extraInputs).remove();\n
//
private
function
for
handling
file
uploads
(hat
tip
to
YAHOO!)\n
\t\t\t}\n
function
fileUploadIframe(a)
{\n
\t\t};\n
var
form =
$form[0],
el,
i,
s,
g,
id,
$io,
io,
xhr,
sub,
n,
timedOut,
timeoutHandle;\n
\n
var
useProp =
!!$.fn.prop;\n
\t\tif (opts.forceSync)\n
var
deferred =
$.Deferred();\n
\t\t\tdoSubmit();\n
\n
\t\telse\n
if
(a)
{\n
\t\t\tsetTimeout(doSubmit, 10); // this lets dom updates render\n
//
ensure
that
every
serialized
input
is
still
enabled\n
\t\n
for
(
i=
0;
i
<
elements.length;
i++)
{\n
\t\tvar domCheckCount = 100;\n
el =
$(elements[i]);\n
\n
if
(
useProp
)\n
\t\tfunction cb() {\n
el.prop(\'disabled\',
false);\n
\t\t\tif (cbInvoked) \n
else\n
\t\t\t\treturn;\n
el.removeAttr(\'disabled\');\n
\n
}\n
\t\t\tvar ok = true;\n
}\n
\t\t\ttry {\n
\n
\t\t\t\tif (timedOut) throw \'timeout\';\n
s =
$.extend(true,
{},
$.ajaxSettings,
options);\n
\t\t\t\t// extract the server response from the iframe\n
s.context =
s.context
||
s;\n
\t\t\t\tvar data, doc;\n
id =
\'jqFormIO\'
+
(new
Date().getTime());\n
\n
if
(s.iframeTarget)
{\n
\t\t\t\tdoc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;\n
$
io =
$(s.iframeTarget);\n
\t\t\t\t\n
n =
$io.attr(\'name\');\n
\t\t\t\tvar isXml = opts.dataType == \'xml\' || doc.XMLDocument || $.isXMLDoc(doc);\n
if
(!n)\n
\t\t\t\tlog(\'isXml=\'+isXml);\n
$io.attr(\'name\',
id);\n
\t\t\t\tif (!isXml
&&
(doc.body == null || doc.body.innerHTML == \'\')) {\n
else\n
\t\t\t\t \tif (--domCheckCount) {\n
id =
n;\n
\t\t\t\t\t\t// in some browsers (Opera) the iframe DOM is not always traversable when\n
}\n
\t\t\t\t\t\t// the onload callback fires, so we loop a bit to accommodate\n
else
{\n
\t\t\t\t \t\tlog(\'requeing onLoad callback, DOM not available\');\n
$
io =
$(\'<iframe
name=
"\' + id + \'"
src=
"\'+ s.iframeSrc +\'"
/>
\');\n
\t\t\t\t\t\tsetTimeout(cb, 250);\n
$io.css({ position: \'absolute\', top: \'-1000px\', left: \'-1000px\' });\n
\t\t\t\t\t\treturn;\n
}\n
\t\t\t\t\t}\n
io = $io[0];\n
\t\t\t\t\tlog(\'Could not access iframe DOM after 100 tries.\');\n
\n
\t\t\t\t\treturn;\n
\n
\t\t\t\t}\n
xhr = { // mock object\n
\n
aborted: 0,\n
\t\t\t\tlog(\'response detected\');\n
responseText: null,\n
\t\t\t\tcbInvoked = true;\n
responseXML: null,\n
\t\t\t\txhr.responseText = doc.body ? doc.body.innerHTML : null;\n
status: 0,\n
\t\t\t\txhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n
statusText: \'n/a\',\n
\t\t\t\txhr.getResponseHeader = function(header){\n
getAllResponseHeaders: function() {},\n
\t\t\t\t\tvar headers = {\'content-type\': opts.dataType};\n
getResponseHeader: function() {},\n
\t\t\t\t\treturn headers[header];\n
setRequestHeader: function() {},\n
\t\t\t\t};\n
abort: function(status) {\n
\n
var e = (status === \'timeout\' ? \'timeout\' : \'aborted\');\n
\t\t\t\tif (opts.dataType == \'json\' || opts.dataType == \'script\') {\n
log(\'aborting upload... \' + e);\n
\t\t\t\t\t// see if user embedded response in textarea\n
this.aborted = 1;\n
\t\t\t\t\tvar ta = doc.getElementsByTagName(\'textarea\')[0];\n
\n
\t\t\t\t\tif (ta)\n
try { // #214, #257\n
\t\t\t\t\t\txhr.responseText = ta.value;\n
if (io.contentWindow.document.execCommand) {\n
\t\t\t\t\telse {\n
io.contentWindow.document.execCommand(\'Stop\');\n
\t\t\t\t\t\t// account for browsers injecting pre around json response\n
}\n
\t\t\t\t\t\tvar pre = doc.getElementsByTagName(\'pre\')[0];\n
}\n
\t\t\t\t\t\tif (pre)\n
catch(ignore) {}\n
\t\t\t\t\t\t\txhr.responseText = pre.innerHTML;\n
\n
\t\t\t\t\t}\t\t\t \n
$io.attr(\'src\', s.iframeSrc); // abort op in progress\n
\t\t\t\t}\n
xhr.error = e;\n
\t\t\t\telse if (opts.dataType == \'xml\'
&&
!xhr.responseXML
&&
xhr.responseText != null) {\n
if (s.error)\n
\t\t\t\t\txhr.responseXML = toXml(xhr.responseText);\n
s.error.call(s.context, xhr, e, status);\n
\t\t\t\t}\n
if (g)\n
\t\t\t\tdata = $.httpData(xhr, opts.dataType);\n
$.event.trigger("ajaxError", [xhr, s, e]);\n
\t\t\t}\n
if (s.complete)\n
\t\t\tcatch(e){\n
s.complete.call(s.context, xhr, e);\n
\t\t\t\tlog(\'error caught:\',e);\n
}\n
\t\t\t\tok = false;\n
};\n
\t\t\t\txhr.error = e;\n
\n
\t\t\t\t$.handleError(opts, xhr, \'error\', e);\n
g = s.global;\n
\t\t\t}\n
// trigger ajax global events so that activity/block indicators work like normal\n
\n
if (g
&&
0 === $.active++) {\n
\t\t\t// ordering of these callbacks/triggers is odd, but that\'s how $.ajax does it\n
$.event.trigger("ajaxStart");\n
\t\t\tif (ok) {\n
}\n
\t\t\t\topts.success(data, \'success\');\n
if (g) {\n
\t\t\t\tif (g) $.event.trigger("ajaxSuccess", [xhr, opts]);\n
$.event.trigger("ajaxSend", [xhr, s]);\n
\t\t\t}\n
}\n
\t\t\tif (g) $.event.trigger("ajaxComplete", [xhr, opts]);\n
\n
\t\t\tif (g
&&
! --$.active) $.event.trigger("ajaxStop");\n
if (s.beforeSend
&&
s.beforeSend.call(s.context, xhr, s) === false) {\n
\t\t\tif (opts.complete) opts.complete(xhr, ok ? \'success\' : \'error\');\n
if (s.global) {\n
\n
$.active--;\n
\t\t\t// clean up\n
}\n
\t\t\tsetTimeout(function() {\n
deferred.reject();\n
\t\t\t\t$io.removeData(\'form-plugin-onload\');\n
return deferred;\n
\t\t\t\t$io.remove();\n
}\n
\t\t\t\txhr.responseXML = null;\n
if (xhr.aborted) {\n
\t\t\t}, 100);\n
deferred.reject();\n
\t\t};\n
return deferred;\n
\n
}\n
\t\tfunction toXml(s, doc) {\n
\n
\t\t\tif (window.ActiveXObject) {\n
// add submitting element to data if we know it\n
\t\t\t\tdoc = new ActiveXObject(\'Microsoft.XMLDOM\');\n
sub = form.clk;\n
\t\t\t\tdoc.async = \'false\';\n
if (sub) {\n
\t\t\t\tdoc.loadXML(s);\n
n = sub.name;\n
\t\t\t}\n
if (n
&&
!sub.disabled) {\n
\t\t\telse\n
s.extraData = s.extraData || {};\n
\t\t\t\tdoc = (new DOMParser()).parseFromString(s, \'text/xml\');\n
s.extraData[n] = sub.value;\n
\t\t\treturn (doc
&&
doc.documentElement
&&
doc.documentElement.tagName != \'parsererror\') ? doc : null;\n
if (sub.type == "image") {\n
\t\t};\n
s.extraData[n+\'.x\'] = form.clk_x;\n
\t};\n
s.extraData[n+\'.y\'] = form.clk_y;\n
}\n
}\n
}\n
\n
var CLIENT_TIMEOUT_ABORT = 1;\n
var SERVER_ABORT = 2;\n
\n
function getDoc(frame) {\n
var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;\n
return doc;\n
}\n
\n
// Rails CSRF hack (thanks to Yvan Barthelemy)\n
var csrf_token = $(\'meta[name=csrf-token]\').attr(\'content\');\n
var csrf_param = $(\'meta[name=csrf-param]\').attr(\'content\');\n
if (csrf_param
&&
csrf_token) {\n
s.extraData = s.extraData || {};\n
s.extraData[csrf_param] = csrf_token;\n
}\n
\n
// take a breath so that pending repaints get some cpu time before the upload starts\n
function doSubmit() {\n
// make sure form attrs are set\n
var t = $form.attr(\'target\'), a = $form.attr(\'action\');\n
\n
// update form attrs in IE friendly way\n
form.setAttribute(\'target\',id);\n
if (!method) {\n
form.setAttribute(\'method\', \'POST\');\n
}\n
if (a != s.url) {\n
form.setAttribute(\'action\', s.url);\n
}\n
\n
// ie borks in some cases when setting encoding\n
if (! s.skipEncodingOverride
&&
(!method || /post/i.test(method))) {\n
$form.attr({\n
encoding: \'multipart/form-data\',\n
enctype: \'multipart/form-data\'\n
});\n
}\n
\n
// support timout\n
if (s.timeout) {\n
timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);\n
}\n
\n
// look for server aborts\n
function checkState() {\n
try {\n
var state = getDoc(io).readyState;\n
log(\'state = \' + state);\n
if (state
&&
state.toLowerCase() == \'uninitialized\')\n
setTimeout(checkState,50);\n
}\n
catch(e) {\n
log(\'Server abort: \' , e, \' (\', e.name, \')\');\n
cb(SERVER_ABORT);\n
if (timeoutHandle)\n
clearTimeout(timeoutHandle);\n
timeoutHandle = undefined;\n
}\n
}\n
\n
// add "extra" data to form if provided in options\n
var extraInputs = [];\n
try {\n
if (s.extraData) {\n
for (var n in s.extraData) {\n
if (s.extraData.hasOwnProperty(n)) {\n
// if using the $.param format that allows for multiple values with the same name\n
if($.isPlainObject(s.extraData[n])
&&
s.extraData[n].hasOwnProperty(\'name\')
&&
s.extraData[n].hasOwnProperty(\'value\')) {\n
extraInputs.push(\n
$(\'
<input
type=
"hidden"
name=
"\'+s.extraData[n].name+\'"
>
\').val(s.extraData[n].value)\n
.appendTo(form)[0]);\n
} else {\n
extraInputs.push(\n
$(\'
<input
type=
"hidden"
name=
"\'+n+\'"
>
\').val(s.extraData[n])\n
.appendTo(form)[0]);\n
}\n
}\n
}\n
}\n
\n
if (!s.iframeTarget) {\n
// add iframe to doc and submit the form\n
$io.appendTo(\'body\');\n
if (io.attachEvent)\n
io.attachEvent(\'onload\', cb);\n
else\n
io.addEventListener(\'load\', cb, false);\n
}\n
setTimeout(checkState,15);\n
\n
try {\n
form.submit();\n
} catch(err) {\n
// just in case form has element with name/id of \'submit\'\n
var submitFn = document.createElement(\'form\').submit;\n
submitFn.apply(form);\n
}\n
}\n
finally {\n
// reset attrs and remove "extra" input elements\n
form.setAttribute(\'action\',a);\n
if(t) {\n
form.setAttribute(\'target\', t);\n
} else {\n
$form.removeAttr(\'target\');\n
}\n
$(extraInputs).remove();\n
}\n
}\n
\n
if (s.forceSync) {\n
doSubmit();\n
}\n
else {\n
setTimeout(doSubmit, 10); // this lets dom updates render\n
}\n
\n
var data, doc, domCheckCount = 50, callbackProcessed;\n
\n
function cb(e) {\n
if (xhr.aborted || callbackProcessed) {\n
return;\n
}\n
try {\n
doc = getDoc(io);\n
}\n
catch(ex) {\n
log(\'cannot access response document: \', ex);\n
e = SERVER_ABORT;\n
}\n
if (e === CLIENT_TIMEOUT_ABORT
&&
xhr) {\n
xhr.abort(\'timeout\');\n
deferred.reject(xhr, \'timeout\');\n
return;\n
}\n
else if (e == SERVER_ABORT
&&
xhr) {\n
xhr.abort(\'server abort\');\n
deferred.reject(xhr, \'error\', \'server abort\');\n
return;\n
}\n
\n
if (!doc || doc.location.href == s.iframeSrc) {\n
// response not received yet\n
if (!timedOut)\n
return;\n
}\n
if (io.detachEvent)\n
io.detachEvent(\'onload\', cb);\n
else\n
io.removeEventListener(\'load\', cb, false);\n
\n
var status = \'success\', errMsg;\n
try {\n
if (timedOut) {\n
throw \'timeout\';\n
}\n
\n
var isXml = s.dataType == \'xml\' || doc.XMLDocument || $.isXMLDoc(doc);\n
log(\'isXml=\'+isXml);\n
if (!isXml
&&
window.opera
&&
(doc.body === null || !doc.body.innerHTML)) {\n
if (--domCheckCount) {\n
// in some browsers (Opera) the iframe DOM is not always traversable when\n
// the onload callback fires, so we loop a bit to accommodate\n
log(\'requeing onLoad callback, DOM not available\');\n
setTimeout(cb, 250);\n
return;\n
}\n
// let this fall through because server response could be an empty document\n
//log(\'Could not access iframe DOM after mutiple tries.\');\n
//throw \'DOMException: not available\';\n
}\n
\n
//log(\'response detected\');\n
var docRoot = doc.body ? doc.body : doc.documentElement;\n
xhr.responseText = docRoot ? docRoot.innerHTML : null;\n
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;\n
if (isXml)\n
s.dataType = \'xml\';\n
xhr.getResponseHeader = function(header){\n
var headers = {\'content-type\': s.dataType};\n
return headers[header];\n
};\n
// support for XHR \'status\'
&
\'statusText\' emulation :\n
if (docRoot) {\n
xhr.status = Number( docRoot.getAttribute(\'status\') ) || xhr.status;\n
xhr.statusText = docRoot.getAttribute(\'statusText\') || xhr.statusText;\n
}\n
\n
var dt = (s.dataType || \'\').toLowerCase();\n
var scr = /(json|script|text)/.test(dt);\n
if (scr || s.textarea) {\n
// see if user embedded response in textarea\n
var ta = doc.getElementsByTagName(\'textarea\')[0];\n
if (ta) {\n
xhr.responseText = ta.value;\n
// support for XHR \'status\'
&
\'statusText\' emulation :\n
xhr.status = Number( ta.getAttribute(\'status\') ) || xhr.status;\n
xhr.statusText = ta.getAttribute(\'statusText\') || xhr.statusText;\n
}\n
else if (scr) {\n
// account for browsers injecting pre around json response\n
var pre = doc.getElementsByTagName(\'pre\')[0];\n
var b = doc.getElementsByTagName(\'body\')[0];\n
if (pre) {\n
xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;\n
}\n
else if (b) {\n
xhr.responseText = b.textContent ? b.textContent : b.innerText;\n
}\n
}\n
}\n
else if (dt == \'xml\'
&&
!xhr.responseXML
&&
xhr.responseText) {\n
xhr.responseXML = toXml(xhr.responseText);\n
}\n
\n
try {\n
data = httpData(xhr, dt, s);\n
}\n
catch (err) {\n
status = \'parsererror\';\n
xhr.error = errMsg = (err || status);\n
}\n
}\n
catch (err) {\n
log(\'error caught: \',err);\n
status = \'error\';\n
xhr.error = errMsg = (err || status);\n
}\n
\n
if (xhr.aborted) {\n
log(\'upload aborted\');\n
status = null;\n
}\n
\n
if (xhr.status) { // we\'ve set xhr.status\n
status = (xhr.status >= 200
&&
xhr.status
< 300
||
xhr.status =
==
304)
?
\'success\'
:
\'error\';\n
}\n
\n
//
ordering
of
these
callbacks/triggers
is
odd,
but
that\'s
how
$.ajax
does
it\n
if
(
status =
==
\'success\')
{\n
if
(s.success)\n
s.success.call(s.context,
data,
\'success\',
xhr);\n
deferred.resolve(xhr.responseText,
\'success\',
xhr);\n
if
(g)\n
$.event.trigger("ajaxSuccess",
[xhr,
s]);\n
}\n
else
if
(status)
{\n
if
(
errMsg =
==
undefined)\n
errMsg =
xhr.statusText;\n
if
(s.error)\n
s.error.call(s.context,
xhr,
status,
errMsg);\n
deferred.reject(xhr,
\'error\',
errMsg);\n
if
(g)\n
$.event.trigger("ajaxError",
[xhr,
s,
errMsg]);\n
}\n
\n
if
(g)\n
$.event.trigger("ajaxComplete",
[xhr,
s]);\n
\n
if
(g
&&
!
--$.active)
{\n
$.event.trigger("ajaxStop");\n
}\n
\n
if
(s.complete)\n
s.complete.call(s.context,
xhr,
status);\n
\n
callbackProcessed =
true;\n
if
(s.timeout)\n
clearTimeout(timeoutHandle);\n
\n
//
clean
up\n
setTimeout(function()
{\n
if
(!s.iframeTarget)\n
$io.remove();\n
xhr.responseXML =
null;\n
},
100);\n
}\n
\n
var
toXml =
$.parseXML
||
function(s,
doc)
{
//
use
parseXML
if
available
(jQuery
1.5+)\n
if
(window.ActiveXObject)
{\n
doc =
new
ActiveXObject(\'Microsoft.XMLDOM\');\n
doc.async =
\'false\';\n
doc.loadXML(s);\n
}\n
else
{\n
doc =
(new
DOMParser()).parseFromString(s,
\'text/xml\');\n
}\n
return
(doc
&&
doc.documentElement
&&
doc.documentElement.nodeName
!=
\'parsererror\')
?
doc
:
null;\n
};\n
var
parseJSON =
$.parseJSON
||
function(s)
{\n
/*jslint
evil:true
*/\n
return
window[\'eval\'](\'(\'
+
s
+
\')\');\n
};\n
\n
var
httpData =
function(
xhr,
type,
s
)
{
//
mostly
lifted
from
jq1.4.4\n
\n
var
ct =
xhr.getResponseHeader(\'content-type\')
||
\'\',\n
xml =
type
===
\'xml\'
||
!type
&&
ct.indexOf(\'xml\')
>
= 0,\n
data = xml ? xhr.responseXML : xhr.responseText;\n
\n
if (xml
&&
data.documentElement.nodeName === \'parsererror\') {\n
if ($.error)\n
$.error(\'parsererror\');\n
}\n
if (s
&&
s.dataFilter) {\n
data = s.dataFilter(data, type);\n
}\n
if (typeof data === \'string\') {\n
if (type === \'json\' || !type
&&
ct.indexOf(\'json\') >= 0) {\n
data = parseJSON(data);\n
} else if (type === "script" || !type
&&
ct.indexOf("javascript") >= 0) {\n
$.globalEval(data);\n
}\n
}\n
return data;\n
};\n
\n
return deferred;\n
}\n
};\n
};\n
\n
\n
/**\n
/**\n
...
@@ -399,9 +744,9 @@ $.fn.ajaxSubmit = function(options) {\n
...
@@ -399,9 +744,9 @@ $.fn.ajaxSubmit = function(options) {\n
* The advantages of using this method instead of ajaxSubmit() are:\n
* The advantages of using this method instead of ajaxSubmit() are:\n
*\n
*\n
* 1: This method will include coordinates for
<input
type=
"image"
/>
elements (if the element\n
* 1: This method will include coordinates for
<input
type=
"image"
/>
elements (if the element\n
*
\t
is used to submit the form).\n
*
is used to submit the form).\n
* 2. This method will include the submit element\'s name/value data (for the element that was\n
* 2. This method will include the submit element\'s name/value data (for the element that was\n
*
\t
used to submit the form).\n
*
used to submit the form).\n
* 3. This method binds the submit() method to the form for you.\n
* 3. This method binds the submit() method to the form for you.\n
*\n
*\n
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely\n
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely\n
...
@@ -409,42 +754,83 @@ $.fn.ajaxSubmit = function(options) {\n
...
@@ -409,42 +754,83 @@ $.fn.ajaxSubmit = function(options) {\n
* the form itself.\n
* the form itself.\n
*/\n
*/\n
$.fn.ajaxForm = function(options) {\n
$.fn.ajaxForm = function(options) {\n
\treturn this.ajaxFormUnbind().bind(\'submit.form-plugin\', function(e) {\n
options = options || {};\n
\t\te.preventDefault();\n
options.delegation = options.delegation
&&
$.isFunction($.fn.on);\n
\t\t$(this).ajaxSubmit(options);\n
\n
\t}).bind(\'click.form-plugin\', function(e) {\n
// in jQuery 1.3+ we can fix mistakes with the ready state\n
\t\tvar target = e.target;\n
if (!options.delegation
&&
this.length === 0) {\n
\t\tvar $el = $(target);\n
var o = { s: this.selector, c: this.context };\n
\t\tif (!($el.is(":submit,input:image"))) {\n
if (!$.isReady
&&
o.s) {\n
\t\t\t// is this a child element of the submit el? (ex: a span within a button)\n
log(\'DOM not ready, queuing ajaxForm\');\n
\t\t\tvar t = $el.closest(\':submit\');\n
$(function() {\n
\t\t\tif (t.length == 0)\n
$(o.s,o.c).ajaxForm(options);\n
\t\t\t\treturn;\n
});\n
\t\t\ttarget = t[0];\n
return this;\n
\t\t}\n
}\n
\t\tvar form = this;\n
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()\n
\t\tform.clk = target;\n
log(\'terminating; zero elements found by selector\' + ($.isReady ? \'\' : \' (DOM not ready)\'));\n
\t\tif (target.type == \'image\') {\n
return this;\n
\t\t\tif (e.offsetX != undefined) {\n
}\n
\t\t\t\tform.clk_x = e.offsetX;\n
\n
\t\t\t\tform.clk_y = e.offsetY;\n
if ( options.delegation ) {\n
\t\t\t} else if (typeof $.fn.offset == \'function\') { // try to use dimensions plugin\n
$(document)\n
\t\t\t\tvar offset = $el.offset();\n
.off(\'submit.form-plugin\', this.selector, doAjaxSubmit)\n
\t\t\t\tform.clk_x = e.pageX - offset.left;\n
.off(\'click.form-plugin\', this.selector, captureSubmittingElement)\n
\t\t\t\tform.clk_y = e.pageY - offset.top;\n
.on(\'submit.form-plugin\', this.selector, options, doAjaxSubmit)\n
\t\t\t} else {\n
.on(\'click.form-plugin\', this.selector, options, captureSubmittingElement);\n
\t\t\t\tform.clk_x = e.pageX - target.offsetLeft;\n
return this;\n
\t\t\t\tform.clk_y = e.pageY - target.offsetTop;\n
}\n
\t\t\t}\n
\n
\t\t}\n
return this.ajaxFormUnbind()\n
\t\t// clear form vars\n
.bind(\'submit.form-plugin\', options, doAjaxSubmit)\n
\t\tsetTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);\n
.bind(\'click.form-plugin\', options, captureSubmittingElement);\n
\t});\n
};\n
};\n
\n
\n
// private event handlers\n
function doAjaxSubmit(e) {\n
/*jshint validthis:true */\n
var options = e.data;\n
if (!e.isDefaultPrevented()) { // if event has been canceled, don\'t proceed\n
e.preventDefault();\n
$(this).ajaxSubmit(options);\n
}\n
}\n
\n
function captureSubmittingElement(e) {\n
/*jshint validthis:true */\n
var target = e.target;\n
var $el = $(target);\n
if (!($el.is("[type=submit],[type=image]"))) {\n
// is this a child element of the submit el? (ex: a span within a button)\n
var t = $el.closest(\'[type=submit]\');\n
if (t.length === 0) {\n
return;\n
}\n
target = t[0];\n
}\n
var form = this;\n
form.clk = target;\n
if (target.type == \'image\') {\n
if (e.offsetX !== undefined) {\n
form.clk_x = e.offsetX;\n
form.clk_y = e.offsetY;\n
} else if (typeof $.fn.offset == \'function\') {\n
var offset = $el.offset();\n
form.clk_x = e.pageX - offset.left;\n
form.clk_y = e.pageY - offset.top;\n
} else {\n
form.clk_x = e.pageX - target.offsetLeft;\n
form.clk_y = e.pageY - target.offsetTop;\n
}\n
}\n
// clear form vars\n
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);\n
}\n
\n
\n
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm\n
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm\n
$.fn.ajaxFormUnbind = function() {\n
$.fn.ajaxFormUnbind = function() {\n
\t
return this.unbind(\'submit.form-plugin click.form-plugin\');\n
return this.unbind(\'submit.form-plugin click.form-plugin\');\n
};\n
};\n
\n
\n
/**\n
/**\n
...
@@ -458,45 +844,74 @@ $.fn.ajaxFormUnbind = function() {\n
...
@@ -458,45 +844,74 @@ $.fn.ajaxFormUnbind = function() {\n
* It is this array that is passed to pre-submit callback functions provided to the\n
* It is this array that is passed to pre-submit callback functions provided to the\n
* ajaxSubmit() and ajaxForm() methods.\n
* ajaxSubmit() and ajaxForm() methods.\n
*/\n
*/\n
$.fn.formToArray = function(semantic) {\n
$.fn.formToArray = function(semantic, elements) {\n
\tvar a = [];\n
var a = [];\n
\tif (this.length == 0) return a;\n
if (this.length === 0) {\n
\n
return a;\n
\tvar form = this[0];\n
}\n
\tvar els = semantic ? form.getElementsByTagName(\'*\') : form.elements;\n
\n
\tif (!els) return a;\n
var form = this[0];\n
\tfor(var i=0, max=els.length; i
< max
;
i++)
{\n
var els = semantic ? form.getElementsByTagName(\'*\') : form.elements;\n
\t\tvar
el =
els[i];\n
if (!els) {\n
\t\tvar
n =
el.name;\n
return a;\n
\t\tif
(!n)
continue;\n
}\n
\n
\n
\t\tif
(semantic
&&
form.clk
&&
el.type =
=
"image")
{\n
var i,j,n,v,el,max,jmax;\n
\t\t\t//
handle
image
inputs
on
the
fly
when
semantic =
=
true\n
for(i=0, max=els.length; i
< max
;
i++)
{\n
\t\t\tif(!el.disabled
&&
form.clk =
=
el)
{\n
el =
els[i];\n
\t\t\t\ta.push({name:
n,
value:
$(el).val()});\n
n =
el.name;\n
\t\t\t\ta.push({name:
n+\'.x\',
value:
form.clk_x},
{name:
n+\'.y\',
value:
form.clk_y});\n
if
(!n)
{\n
\t\t\t}\n
continue;\n
\t\t\tcontinue;\n
}\n
\t\t}\n
\n
\n
if
(semantic
&&
form.clk
&&
el.type =
=
"image")
{\n
\t\tvar
v =
$.fieldValue(el,
true);\n
//
handle
image
inputs
on
the
fly
when
semantic =
=
true\n
\t\tif
(v
&&
v.constructor =
=
Array)
{\n
if(!el.disabled
&&
form.clk =
=
el)
{\n
\t\t\tfor(var
j=
0,
jmax=
v.length;
j
<
jmax;
j++)\n
a.push({name:
n,
value:
$(el).val(),
type:
el.type
});\n
\t\t\t\ta.push({name:
n,
value:
v[j]});\n
a.push({name:
n+\'.x\',
value:
form.clk_x},
{name:
n+\'.y\',
value:
form.clk_y});\n
\t\t}\n
}\n
\t\telse
if
(v
!==
null
&&
typeof
v
!=
\'undefined\')\n
continue;\n
\t\t\ta.push({name:
n,
value:
v});\n
}\n
\t}\n
\n
\n
v =
$.fieldValue(el,
true);\n
\tif
(!semantic
&&
form.clk)
{\n
if
(v
&&
v.constructor =
=
Array)
{\n
\t\t//
input
type=
=\'image\'
are
not
found
in
elements
array!
handle
it
here\n
if
(elements)\n
\t\tvar
$
input =
$(form.clk),
input =
$input[0],
n =
input.name;\n
elements.push(el);\n
\t\tif
(n
&&
!input.disabled
&&
input.type =
=
\'image\')
{\n
for(
j=
0,
jmax=
v.length;
j
<
jmax;
j++)
{\n
\t\t\ta.push({name:
n,
value:
$input.val()});\n
a.push({name:
n,
value:
v[j]});\n
\t\t\ta.push({name:
n+\'.x\',
value:
form.clk_x},
{name:
n+\'.y\',
value:
form.clk_y});\n
}\n
\t\t}\n
}\n
\t}\n
else
if
(feature.fileapi
&&
el.type =
=
\'file\'
&&
!el.disabled)
{\n
\treturn
a;\n
if
(elements)\n
elements.push(el);\n
var
files =
el.files;\n
if
(files.length)
{\n
for
(
j=
0;
j
<
files.length;
j++)
{\n
a.push({name:
n,
value:
files[j],
type:
el.type});\n
}\n
}\n
else
{\n
//
#180\n
a.push({
name:
n,
value:
\'\',
type:
el.type
});\n
}\n
}\n
else
if
(v
!==
null
&&
typeof
v
!=
\'undefined\')
{\n
if
(elements)\n
elements.push(el);\n
a.push({name:
n,
value:
v,
type:
el.type,
required:
el.required});\n
}\n
}\n
\n
if
(!semantic
&&
form.clk)
{\n
//
input
type=
=\'image\'
are
not
found
in
elements
array!
handle
it
here\n
var
$
input =
$(form.clk),
input =
$input[0];\n
n =
input.name;\n
if
(n
&&
!input.disabled
&&
input.type =
=
\'image\')
{\n
a.push({name:
n,
value:
$input.val()});\n
a.push({name:
n+\'.x\',
value:
form.clk_x},
{name:
n+\'.y\',
value:
form.clk_y});\n
}\n
}\n
return
a;\n
};\n
};\n
\n
\n
/**\n
/**\n
...
@@ -504,8 +919,8 @@ $.fn.formToArray = function(semantic) {\n
...
@@ -504,8 +919,8 @@ $.fn.formToArray = function(semantic) {\n
*
in
the
format:
name1=
value1&name2=value2\n
*
in
the
format:
name1=
value1&name2=value2\n
*/\n
*/\n
$
.fn.formSerialize =
function(semantic)
{\n
$
.fn.formSerialize =
function(semantic)
{\n
\t
//hand
off
to
jQuery.param
for
proper
encoding\n
//hand
off
to
jQuery.param
for
proper
encoding\n
\t
return
$.param(this.formToArray(semantic));\n
return
$.param(this.formToArray(semantic));\n
};\n
};\n
\n
\n
/**\n
/**\n
...
@@ -513,47 +928,51 @@ $.fn.formSerialize = function(semantic) {\n
...
@@ -513,47 +928,51 @@ $.fn.formSerialize = function(semantic) {\n
*
This
method
will
return
a
string
in
the
format:
name1=
value1&name2=value2\n
*
This
method
will
return
a
string
in
the
format:
name1=
value1&name2=value2\n
*/\n
*/\n
$
.fn.fieldSerialize =
function(successful)
{\n
$
.fn.fieldSerialize =
function(successful)
{\n
\tvar
a =
[];\n
var
a =
[];\n
\tthis.each(function()
{\n
this.each(function()
{\n
\t\tvar
n =
this.name;\n
var
n =
this.name;\n
\t\tif
(!n)
return;\n
if
(!n)
{\n
\t\tvar
v =
$.fieldValue(this,
successful);\n
return;\n
\t\tif
(v
&&
v.constructor =
=
Array)
{\n
}\n
\t\t\tfor
(var
i=
0,max=v.length;
i
<
max;
i++)\n
var
v =
$.fieldValue(this,
successful);\n
\t\t\t\ta.push({name:
n,
value:
v[i]});\n
if
(v
&&
v.constructor =
=
Array)
{\n
\t\t}\n
for
(var
i=
0,max=v.length;
i
<
max;
i++)
{\n
\t\telse
if
(v
!==
null
&&
typeof
v
!=
\'undefined\')\n
a.push({name:
n,
value:
v[i]});\n
\t\t\ta.push({name:
this.name,
value:
v});\n
}\n
\t});\n
}\n
\t//hand
off
to
jQuery.param
for
proper
encoding\n
else
if
(v
!==
null
&&
typeof
v
!=
\'undefined\')
{\n
\treturn
$.param(a);\n
a.push({name:
this.name,
value:
v});\n
}\n
});\n
//hand
off
to
jQuery.param
for
proper
encoding\n
return
$.param(a);\n
};\n
};\n
\n
\n
/**\n
/**\n
*
Returns
the
value(s)
of
the
element
in
the
matched
set.
For
example,
consider
the
following
form:\n
*
Returns
the
value(s)
of
the
element
in
the
matched
set.
For
example,
consider
the
following
form:\n
*\n
*\n
*
<form
><fieldset>
\n
*
<form
><fieldset>
\n
*
\t
<input
name=
"A"
type=
"text"
/>
\n
*
<input
name=
"A"
type=
"text"
/>
\n
*
\t
<input
name=
"A"
type=
"text"
/>
\n
*
<input
name=
"A"
type=
"text"
/>
\n
*
\t
<input
name=
"B"
type=
"checkbox"
value=
"B1"
/>
\n
*
<input
name=
"B"
type=
"checkbox"
value=
"B1"
/>
\n
*
\t
<input
name=
"B"
type=
"checkbox"
value=
"B2"
/>
\n
*
<input
name=
"B"
type=
"checkbox"
value=
"B2"
/>
\n
*
\t
<input
name=
"C"
type=
"radio"
value=
"C1"
/>
\n
*
<input
name=
"C"
type=
"radio"
value=
"C1"
/>
\n
*
\t
<input
name=
"C"
type=
"radio"
value=
"C2"
/>
\n
*
<input
name=
"C"
type=
"radio"
value=
"C2"
/>
\n
*
</fieldset></form>
\n
*
</fieldset></form>
\n
*\n
*\n
* var v = $(\'
:text
\').fieldValue();\n
* var v = $(\'
input[type=text]
\').fieldValue();\n
* // if no values are entered into the text inputs\n
* // if no values are entered into the text inputs\n
* v == [\'\',\'\']\n
* v == [\'\',\'\']\n
* // if values entered into the text inputs are \'foo\' and \'bar\'\n
* // if values entered into the text inputs are \'foo\' and \'bar\'\n
* v == [\'foo\',\'bar\']\n
* v == [\'foo\',\'bar\']\n
*\n
*\n
* var v = $(\'
:checkbox
\').fieldValue();\n
* var v = $(\'
input[type=checkbox]
\').fieldValue();\n
* // if neither checkbox is checked\n
* // if neither checkbox is checked\n
* v === undefined\n
* v === undefined\n
* // if both checkboxes are checked\n
* // if both checkboxes are checked\n
* v == [\'B1\', \'B2\']\n
* v == [\'B1\', \'B2\']\n
*\n
*\n
* var v = $(\'
:radio
\').fieldValue();\n
* var v = $(\'
input[type=radio]
\').fieldValue();\n
* // if neither radio is checked\n
* // if neither radio is checked\n
* v === undefined\n
* v === undefined\n
* // if first radio is checked\n
* // if first radio is checked\n
...
@@ -565,51 +984,63 @@ $.fn.fieldSerialize = function(successful) {\n
...
@@ -565,51 +984,63 @@ $.fn.fieldSerialize = function(successful) {\n
* for each element is returned.\n
* for each element is returned.\n
*\n
*\n
* Note: This method *always* returns an array. If no valid value can be determined the\n
* Note: This method *always* returns an array. If no valid value can be determined the\n
*
\t
array will be empty, otherwise it will contain one or more values.\n
*
array will be empty, otherwise it will contain one or more values.\n
*/\n
*/\n
$.fn.fieldValue = function(successful) {\n
$.fn.fieldValue = function(successful) {\n
\tfor (var val=[], i=0, max=this.length; i
< max
;
i++)
{\n
for (var val=[], i=0, max=this.length; i
< max
;
i++)
{\n
\t\tvar
el =
this[i];\n
var
el =
this[i];\n
\t\tvar
v =
$.fieldValue(el,
successful);\n
var
v =
$.fieldValue(el,
successful);\n
\t\tif
(
v =
==
null
||
typeof
v =
=
\'undefined\'
||
(
v.constructor =
=
Array
&&
!v.length))\n
if
(
v =
==
null
||
typeof
v =
=
\'undefined\'
||
(
v.constructor =
=
Array
&&
!v.length))
{\n
\t\t\tcontinue;\n
continue;\n
\t\
tv.constructor =
=
Array
?
$.merge(val,
v)
:
val.push(v);\n
}\n
\t}\n
if
(
v.constructor =
=
Array)\n
\treturn
val;\n
$.merge(val,
v);\n
else\n
val.push(v);\n
}\n
return
val;\n
};\n
};\n
\n
\n
/**\n
/**\n
*
Returns
the
value
of
the
field
element.\n
*
Returns
the
value
of
the
field
element.\n
*/\n
*/\n
$
.fieldValue =
function(el,
successful)
{\n
$
.fieldValue =
function(el,
successful)
{\n
\tvar
n =
el.name,
t =
el.type,
tag =
el.tagName.toLowerCase();\n
var
n =
el.name,
t =
el.type,
tag =
el.tagName.toLowerCase();\n
\tif
(typeof
successful =
=
\'undefined\')
successful =
true;\n
if
(
successful =
==
undefined)
{\n
\n
successful =
true;\n
\tif
(successful
&&
(!n
||
el.disabled
||
t =
=
\'reset\'
||
t =
=
\'button\'
||\n
}\n
\t\t(
t =
=
\'checkbox\'
||
t =
=
\'radio\')
&&
!el.checked
||\n
\n
\t\t(
t =
=
\'submit\'
||
t =
=
\'image\')
&&
el.form
&&
el.form.clk
!=
el
||\n
if
(successful
&&
(!n
||
el.disabled
||
t =
=
\'reset\'
||
t =
=
\'button\'
||\n
\t\
ttag =
=
\'select\'
&&
el.selectedIndex =
=
-1))\n
(
t =
=
\'checkbox\'
||
t =
=
\'radio\')
&&
!el.checked
||\n
\t\t\treturn
null;\n
(
t =
=
\'submit\'
||
t =
=
\'image\')
&&
el.form
&&
el.form.clk
!=
el
||\n
\n
tag =
=
\'select\'
&&
el.selectedIndex =
=
-1))
{\n
\tif
(
tag =
=
\'select\')
{\n
return
null;\n
\t\tvar
index =
el.selectedIndex;\n
}\n
\t\tif
(index
<
0)
return
null;\n
\n
\t\tvar
a =
[],
ops =
el.options;\n
if
(
tag =
=
\'select\')
{\n
\t\tvar
one =
(t
==
\'select-one\');\n
var
index =
el.selectedIndex;\n
\t\tvar
max =
(one
?
index+1
:
ops.length);\n
if
(index
<
0)
{\n
\t\tfor(var
i=
(one
?
index
:
0);
i
<
max;
i++)
{\n
return
null;\n
\t\t\tvar
op =
ops[i];\n
}\n
\t\t\tif
(op.selected)
{\n
var
a =
[],
ops =
el.options;\n
\t\t\t\tvar
v =
op.value;\n
var
one =
(t
==
\'select-one\');\n
\t\t\t\tif
(!v)
//
extra
pain
for
IE...\n
var
max =
(one
?
index+1
:
ops.length);\n
\t\t\t\t\
tv =
(op.attributes
&&
op.attributes[\'value\']
&&
!(op.attributes[\'value\'].specified))
?
op.text
:
op.value;\n
for(var
i=
(one
?
index
:
0);
i
<
max;
i++)
{\n
\t\t\t\tif
(one)
return
v;\n
var
op =
ops[i];\n
\t\t\t\ta.push(v);\n
if
(op.selected)
{\n
\t\t\t}\n
var
v =
op.value;\n
\t\t}\n
if
(!v)
{
//
extra
pain
for
IE...\n
\t\treturn
a;\n
v =
(op.attributes
&&
op.attributes[\'value\']
&&
!(op.attributes[\'value\'].specified))
?
op.text
:
op.value;\n
\t}\n
}\n
\treturn
el.value;\n
if
(one)
{\n
return
v;\n
}\n
a.push(v);\n
}\n
}\n
return
a;\n
}\n
return
$(el).val();\n
};\n
};\n
\n
\n
/**\n
/**\n
...
@@ -620,47 +1051,70 @@ $.fieldValue = function(el, successful) {\n
...
@@ -620,47 +1051,70 @@ $.fieldValue = function(el, successful) {\n
*
-
inputs
of
type
submit,
button,
reset,
and
hidden
will
*not*
be
effected\n
*
-
inputs
of
type
submit,
button,
reset,
and
hidden
will
*not*
be
effected\n
*
-
button
elements
will
*not*
be
effected\n
*
-
button
elements
will
*not*
be
effected\n
*/\n
*/\n
$
.fn.clearForm =
function()
{\n
$
.fn.clearForm =
function(
includeHidden
)
{\n
\t
return
this.each(function()
{\n
return
this.each(function()
{\n
\t\t$(\'input,select,textarea\',
this).clearFields(
);\n
$(\'input,select,textarea\',
this).clearFields(includeHidden
);\n
\t
});\n
});\n
};\n
};\n
\n
\n
/**\n
/**\n
*
Clears
the
selected
form
elements.\n
*
Clears
the
selected
form
elements.\n
*/\n
*/\n
$
.fn.clearFields =
$.fn.clearInputs
=
function()
{\n
$
.fn.clearFields =
$.fn.clearInputs
=
function(includeHidden)
{\n
\treturn
this.each(function()
{\n
var
re =
/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;
//
\'hidden\'
is
not
in
this
list\n
\t\tvar
t =
this.type,
tag =
this.tagName.toLowerCase();\n
return
this.each(function()
{\n
\t\tif
(
t =
=
\'text\'
||
t =
=
\'password\'
||
tag =
=
\'textarea\')\n
var
t =
this.type,
tag =
this.tagName.toLowerCase();\n
\t\t\
tthis.value =
\'\';\n
if
(re.test(t)
||
tag =
=
\'textarea\')
{\n
\t\telse
if
(
t =
=
\'checkbox\'
||
t =
=
\'radio\')\n
this.value =
\'\';\n
\t\t\
tthis.checked =
false;\n
}\n
\t\telse
if
(
tag =
=
\'select\')\n
else
if
(
t =
=
\'checkbox\'
||
t =
=
\'radio\')
{\n
\t\t\
tthis.selectedIndex =
-1;\n
this.checked =
false;\n
\t});\n
}\n
else
if
(
tag =
=
\'select\')
{\n
this.selectedIndex =
-1;\n
}\n
\t\telse
if
(
t =
=
"file")
{\n
\t\t\tif
(/MSIE/.test(navigator.userAgent))
{\n
\t\t\t\t$(this).replaceWith($(this).clone(true));\n
\t\t\t}
else
{\n
\t\t\t\t$(this).val(\'\');\n
\t\t\t}\n
\t\t}\n
else
if
(includeHidden)
{\n
//
includeHidden
can
be
the
value
true,
or
it
can
be
a
selector
string\n
//
indicating
a
special
test;
for
example:\n
//
$(\'#myForm\').clearForm(\'.special:hidden\')\n
//
the
above
would
clean
hidden
inputs
that
have
the
class
of
\'special\'\n
if
(
(
includeHidden =
==
true
&&
/hidden/.test(t))
||\n
(typeof
includeHidden =
=
\'string\'
&&
$(this).is(includeHidden))
)\n
this.value =
\'\';\n
}\n
});\n
};\n
};\n
\n
\n
/**\n
/**\n
*
Resets
the
form
data.
Causes
all
form
elements
to
be
reset
to
their
original
value.\n
*
Resets
the
form
data.
Causes
all
form
elements
to
be
reset
to
their
original
value.\n
*/\n
*/\n
$
.fn.resetForm =
function()
{\n
$
.fn.resetForm =
function()
{\n
\treturn
this.each(function()
{\n
return
this.each(function()
{\n
\t\t//
guard
against
an
input
with
the
name
of
\'reset\'\n
//
guard
against
an
input
with
the
name
of
\'reset\'\n
\t\t//
note
that
IE
reports
the
reset
function
as
an
\'object\'\n
//
note
that
IE
reports
the
reset
function
as
an
\'object\'\n
\t\tif
(typeof
this.reset =
=
\'function\'
||
(typeof
this.reset =
=
\'object\'
&&
!this.reset.nodeType))\n
if
(typeof
this.reset =
=
\'function\'
||
(typeof
this.reset =
=
\'object\'
&&
!this.reset.nodeType))
{\n
\t\t\tthis.reset();\n
this.reset();\n
\t});\n
}\n
});\n
};\n
};\n
\n
\n
/**\n
/**\n
*
Enables
or
disables
any
matching
elements.\n
*
Enables
or
disables
any
matching
elements.\n
*/\n
*/\n
$
.fn.enable =
function(b)
{\n
$
.fn.enable =
function(b)
{\n
\tif
(
b =
=
undefined)
b =
true;\n
if
(
b =
==
undefined)
{\n
\treturn
this.each(function()
{\n
b =
true;\n
\t\
tthis.disabled =
!b;\n
}\n
\t});\n
return
this.each(function()
{\n
this.disabled =
!b;\n
});\n
};\n
};\n
\n
\n
/**\n
/**\n
...
@@ -668,36 +1122,42 @@ $.fn.enable = function(b) {\n
...
@@ -668,36 +1122,42 @@ $.fn.enable = function(b) {\n
*
selects/deselects
and
matching
option
elements.\n
*
selects/deselects
and
matching
option
elements.\n
*/\n
*/\n
$
.fn.selected =
function(select)
{\n
$
.fn.selected =
function(select)
{\n
\tif
(
select =
=
undefined)
select =
true;\n
if
(
select =
==
undefined)
{\n
\treturn
this.each(function()
{\n
select =
true;\n
\t\tvar
t =
this.type;\n
}\n
\t\tif
(
t =
=
\'checkbox\'
||
t =
=
\'radio\')\n
return
this.each(function()
{\n
\t\t\
tthis.checked =
select;\n
var
t =
this.type;\n
\t\telse
if
(this.tagName.toLowerCase()
==
\'option\')
{\n
if
(
t =
=
\'checkbox\'
||
t =
=
\'radio\')
{\n
\t\t\tvar
$
sel =
$(this).parent(\'select\');\n
this.checked =
select;\n
\t\t\tif
(select
&&
$sel[0]
&&
$sel[0]
.type =
=
\'select-one\')
{\n
}\n
\t\t\t\t//
deselect
all
other
options\n
else
if
(this.tagName.toLowerCase()
==
\'option\')
{\n
\t\t\t\t$sel.find(\'option\').selected(false);\n
var
$
sel =
$(this).parent(\'select\');\n
\t\t\t}\n
if
(select
&&
$sel[0]
&&
$sel[0]
.type =
=
\'select-one\')
{\n
\t\t\
tthis.selected =
select;\n
//
deselect
all
other
options\n
\t\t}\n
$sel.find(\'option\').selected(false);\n
\t});\n
}\n
this.selected =
select;\n
}\n
});\n
};\n
};\n
\n
\n
//
expose
debug
var\n
$
.fn.ajaxSubmit.debug =
false;\n
\n
//
helper
fn
for
console
logging\n
//
helper
fn
for
console
logging\n
//
set
$.fn.ajaxSubmit.debug
to
true
to
enable
debug
logging\n
function
log()
{\n
function
log()
{\n
\tif
($.fn.ajaxSubmit.debug)
{\n
if
(!$.fn.ajaxSubmit.debug)\n
\t\tvar
msg =
\'[jquery.form]
\'
+
Array.prototype.join.call(arguments,\'\');\n
return;\n
\t\tif
(window.console
&&
window.console.log)\n
var
msg =
\'[jquery.form]
\'
+
Array.prototype.join.call(arguments,\'\');\n
\t\t\twindow.console.log(msg);\n
if
(window.console
&&
window.console.log)
{\n
\t\telse
if
(window.opera
&&
window.opera.postError)\n
window.console.log(msg);\n
\t\t\twindow.opera.postError(msg);\n
}\n
\t}\n
else
if
(window.opera
&&
window.opera.postError)
{\n
};\n
window.opera.postError(msg);\n
\n
}\n
})(jQuery);\n
}\n
\n
})(jQuery);
]]
></string>
</value>
]]
></string>
</value>
</item>
</item>
...
@@ -707,7 +1167,7 @@ function log() {\n
...
@@ -707,7 +1167,7 @@ function log() {\n
</item>
</item>
<item>
<item>
<key>
<string>
size
</string>
</key>
<key>
<string>
size
</string>
</key>
<value>
<int>
20805
</int>
</value>
<value>
<int>
39528
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_jquery_plugin_formplugin/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/formplugin/formplugin.min.js.xml
View file @
1f9e9e20
...
@@ -6,9 +6,13 @@
...
@@ -6,9 +6,13 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts
55496352.21
</string>
</value>
<value>
<string>
ts
63959540.7
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
__name__
</string>
</key>
<key>
<string>
__name__
</string>
</key>
...
@@ -22,8 +26,7 @@
...
@@ -22,8 +26,7 @@
<key>
<string>
data
</string>
</key>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
<value>
<string
encoding=
"cdata"
>
<![CDATA[
;(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log(\'ajaxSubmit: skipping submit process - no element selected\');return this}if(typeof options==\'function\')options={success:options};var url=$.trim(this.attr(\'action\'));if(url){url=(url.match(/^([^#]+)/)||[])[1]}url=url||window.location.href||\'\';options=$.extend({url:url,type:this.attr(\'method\')||\'GET\',iframeSrc:/^https/i.test(window.location.href||\'\')?\'javascript:false\':\'about:blank\'},options||{});var veto={};this.trigger(\'form-pre-serialize\',[this,options,veto]);if(veto.veto){log(\'ajaxSubmit: submit vetoed via form-pre-serialize trigger\');return this}if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log(\'ajaxSubmit: submit aborted via beforeSerialize callback\');return this}var a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(var n in options.data){if(options.data[n]instanceof Array){for(var k in options.data[n])a.push({name:n,value:options.data[n][k]})}else a.push({name:n,value:options.data[n]})}}if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log(\'ajaxSubmit: submit aborted via beforeSubmit callback\');return this}this.trigger(\'form-submit-validate\',[a,this,options,veto]);if(veto.veto){log(\'ajaxSubmit: submit vetoed via form-submit-validate trigger\');return this}var q=$.param(a);if(options.type.toUpperCase()==\'GET\'){options.url+=(options.url.indexOf(\'?\')>
=0?\'
&\':\'?\')+q;
options.data=null}else options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm()});if(options.clearForm)callbacks.push(function(){$form.clearForm()});if(!options.dataType
&&
options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){var fn=options.replaceTarget?\'replaceWith\':\'html\';$(options.target)[fn](data).each(oldSuccess,arguments)})}else if(options.success)callbacks.push(options.success);options.success=function(data,status,xhr){for(var i=0,max=callbacks.length;i
<max
;i++)callbacks[i].apply(options,[data,status,xhr||$form,$form])};var
files=
$(\'input:file\',this).fieldValue();var
found=
false;for(var
j=
0;j<files.length;j++)if(files[j])found=true;var
multipart=
false;if((files.length&&options.iframe!==false)||options.iframe||found||multipart){if(options.closeKeepAlive)$.get(options.closeKeepAlive,fileUpload);else
fileUpload()}else
$.ajax(options);this.trigger(\'form-submit-notify\',[this,options]);return
this;function
fileUpload(){var
form=
$form[0];if($(\':input[name=submit]\',form).length){alert(\'Error:
Form
elements
must
not
be
named
"submit".\');return}var
opts=
$.extend({},$.ajaxSettings,options);var
s=
$.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);var
id=
\'jqFormIO\'+(new
Date().getTime());var
$
io=
$(\'<iframe
id=
"\'+id+\'"
name=
"\'+id+\'"
src=
"\'+opts.iframeSrc+\'"
onload=
"(jQuery(this).data(\\\'form-plugin-onload\\\'))()"
/>
\');var io=$io[0];$io.css({position:\'absolute\',top:\'-1000px\',left:\'-1000px\'});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:\'n/a\',getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr(\'src\',opts.iframeSrc)}};var g=opts.global;if(g
&&!$.active++)$.event.trigger("ajaxStart");
if(g)$.event.trigger("ajaxSend",[xhr,opts]);if(s.beforeSend
&&s.beforeSend(xhr,s)===false){s.global&&$.active--;
return}if(xhr.aborted)return;var cbInvoked=false;var timedOut=0;var sub=form.clk;if(sub){var n=sub.name;if(n
&&!sub.disabled){opts.extraData=opts.extraData||{};
opts.extraData[n]=sub.value;if(sub.type=="image"){opts.extraData[n+\'.x\']=form.clk_x;opts.extraData[n+\'.y\']=form.clk_y}}}function doSubmit(){var t=$form.attr(\'target\'),a=$form.attr(\'action\');form.setAttribute(\'target\',id);if(form.getAttribute(\'method\')!=\'POST\')form.setAttribute(\'method\',\'POST\');if(form.getAttribute(\'action\')!=opts.url)form.setAttribute(\'action\',opts.url);if(!opts.skipEncodingOverride){$form.attr({encoding:\'multipart/form-data\',enctype:\'multipart/form-data\'})}if(opts.timeout)setTimeout(function(){timedOut=true;cb()},opts.timeout);var extraInputs=[];try{if(opts.extraData)for(var n in opts.extraData)extraInputs.push($(\'
<input
type=
"hidden"
name=
"\'+n+\'"
value=
"\'+opts.extraData[n]+\'"
/>
\').appendTo(form)[0]);$io.appendTo(\'body\');$io.data(\'form-plugin-onload\',cb);form.submit()}finally{form.setAttribute(\'action\',a);t?form.setAttribute(\'target\',t):$form.removeAttr(\'target\');$(extraInputs).remove()}};if(opts.forceSync)doSubmit();else setTimeout(doSubmit,10);var domCheckCount=100;function cb(){if(cbInvoked)return;var ok=true;try{if(timedOut)throw\'timeout\';var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;var isXml=opts.dataType==\'xml\'||doc.XMLDocument||$.isXMLDoc(doc);log(\'isXml=\'+isXml);if(!isXml
&&
(doc.body==null||doc.body.innerHTML==\'\')){if(--domCheckCount){log(\'requeing onLoad callback, DOM not available\');setTimeout(cb,250);return}log(\'Could not access iframe DOM after 100 tries.\');return}log(\'response detected\');cbInvoked=true;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={\'content-type\':opts.dataType};return headers[header]};if(opts.dataType==\'json\'||opts.dataType==\'script\'){var ta=doc.getElementsByTagName(\'textarea\')[0];if(ta)xhr.responseText=ta.value;else{var pre=doc.getElementsByTagName(\'pre\')[0];if(pre)xhr.responseText=pre.innerHTML}}else if(opts.dataType==\'xml\'
&&
!xhr.responseXML
&&
xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText)}data=$.httpData(xhr,opts.dataType)}catch(e){log(\'error caught:\',e);ok=false;xhr.error=e;$.handleError(opts,xhr,\'error\',e)}if(ok){opts.success(data,\'success\');if(g)$.event.trigger("ajaxSuccess",[xhr,opts])}if(g)$.event.trigger("ajaxComplete",[xhr,opts]);if(g
&&!--$.active)$.event.trigger("ajaxStop");
if(opts.complete)opts.complete(xhr,ok?\'success\':\'error\');setTimeout(function(){$io.removeData(\'form-plugin-onload\');$io.remove();xhr.responseXML=null},100)};function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject(\'Microsoft.XMLDOM\');doc.async=\'false\';doc.loadXML(s)}else doc=(new DOMParser()).parseFromString(s,\'text/xml\');return(doc
&&doc.documentElement&&doc.documentElement.tagName!=\'parsererror\')?doc:null}}};
$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind(\'submit.form-plugin\',function(e){e.preventDefault();$(this).ajaxSubmit(options)}).bind(\'click.form-plugin\',function(e){var target=e.target;var $el=$(target);if(!($el.is(":submit,input:image"))){var t=$el.closest(\':submit\');if(t.length==0)return;target=t[0]}var form=this;form.clk=target;if(target.type==\'image\'){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY}else if(typeof $.fn.offset==\'function\'){var offset=$el.offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top}else{form.clk_x=e.pageX-target.offsetLeft;form.clk_y=e.pageY-target.offsetTop}}setTimeout(function(){form.clk=form.clk_x=form.clk_y=null},100)})};$.fn.ajaxFormUnbind=function(){return this.unbind(\'submit.form-plugin click.form-plugin\')};$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName(\'*\'):form.elements;if(!els)return a;for(var i=0,max=els.length;i
<max
;i++){var
el=
els[i];var
n=
el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+\'.x\',value:form.clk_x},{name:n+\'.y\',value:form.clk_y})}continue}var
v=
$.fieldValue(el,true);if(v&&v.constructor==Array){for(var
j=
0,jmax=v.length;j<jmax;j++)a.push({name:n,value:v[j]})}else
if(v!==null&&typeof
v!=\'undefined\')a.push({name:n,value:v})}if(!semantic&&form.clk){var
$
input=
$(form.clk),input=$input[0],n=input.name;if(n&&!input.disabled&&input.type==\'image\'){a.push({name:n,value:$input.val()});a.push({name:n+\'.x\',value:form.clk_x},{name:n+\'.y\',value:form.clk_y})}}return
a};$
.fn.formSerialize=
function(semantic){return
$.param(this.formToArray(semantic))};$
.fn.fieldSerialize=
function(successful){var
a=
[];this.each(function(){var
n=
this.name;if(!n)return;var
v=
$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var
i=
0,max=v.length;i<max;i++)a.push({name:n,value:v[i]})}else
if(v!==null&&typeof
v!=\'undefined\')a.push({name:this.name,value:v})});return
$.param(a)};$
.fn.fieldValue=
function(successful){for(var
val=
[],i=0,max=this.length;i<max;i++){var
el=
this[i];var
v=
$.fieldValue(el,successful);if(v===null||typeof
v=
=\'undefined\'||(v.constructor==Array&&!v.length))continue;v.constructor==Array?$.merge(val,v):val.push(v)}return
val};$
.fieldValue=
function(el,successful){var
n=
el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof
successful=
=\'undefined\')successful=true;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))return
null;if(
tag=
=\'select\'){var
index=
el.selectedIndex;if(index<0)return
null;var
a=
[],ops=el.options;var
one=
(t==\'select-one\');var
max=
(one?index+1:ops.length);for(var
i=
(one?index:0);i<max;i++){var
op=
ops[i];if(op.selected){var
v=
op.value;if(!v)v=(op.attributes&&op.attributes[\'value\']&&!(op.attributes[\'value\'].specified))?op.text:op.value;if(one)return
v;a.push(v)}}return
a}return
el.value};$
.fn.clearForm=
function(){return
this.each(function(){$(\'input,select,textarea\',this).clearFields()})};$
.fn.clearFields=
$.fn.clearInputs=function(){return
this.each(function(){var
t=
this.type,tag=this.tagName.toLowerCase();if(t==\'text\'||t==\'password\'||tag==\'textarea\')this.value=\'\';else
if(
t=
=\'checkbox\'||t==\'radio\')this.checked=false;else
if(
tag=
=\'select\')this.selectedIndex=-1})};$.fn.resetForm=function(){return
this.each(function(){if(typeof
this.reset=
=\'function\'||(typeof
this.reset=
=\'object\'&&!this.reset.nodeType))this.reset()})};$.fn.enable=function(b){if(b==undefined)b=true;return
this.each(function(){
this.disabled=
!b})};$.fn.selected=function(select){if(select==undefined)select=true;return
this.each(function(){var
t=
this.type;if(t==\'checkbox\'||t==\'radio\')this.checked=select;else
if(this.tagName.toLowerCase()==\'option\'){var
$
sel=
$(this).parent(\'select\');if(select&&$sel[0]&&$sel[0].type==\'select-one\'){$sel.find(\'option\').selected(false)}this.selected=select}})};function
log(){if($.fn.ajaxSubmit.debug){var
msg=
\'[jquery.form]
\'+Array.prototype.join.call(arguments,\'\');if(window.console&&window.console.log)window.console.log(msg);else
if(window.opera&&window.opera.postError)window.opera.postError(msg)}}})(jQuery);\n
(function(e){"use strict";var t={};t.fileapi=e("<input type=\'file\'/>
").get(0).files!==undefined;t.formdata=window.FormData!==undefined;e.fn.ajaxSubmit=function(r){if(!this.length){i("ajaxSubmit: skipping submit process - no element selected");return this}var a,n,s,o=this;if(typeof r=="function"){r={success:r}}a=this.attr("method");n=this.attr("action");s=typeof n==="string"?e.trim(n):"";s=s||window.location.href||"";if(s){s=(s.match(/^([^#]+)/)||[])[1]}r=e.extend(true,{url:s,success:e.ajaxSettings.success,type:a||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},r);var f={};this.trigger("form-pre-serialize",[this,r,f]);if(f.veto){i("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(r.beforeSerialize
&&
r.beforeSerialize(this,r)===false){i("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var l=r.traditional;if(l===undefined){l=e.ajaxSettings.traditional}var u=[];var c,d=this.formToArray(r.semantic,u);if(r.data){r.extraData=r.data;c=e.param(r.data,l)}if(r.beforeSubmit
&&
r.beforeSubmit(d,this,r)===false){i("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[d,this,r,f]);if(f.veto){i("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var m=e.param(d,l);if(c){m=m?m+"
&"+c:c}if(r.type.toUpperCase()=="GET"){r.url+=(r.url.indexOf("?")>=0?"&":"?")+m;
r.data=null}else{r.data=m}var p=[];if(r.resetForm){p.push(function(){o.resetForm()})}if(r.clearForm){p.push(function(){o.clearForm(r.includeHidden)})}if(!r.dataType
&&
r.target){var v=r.success||function(){};p.push(function(t){var a=r.replaceTarget?"replaceWith":"html";e(r.target)[a](t).each(v,arguments)})}else if(r.success){p.push(r.success)}r.success=function(e,t,a){var i=r.context||this;for(var n=0,s=p.length;n
<s
;n++){p[n].apply(i,[e,t,a||o,o])}};var
h=
e(\'input[type=file]:enabled[value!=""]\',this);var
g=
h.length
>
0;var x="multipart/form-data";var b=o.attr("enctype")==x||o.attr("encoding")==x;var y=t.fileapi
&&t.formdata;
i("fileAPI :"+y);var T=(g||b)
&&!y;
var j;if(r.iframe!==false
&&
(r.iframe||T)){if(r.closeKeepAlive){e.get(r.closeKeepAlive,function(){j=D(d)})}else{j=D(d)}}else if((g||b)
&&y){j=k(d)}else{j=e.ajax(r)}o.removeData("jqxhr").data("jqxhr",j);
for(var w=0;w
<u.length
;w++)u[w]=null;this.trigger("form-submit-notify",[this,r]);return
this;function
S(t){var
r=
e.param(t).split("&");var
a=
r.length;var
i=
[];var
n,s;for(
n=
0;n<a;n++){r[n]=r[n].replace(/\\+/g,"
");
s=
r[n].split("=");i.push([decodeURIComponent(s[0]),decodeURIComponent(s[1])])}return
i}function
k(t){var
i=
new
FormData;for(var
n=
0;n<t.length;n++){i.append(t[n].name,t[n].value)}if(r.extraData){var
s=
S(r.extraData);for(n=0;n<s.length;n++)if(s[n])i.append(s[n][0],s[n][1])}r.data=null;var
o=
e.extend(true,{},e.ajaxSettings,r,{contentType:false,processData:false,cache:false,type:a||"POST"});if(r.uploadProgress){o.xhr=function(){var
e=
jQuery.ajaxSettings.xhr();if(e.upload){e.upload.addEventListener("progress",function(e){var
t=
0;var
a=
e.loaded||e.position;var
i=
e.total;if(e.lengthComputable){t=Math.ceil(a/i*100)}r.uploadProgress(e,a,i,t)},false)}return
e}}
o.data=
null;var
f=
o.beforeSend;o.beforeSend=function(e,t){t.data=i;if(f)f.call(this,e,t)};return
e.ajax(o)}function
D(t){var
n=
o[0],s,f,l,c,d,m,p,v,h,g,x,b;var
y=
!!e.fn.prop;var
T=
e.Deferred();if(t){for(f=0;f<u.length;f++){s=e(u[f]);if(y)s.prop("disabled",false);else
s.removeAttr("disabled")}}
l=
e.extend(true,{},e.ajaxSettings,r);l.context=l.context||l;d="jqFormIO"+(new
Date).getTime();if(l.iframeTarget){
m=
e(l.iframeTarget);g=m.attr("name");if(!g)m.attr("name",d);else
d=
g}else{m=e(\'<iframe
name=
"\'+d+\'"
src=
"\'+l.iframeSrc+\'"
/>
\');m.css({position:"absolute",top:"-1000px",left:"-1000px"})}p=m[0];v={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(t){var r=t==="timeout"?"timeout":"aborted";i("aborting upload... "+r);this.aborted=1;try{if(p.contentWindow.document.execCommand){p.contentWindow.document.execCommand("Stop")}}catch(a){}m.attr("src",l.iframeSrc);v.error=r;if(l.error)l.error.call(l.context,v,r,t);if(c)e.event.trigger("ajaxError",[v,l,r]);if(l.complete)l.complete.call(l.context,v,r)}};c=l.global;if(c
&&0===e.active++){e.event.trigger("ajaxStart")}if(c){e.event.trigger("ajaxSend",[v,l])}if(l.beforeSend&&l.beforeSend.call(l.context,v,l)===false){if(l.global){e.active--}T.reject();
return T}if(v.aborted){T.reject();return T}h=n.clk;if(h){g=h.name;if(g
&&!h.disabled){l.extraData=l.extraData||{};
l.extraData[g]=h.value;if(h.type=="image"){l.extraData[g+".x"]=n.clk_x;l.extraData[g+".y"]=n.clk_y}}}var j=1;var w=2;function S(e){var t=e.contentWindow?e.contentWindow.document:e.contentDocument?e.contentDocument:e.document;return t}var k=e("meta[name=csrf-token]").attr("content");var D=e("meta[name=csrf-param]").attr("content");if(D
&&k){l.extraData=l.extraData||{};
l.extraData[D]=k}function A(){var t=o.attr("target"),r=o.attr("action");n.setAttribute("target",d);if(!a){n.setAttribute("method","POST")}if(r!=l.url){n.setAttribute("action",l.url)}if(!l.skipEncodingOverride
&&(!a||/post/i.test(a))){o.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(l.timeout){b=setTimeout(function(){x=true;
O(j)},l.timeout)}function s(){try{var e=S(p).readyState;i("state = "+e);if(e
&&
e.toLowerCase()=="uninitialized")setTimeout(s,50)}catch(t){i("Server abort: ",t," (",t.name,")");O(w);if(b)clearTimeout(b);b=undefined}}var f=[];try{if(l.extraData){for(var u in l.extraData){if(l.extraData.hasOwnProperty(u)){if(e.isPlainObject(l.extraData[u])
&&
l.extraData[u].hasOwnProperty("name")
&&
l.extraData[u].hasOwnProperty("value")){f.push(e(\'
<input
type=
"hidden"
name=
"\'+l.extraData[u].name+\'"
>
\').val(l.extraData[u].value).appendTo(n)[0])}else{f.push(e(\'
<input
type=
"hidden"
name=
"\'+u+\'"
>
\').val(l.extraData[u]).appendTo(n)[0])}}}}if(!l.iframeTarget){m.appendTo("body");if(p.attachEvent)p.attachEvent("onload",O);else p.addEventListener("load",O,false)}setTimeout(s,15);try{n.submit()}catch(c){var v=document.createElement("form").submit;v.apply(n)}}finally{n.setAttribute("action",r);if(t){n.setAttribute("target",t)}else{o.removeAttr("target")}e(f).remove()}}if(l.forceSync){A()}else{setTimeout(A,10)}var E,L,M=50,F;function O(t){if(v.aborted||F){return}try{L=S(p)}catch(r){i("cannot access response document: ",r);t=w}if(t===j
&&v){v.abort("timeout");
T.reject(v,"timeout");return}else if(t==w
&&
v){v.abort("server abort");T.reject(v,"error","server abort");return}if(!L||L.location.href==l.iframeSrc){if(!x)return}if(p.detachEvent)p.detachEvent("onload",O);else p.removeEventListener("load",O,false);var a="success",n;try{if(x){throw"timeout"}var s=l.dataType=="xml"||L.XMLDocument||e.isXMLDoc(L);i("isXml="+s);if(!s
&&
window.opera
&&
(L.body===null||!L.body.innerHTML)){if(--M){i("requeing onLoad callback, DOM not available");setTimeout(O,250);return}}var o=L.body?L.body:L.documentElement;v.responseText=o?o.innerHTML:null;v.responseXML=L.XMLDocument?L.XMLDocument:L;if(s)l.dataType="xml";v.getResponseHeader=function(e){var t={"content-type":l.dataType};return t[e]};if(o){v.status=Number(o.getAttribute("status"))||v.status;v.statusText=o.getAttribute("statusText")||v.statusText}var f=(l.dataType||"").toLowerCase();var u=/(json|script|text)/.test(f);if(u||l.textarea){var d=L.getElementsByTagName("textarea")[0];if(d){v.responseText=d.value;v.status=Number(d.getAttribute("status"))||v.status;v.statusText=d.getAttribute("statusText")||v.statusText}else if(u){var h=L.getElementsByTagName("pre")[0];var g=L.getElementsByTagName("body")[0];if(h){v.responseText=h.textContent?h.textContent:h.innerText}else if(g){v.responseText=g.textContent?g.textContent:g.innerText}}}else if(f=="xml"
&&!v.responseXML&&v.responseText){v.responseXML=X(v.responseText)}try{E=_(v,f,l)}catch(y){a="parsererror";
v.error=n=y||a}}catch(y){i("error caught: ",y);a="error";v.error=n=y||a}if(v.aborted){i("upload aborted");a=null}if(v.status){a=v.status>=200
&&v.status<300||v.status===304?"success":"error"}if(a==="success"){if(l.success)l.success.call(l.context,E,"success",v);
T.resolve(v.responseText,"success",v);if(c)e.event.trigger("ajaxSuccess",[v,l])}else if(a){if(n===undefined)n=v.statusText;if(l.error)l.error.call(l.context,v,a,n);T.reject(v,"error",n);if(c)e.event.trigger("ajaxError",[v,l,n])}if(c)e.event.trigger("ajaxComplete",[v,l]);if(c
&&!--e.active){e.event.trigger("ajaxStop")}if(l.complete)l.complete.call(l.context,v,a);
F=true;if(l.timeout)clearTimeout(b);setTimeout(function(){if(!l.iframeTarget)m.remove();v.responseXML=null},100)}var X=e.parseXML||function(e,t){if(window.ActiveXObject){t=new ActiveXObject("Microsoft.XMLDOM");t.async="false";t.loadXML(e)}else{t=(new DOMParser).parseFromString(e,"text/xml")}return t
&&t.documentElement&&t.documentElement.nodeName!="parsererror"?t:null};
var C=e.parseJSON||function(e){return window["eval"]("("+e+")")};var _=function(t,r,a){var i=t.getResponseHeader("content-type")||"",n=r==="xml"||!r
&&i.indexOf("xml")>=0,s=n?t.responseXML:t.responseText;
if(n
&&
s.documentElement.nodeName==="parsererror"){if(e.error)e.error("parsererror")}if(a
&&
a.dataFilter){s=a.dataFilter(s,r)}if(typeof s==="string"){if(r==="json"||!r
&&
i.indexOf("json")>=0){s=C(s)}else if(r==="script"||!r
&&
i.indexOf("javascript")>=0){e.globalEval(s)}}return s};return T}};e.fn.ajaxForm=function(t){t=t||{};t.delegation=t.delegation
&&e.isFunction(e.fn.on);
if(!t.delegation
&&
this.length===0){var n={s:this.selector,c:this.context};if(!e.isReady
&&
n.s){i("DOM not ready, queuing ajaxForm");e(function(){e(n.s,n.c).ajaxForm(t)});return this}i("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)"));return this}if(t.delegation){e(document).off("submit.form-plugin",this.selector,r).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,t,r).on("click.form-plugin",this.selector,t,a);return this}return this.ajaxFormUnbind().bind("submit.form-plugin",t,r).bind("click.form-plugin",t,a)};function r(t){var r=t.data;if(!t.isDefaultPrevented()){t.preventDefault();e(this).ajaxSubmit(r)}}function a(t){var r=t.target;var a=e(r);if(!a.is("[type=submit],[type=image]")){var i=a.closest("[type=submit]");if(i.length===0){return}r=i[0]}var n=this;n.clk=r;if(r.type=="image"){if(t.offsetX!==undefined){n.clk_x=t.offsetX;n.clk_y=t.offsetY}else if(typeof e.fn.offset=="function"){var s=a.offset();n.clk_x=t.pageX-s.left;n.clk_y=t.pageY-s.top}else{n.clk_x=t.pageX-r.offsetLeft;n.clk_y=t.pageY-r.offsetTop}}setTimeout(function(){n.clk=n.clk_x=n.clk_y=null},100)}e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};e.fn.formToArray=function(r,a){var i=[];if(this.length===0){return i}var n=this[0];var s=r?n.getElementsByTagName("*"):n.elements;if(!s){return i}var o,f,l,u,c,d,m;for(o=0,d=s.length;o
<d
;o++){
c=
s[o];l=c.name;if(!l){continue}if(r&&n.clk&&c.type=="image"){if(!c.disabled&&n.clk==c){i.push({name:l,value:e(c).val(),type:c.type});i.push({name:l+".x",value:n.clk_x},{name:l+".y",value:n.clk_y})}continue}u=e.fieldValue(c,true);if(u&&u.constructor==Array){if(a)a.push(c);for(f=0,m=u.length;f<m;f++){i.push({name:l,value:u[f]})}}else
if(t.fileapi&&
c.type=
="file"&&!c.disabled){if(a)a.push(c);var
p=
c.files;if(p.length){for(f=0;f<p.length;f++){i.push({name:l,value:p[f],type:c.type})}}else{i.push({name:l,value:"",type:c.type})}}else
if(u!==null&&typeof
u!="undefined"){if(a)a.push(c);i.push({name:l,value:u,type:c.type,required:c.required})}}if(!r&&n.clk){var
v=
e(n.clk),h=v[0];l=h.name;if(l&&!h.disabled&&h.type=="image"){i.push({name:l,value:v.val()});i.push({name:l+".x",value:n.clk_x},{name:l+".y",value:n.clk_y})}}return
i};
e.fn.formSerialize=
function(t){return
e.param(this.formToArray(t))};
e.fn.fieldSerialize=
function(t){var
r=
[];this.each(function(){var
a=
this.name;if(!a){return}var
i=
e.fieldValue(this,t);if(i&&i.constructor==Array){for(var
n=
0,s=i.length;n<s;n++){r.push({name:a,value:i[n]})}}else
if(i!==null&&typeof
i!="undefined"){r.push({name:this.name,value:i})}});return
e.param(r)};
e.fn.fieldValue=
function(t){for(var
r=
[],a=0,i=this.length;a<i;a++){var
n=
this[a];var
s=
e.fieldValue(n,t);if(s===null||typeof
s=
="undefined"||s.constructor==Array&&!s.length){continue}if(s.constructor==Array)e.merge(r,s);else
r.push(s)}return
r};
e.fieldValue=
function(t,r){var
a=
t.name,i=t.type,n=t.tagName.toLowerCase();if(r===undefined){r=true}if(r&&(!a||t.disabled||i=="reset"||i=="button"||(i=="checkbox"||i=="radio")&&!t.checked||(i=="submit"||i=="image")&&t.form&&t.form.clk!=t||n=="select"&&t.selectedIndex==-1)){return
null}if(
n=
="select"){var
s=
t.selectedIndex;if(s<0){return
null}var
o=
[],f=t.options;var
l=
i=="select-one";var
u=
l?s+1:f.length;for(var
c=
l?s:0;c<u;c++){var
d=
f[c];if(d.selected){var
m=
d.value;if(!m){m=d.attributes&&d.attributes["value"]&&!d.attributes["value"].specified?d.text:d.value}if(l){return
m}o.push(m)}}return
o}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,i=this.tagName.toLowerCase();if(r.test(a)||i=="textarea"){this.value=""}else
if(
a=
="checkbox"||a=="radio"){this.checked=false}else
if(
i=
="select"){this.selectedIndex=-1}else
if(
a=
="file"){if(/MSIE/.test(navigator.userAgent)){e(this).replaceWith(e(this).clone(true))}else{e(this).val("")}}else
if(t){if(
t=
==true&&/hidden/.test(a)||typeof
t=
="string"&&e(this).is(t))this.value=""}})};e.fn.resetForm=function(){return
this.each(function(){if(typeof
this.reset=
="function"||typeof
this.reset=
="object"&&!this.reset.nodeType){this.reset()}})};e.fn.enable=function(e){if(e===undefined){e=true}return
this.each(function(){
this.disabled=
!e})};e.fn.selected=function(t){if(t===undefined){t=true}return
this.each(function(){var
r=
this.type;if(r=="checkbox"||r=="radio"){this.checked=t}else
if(this.tagName.toLowerCase()=="option"){var
a=
e(this).parent("select");if(t&&a[0]&&a[0].type=="select-one"){a.find("option").selected(false)}this.selected=t}})};e.fn.ajaxSubmit.debug=false;function
i(){if(!e.fn.ajaxSubmit.debug)return;var
t=
"[jquery.form] "
+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(t)}else
if(window.opera&&window.opera.postError){window.opera.postError(t)}}})(jQuery);
]]
></string>
</value>
]]
></string>
</value>
</item>
</item>
...
@@ -33,7 +36,7 @@
...
@@ -33,7 +36,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
size
</string>
</key>
<key>
<string>
size
</string>
</key>
<value>
<int>
1
0600
</int>
</value>
<value>
<int>
1
4475
</int>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_jquery_plugin_formplugin/bt/description
View file @
1f9e9e20
This Business Template contains only static files of formplugin library
2.43
.
This Business Template contains only static files of formplugin library
3.29.0-2013.03.22
.
* http://malsup.com/jquery/form/
* http://malsup.com/jquery/form/
\ No newline at end of file
bt5/erp5_jquery_plugin_formplugin/bt/revision
View file @
1f9e9e20
3
4
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment