moodle/lib/amd/build/auto_rows.min.js

3 lines
763 B
JavaScript

define ("core/auto_rows",["jquery"],function(a){var b={ELEMENT:"[data-auto-rows]"},c={ROW_CHANGE:"autorows:rowchange"},d=function(a){var b=a.attr("rows"),c=a.data("min-rows"),d=a.attr("data-max-rows"),e=a.height(),f=a.innerHeight(),g=a[0].scrollHeight,h=(g-(f-e))/(e/b);a.css("height","");if(h<c){return c}else if(d&&h>=d){return d}else{return h}},e=function(b){var e=a(b.target),f=e.data("min-rows"),g=e.attr("rows");if("undefined"==typeof f){e.data("min-rows",g)}e.attr("rows",1);var h=d(e);e.attr("rows",h);if(h!=g){e.trigger(c.ROW_CHANGE)}};return{init:function init(c){if(a(c).data("auto-rows")){a(c).on("input propertychange",e.bind(this))}else{a(c).on("input propertychange",b.ELEMENT,e.bind(this))}},events:c}});
//# sourceMappingURL=auto_rows.min.js.map