Bug 13307: Fix jquery.deseriable.min.js

http://bugs.koha-community.org/show_bug.cgi?id=13307
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

http://bugs.koha-community.org/show_bug.cgi?id=13364
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
simith 2014-12-12 14:07:45 -05:00 committed by Tomas Cohen Arazi
parent 90f6f143c7
commit 793d243dfa

View file

@ -5,4 +5,4 @@
*
* Dual licensed under the MIT and GPLv2 licenses.
*/
(function(i,b){var f=Array.prototype.push,a=/^(?:radio|checkbox)$/i,e=/\+/g,d=/^(?:option|select-one|select-multiple)$/i,g=/^(?:button|color|date|datetime|datetime-local|email|hidden|month|number|password|range|reset|search|submit|tel|text|textarea|time|url|week)$/i;function c(j){return j.map(function(){return this.elements?i.makeArray(this.elements):this}).filter(":input").get()}function h(j){var k,l={};i.each(j,function(n,m){k=l[m.name];l[m.name]=k===b?m:(i.isArray(k)?k.concat(m):[k,m])});return l}i.fn.deserialize=function(A,l){var y,n,q=c(this),t=[];if(!A||!q.length){return this}if(i.isArray(A)){t=A}else{if(i.isPlainObject(A)){var B,w;for(B in A){i.isArray(w=A[B])?f.apply(t,i.map(w,function(j){return{name:B,value:j}})):f.call(t,{name:B,value:w})}}else{if(typeof A==="string"){var v;A=A.split("&");for(y=0,n=A.length;y<n;y++){v=A[y].split("=");f.call(t,{name:decodeURIComponent(v[0]),value:decodeURIComponent(v[1].replace(e,"%20"))})}}}}if(!(n=t.length)){return this}var u,k,x,z,C,o,m,w,p=i.noop,s=i.noop,r={};l=l||{};q=h(q);if(i.isFunction(l)){s=l}else{p=i.isFunction(l.change)?l.change:p;s=i.isFunction(l.complete)?l.complete:s}for(y=0;y<n;y++){u=t[y];C=u.name;w=u.value;if(!(k=q[C])){continue}m=(z=k.length)?k[0]:k;m=(m.type||m.nodeName).toLowerCase();o=null;if(g.test(m)){if(z){x=r[C];k=k[r[C]=(x==b)?0:++x]}p.call(k,(k.value=w))}else{if(a.test(m)){o="checked"}else{if(d.test(m)){o="selected"}}}if(o){if(!z){k=[k];z=1}for(x=0;x<z;x++){u=k[x];if(u.value==w){p.call(u,(u[o]=true)&&w)}}}}s.call(this);return this}})(jQuery);
(function(jQuery,undefined){var push=Array.prototype.push,rcheck=/^(?:radio|checkbox)$/i,rplus=/\+/g,rselect=/^(?:option|select-multiple)$/i,rvalue=/^(?:button|select-one|color|date|datetime|datetime-local|email|hidden|month|number|password|range|reset|search|submit|tel|text|textarea|time|url|week)$/i;function getElements(elements){return elements.map(function(){return this.elements?jQuery.makeArray(this.elements):this;}).filter(":input:not(:disabled)").get();}function getElementsByName(elements){var current,elementsByName={};jQuery.each(elements,function(i,element){current=elementsByName[element.name];elementsByName[element.name]=current===undefined?element:(jQuery.isArray(current)?current.concat(element):[current,element]);});return elementsByName;}jQuery.fn.deserialize=function(data,options){var i,length,elements=getElements(this),normalized=[];if(!data||!elements.length){return this;}if(jQuery.isArray(data)){normalized=data;}else if(typeof data==="string"){var parts;data=data.split("&");for(i=0,length=data.length;i<length;i++){parts=data[i].split("=");push.call(normalized,{name:decodeURIComponent(parts[0]),value:decodeURIComponent(parts[1].replace(rplus,"%20"))});}}if(!(length=normalized.length)){return this;}var current,element,j,len,name,property,type,value,change=function(){},complete=function(){},names={};options=options||{};elements=getElementsByName(elements);if(jQuery.isFunction(options)){complete=options;}else{change=jQuery.isFunction(options.change)?options.change:change;complete=jQuery.isFunction(options.complete)?options.complete:complete;}for(i=0;i<length;i++){current=normalized[i];name=current.name;value=current.value;if(!(element=elements[name])){continue;}type=(len=element.length)?element[0]:element;type=(type.type||type.nodeName).toLowerCase();property=null;if(rvalue.test(type)){if(len){j=names[name];element=element[names[name]=(j==undefined)?0:++j];}if(element){change.call(element,(element.value=value));}}else if(rcheck.test(type)){property="checked";}else if(rselect.test(type)){property="selected";}if(property){if(!len){element=[element];len=1;}for(j=0;j<len;j++){current=element[j];if(current.value==value){change.call(current,(current[property]=true)&&value);}}}}complete.call(this);return this;};})(jQuery);