diff --git a/cuteform.min.js b/cuteform.min.js index d2a4200..b1ff0e3 100644 --- a/cuteform.min.js +++ b/cuteform.min.js @@ -1,2 +1,2 @@ /* By db0 (db0company@gmail.com, http://db0.fr/) Source/Licence https://github.com/db0company/CuteForm */ -function cuteformhtml(e,t){var a=e.val(),d=e.text(),o="undefined"!=typeof t.images&&"undefined"!=typeof t.images[a]?t.images[a]:"undefined"!=typeof e.attr("data-cuteform-image")?e.attr("data-cuteform-image"):null;if(null!==o)return $('');var c="undefined"!=typeof t.html&&"undefined"!=typeof t.html[a]?t.html[a]:"undefined"!=typeof e.attr("data-cuteform-html")?e.attr("data-cuteform-html"):a;return $('
'+c+"
")}function cuteform(e,t){var t="undefined"==typeof t?{}:t;e.addClass("cuteform-select");var a,d,o,c="true"==t.modal||"true"==e.attr("data-cuteform-modal"),f="true"==t["modal-text"]||"true"==e.attr("data-cuteform-modal-text");if(c){d=$(''),a=d.find(".modal-body"),$("body").append(d);var o=$('');e.after(o),e.hide()}else{var l=!("undefined"!=typeof t.hide&&"false"==t.hide.toString()||"false"==e.attr("data-cuteform-hide"));l&&e.hide(),a=$('
'+(l?"":"
")+"
"),e.after(a)}e.find("option").each(function(){var l=$(this),r=cuteformhtml(l,t);a.append(r),l.val()==e.find("option:selected").first().val()&&r.addClass("cuteform-selected"),r.click(function(){e.val(r.attr("data-cuteform-val")),a.find(".cuteform-elt").removeClass("cuteform-selected"),r.addClass("cuteform-selected"),c&&(o.text(""),o.append(f?''+a.find(".cuteform-selected").attr("data-cuteform-text")+"":a.find(".cuteform-selected").clone(!0).off()),d.modal("hide"))})}),c&&(o.append(f?''+a.find(".cuteform-selected").attr("data-cuteform-text")+"":a.find(".cuteform-selected").clone(!0).off()),o.click(function(e){e.preventDefault(),d.css("display","block"),d.modal(),d.on("hidden.bs.modal",function(){d.css("display","none")})})),e.change(function(){a.find(".cuteform-elt").removeClass("cuteform-selected"),a.find("[data-cuteform-val="+e.find("option:selected").first().val()+"]").addClass("cuteform-selected")})}function cuteformclear(){$(".cuteform").remove(),$(".cuteform-selected").removeClass("cuteform-selected"),$(".cuteform-select").show(),$(".cuteform-select").removeClass("cuteform-select")}$(document).ready(function(){$("select[data-cuteform=true]").each(function(){cuteform($(this))})}); +function cuteformhtml(e,t){var a=e.val(),o=e.text(),d="undefined"!=typeof t.images&&"undefined"!=typeof t.images[a]?t.images[a]:"undefined"!=typeof e.attr("data-cuteform-image")?e.attr("data-cuteform-image"):null;if(null!==d)return $('');var f="undefined"!=typeof t.html&&"undefined"!=typeof t.html[a]?t.html[a]:"undefined"!=typeof e.attr("data-cuteform-html")?e.attr("data-cuteform-html"):a;return $('
'+f+"
")}function cuteform(e,t){var t="undefined"==typeof t?{}:t;e.addClass("cuteform-select");var a,o,d,f="true"==t.modal||"true"==e.attr("data-cuteform-modal"),c="true"==t["modal-text"]||"true"==e.attr("data-cuteform-modal-text");if(a=$('
'+(r||f?"":"
")+"
"),e.after(a),f){o=$("#cuteform-modal");var d=$('');e.after(d),e.hide(),a.hide()}else{var r=!("undefined"!=typeof t.hide&&"false"==t.hide.toString()||"false"==e.attr("data-cuteform-hide"));r&&e.hide()}e.find("option").each(function(){var r=$(this),l=cuteformhtml(r,t);a.append(l),r.val()==e.find("option:selected").first().val()&&l.addClass("cuteform-selected"),l.click(function(){e.val(l.attr("data-cuteform-val")),a.find(".cuteform-elt").removeClass("cuteform-selected"),l.addClass("cuteform-selected"),f&&(d.text(""),d.append(c?''+a.find(".cuteform-selected").attr("data-cuteform-text")+"":a.find(".cuteform-selected").clone(!0).off()),o.modal("hide"))})}),f&&(d.append(c?''+a.find(".cuteform-selected").attr("data-cuteform-text")+"":a.find(".cuteform-selected").clone(!0).off()),d.click(function(e){e.preventDefault(),o.css("display","block"),o.find(".modal-body").text("");var t=a.clone(!0);t.show(),o.find(".modal-body").append(t),o.modal(),o.on("hidden.bs.modal",function(){o.css("display","none")})})),e.change(function(){a.find(".cuteform-elt").removeClass("cuteform-selected"),a.find("[data-cuteform-val="+e.find("option:selected").first().val()+"]").addClass("cuteform-selected")})}function cuteformclear(){$(".cuteform").remove(),$(".cuteform-selected").removeClass("cuteform-selected"),$(".cuteform-select").show(),$(".cuteform-select").removeClass("cuteform-select")}$(document).ready(function(){$("select[data-cuteform=true]").each(function(){cuteform($(this))})});