<commit_before>/*jshint boss:true, expr:true, onevar:false */

var Anim;

/**
 * Y.Rednose.TreeView widget extension to provide animations.
 */
Anim = Y.Base.create('anim', Y.Base, [], {
    // -- Lifecycle Methods ----------------------------------------------------

    initializer: function () {
        this.after('open', this._afterExpand, this);
        this.after('close', this._afterCollapse, this);
    },

    // -- Protected Methods ----------------------------------------------------

    /**
     * Retrieve the DOM element containing the children of a given TreeView node.
     */
    _getChildrenElement: function (node) {
        var domNode = this.getHTMLNode(node);

        return Y.Node('#' + domNode.getAttribute('id')).one('ul');
    },

    // -- Protected Event Handlers ---------------------------------------------

    /**
     * Handles the collapse event.
     */
    _afterCollapse: function (e) {
        if (this.rendered === false) {
            return;
        }

        var treeNode = e.node,
            children = this._getChildrenElement(treeNode);

        children.setStyle('display', 'block');
        Y.Rednose.Anim.slideInY(children);
    },

    /**
     * Handles the expand event.
     */
    _afterExpand: function (e) {
        if (this.rendered === false) {
            return;
        }

        var treeNode = e.node,
            children = this._getChildrenElement(treeNode);

        // Hide potential scrollbars
        children.ancestor('.yui3-treeview').setStyle('overflow', 'hidden');
        children.setStyle('display', 'block');
        Y.Rednose.Anim.slideOutY(children);
    }
});

// -- Namespace ----------------------------------------------------------------
Y.namespace('Rednose.TreeView').Anim = Anim;
<commit_msg>Treeview animation disabled by default<commit_after>/*jshint boss:true, expr:true, onevar:false */

var Anim;

/**
 * Y.Rednose.TreeView widget extension to provide animations.
 */
Anim = Y.Base.create('anim', Y.Base, [], {
    // -- Lifecycle Methods ----------------------------------------------------

    initializer: function () {
        this.after('open', this._afterExpand, this);
        this.after('close', this._afterCollapse, this);
    },

    // -- Protected Methods ----------------------------------------------------

    /**
     * Retrieve the DOM element containing the children of a given TreeView node.
     */
    _getChildrenElement: function (node) {
        var domNode = this.getHTMLNode(node);

        return Y.Node('#' + domNode.getAttribute('id')).one('ul');
    },

    // -- Protected Event Handlers ---------------------------------------------

    /**
     * Handles the collapse event.
     */
    _afterCollapse: function (e) {
        if (!this.rendered || !this.get('animated')) {
            return;
        }

        var treeNode = e.node,
            children = this._getChildrenElement(treeNode);

        children.setStyle('display', 'block');
        Y.Rednose.Anim.slideInY(children);
    },

    /**
     * Handles the expand event.
     */
    _afterExpand: function (e) {
        if (!this.rendered || !this.get('animated')) {
            return;
        }

        var treeNode = e.node,
            children = this._getChildrenElement(treeNode);

        // Hide potential scrollbars
        children.ancestor('.yui3-treeview').setStyle('overflow', 'hidden');
        children.setStyle('display', 'block');
        Y.Rednose.Anim.slideOutY(children);
    }
}, {
    ATTRS: {
        /**
         * Enable animation for this TreeView instance
         */
        animated: {
            value : false
        }
    }
});

// -- Namespace ----------------------------------------------------------------
Y.namespace('Rednose.TreeView').Anim = Anim;

{'fraction_non_alphanumeric': 0.24141574220813525, 'fraction_numerical': 0.0005282620179609086, 'mean_word_length': 1.5196274118429807, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7053937', 'n_tokens_mistral': 1024, 'n_tokens_neox': 983, 'n_words': 208}