<commit_before>define(['jquery'], function($) {
    'use strict';

    function expandContent(readMore) {
        var toExpand = $(readMoreDom).prevAll(".content");

        // Measure sizes to animate between
        var heightBefore = $(toExpand).height();
        toExpand.removeClass('collapsed');
        var heightAfter = $(toExpand).height();
        var diff = Math.abs(heightAfter - heightBefore);

        // Make expand animation speed independent of blog post length
        var pixelsPerSecond = 600;
        var animLengthInMs = diff / pixelsPerSecond * 1000;

        // Set up initial size and animate
        toExpand.height(heightBefore);
        toExpand.animate({height: heightAfter}, animLengthInMs, function(){
            toExpand.css('height', '')
            toExpand.removeClass('fade-last-line')
        });

        $(readMoreDom).css('visibility', 'hidden');
        $(readMoreDom).animate({width: 0, paddingRight: 0}, 350);
    }

    $(".blog-post .google-tag-manager-read-more-button").each(function() {
        $(this).one('click', function(){
            expandContent(this);
        });
    });

    $(".blog-post .content.collapsed").each(function() {
        $(this).one('click', function(){
            expandContent($(this).parent().find(".google-tag-manager-read-more-button"));
        });
    });
});
<commit_msg>Trigger click instead of running same code, for GTM trigger<commit_after>define(['jquery'], function($) {
    'use strict';

    $(".blog-post .google-tag-manager-read-more-button").each(function() {
        $(this).one('click', function(){
            var toExpand = $(this).prevAll(".content");

            // Measure sizes to animate between
            var heightBefore = $(toExpand).height();
            toExpand.removeClass('collapsed');
            var heightAfter = $(toExpand).height();
            var diff = Math.abs(heightAfter - heightBefore);

            // Make expand animation speed independent of blog post length
            var pixelsPerSecond = 600;
            var animLengthInMs = diff / pixelsPerSecond * 1000;

            // Set up initial size and animate
            toExpand.height(heightBefore);
            toExpand.animate({height: heightAfter}, animLengthInMs, function(){
                toExpand.css('height', '')
                toExpand.removeClass('fade-last-line')
            });

            $(this).css('visibility', 'hidden');
            $(this).animate({width: 0, paddingRight: 0}, 350);
        });
    });

    $(".blog-post .content.collapsed").each(function() {
        $(this).one('click', function(){
            $(this).parent().find(".google-tag-manager-read-more-button").trigger('click');
        });
    });
});

{'fraction_non_alphanumeric': 0.1603081438004402, 'fraction_numerical': 0.00880410858400587, 'mean_word_length': 2.379182156133829, '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': '4985201', 'n_tokens_mistral': 764, 'n_tokens_neox': 698, 'n_words': 150}