Skip to content
Snippets Groups Projects
Main.js 1.93 KiB
Newer Older

/* global $ */
/* @depend TablesorterController.js */

var QfqNS = QfqNS || {};

$(document).ready( function () {
    (function (n) {

        var tablesorterController = new n.TablesorterController();
        $('.tablesorter').each(function(i) {
            tablesorterController.setup($(this), i);
        }); // end .each()

        $('.tablesorter-filter').addClass('qfq-skip-dirty');

        $('.qfq-auto-grow').each(function() {
            var minHeight = $(this).attr("rows") * 14 + 18;
            var newHeight = $(this).prop('scrollHeight');
            var maxHeight = $(this).data('max-height') || 0;

            if ($(this).val === '' || newHeight < minHeight) {
                return;
            }

            if (newHeight < maxHeight || maxHeight === 0) {
                $(this).height(newHeight);
            } else {
                $(this).height(maxHeight);
        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
            $('.qfq-auto-grow').each(function () {
                var minHeight = $(this).attr("rows") * 14 + 18;
                var newHeight = $(this).prop('scrollHeight');
                var maxHeight = $(this).data('max-height') || 0;

                if ($(this).val === '' || newHeight < minHeight) {
                    return;
                }

                if (newHeight < maxHeight || maxHeight === 0) {
                    $(this).height(newHeight);
                } else {
                    $(this).height(maxHeight);
                }
            });
        });

bbaer's avatar
bbaer committed
        $('.qfq-auto-grow').on('input paste', function() {
            var newHeight = $(this).prop('scrollHeight');
            var maxHeight = $(this).data('max-height') || 0;
            if ($(this).outerHeight() < newHeight) {
                if(newHeight < maxHeight || maxHeight === 0) {
                    $(this).height(newHeight);
                }
            }
        });
    })(QfqNS);
});