Sha256: db37ea82031febe1dfb983a543ab41472d93581f0c38b821a4c5710804321ebd

Contents?: true

Size: 1.96 KB

Versions: 8

Compression:

Stored size: 1.96 KB

Contents

!function(e,t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):e.jQuery.dataToInputs=t(e.jquery)}(this,function(e){return function(e){"use strict";e(window.jQuery)}(function(e){"use strict";function t(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName}e.dataToInputs=function(){var r=function(n,a,i,o){a="undefined"==typeof a?"hidden":a,i="undefined"==typeof i?[]:i,o="undefined"==typeof o?[]:o;var u,f,p,s,l,y,c,d=e.isArray(n)?"array":typeof n,h=function(t,r){for(var n="",i=0;i<t.length;i++)0==i?n=t[i]:n+="["+t[i]+"]";var o=e("<input />");return o.attr("type",a),o.attr("name",n),o.val(r),o};if(t(n))for(var v,g,m,j,T=e(n),b=-1!==e.inArray(T.prop("tagName"),["INPUT","TEXTAREA","SELECT"])?T:e("input,textarea,select",n),A=0;A<b.length;A++){if(g=e(b[A]),m=g.prop("tagName").toLowerCase(),j=g.attr("type"),v=e("<input type='hidden' value='' />"),"input"!=m||"checkbox"!=j&&"radio"!=j)"input"==m&&"file"==g.attr("type")?v=e(b[A].cloneNode(!0)):v.val(g.val());else if(g.is(":checked"))v.val(g.val());else if("radio"==j)continue;for(var E=[],N=0;N<i.length;N++)E.push(i[N]);var q=e(b[A]).attr("name")||null;if(q=q?q.split(/\[/):q)for(var N=0;N<q.length;N++)E.push(q[N].replace(/\]$/,""));for(var y="",N=0;N<E.length;N++)0==N?y=E[N]:y+="["+E[N]+"]";v.attr("name",y),"file"==g.attr("type")?(v.insertBefore(b[A]),o.push(b[A])):o.push(v.get(0))}else if("string"==d||"number"==d)o.push(h(i,n));else for(var x in n)if(s=i.slice(),y="",p=n[x],f=e.isArray(p)?"array":typeof p,s.push(x),"object"==f)r(n[x],a,s,o);else if("array"==f){c=!0;for(var A=0;A<p.length;A++)u=e.isArray(p[A])?"array":typeof p[A],"string"!=u&&"number"!=u&&(c=!1);if(c)for(var A=0;A<p.length;A++)l=s.slice(),l.push(""),r(n[x][A],a,l,o);else for(var A=0;A<p.length;A++)l=s.slice(),l.push(A),r(n[x][A],a,l,o)}else o.push(h(s,p));return o};return function(e,t){return r(e,t)}}()}),jQuery.dataToInputs});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/jquery.dataToInputs/dist/jquery.dataToInputs.min.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/jquery.dataToInputs/dist/jquery.dataToInputs.min.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/jquery.dataToInputs/dist/jquery.dataToInputs.min.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/jquery.dataToInputs/dist/jquery.dataToInputs.min.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/jquery.dataToInputs/dist/jquery.dataToInputs.min.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/jquery.dataToInputs/dist/jquery.dataToInputs.min.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/jquery.dataToInputs/dist/jquery.dataToInputs.min.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/jquery.dataToInputs/dist/jquery.dataToInputs.min.js