<commit_before>;(function(window, document){
    'use strict';
    var self;
    function bindEvents(){
        window.addEventListener('resize', function(){
            makeFlexText.call(self);
        }, false);
    }

    bindEvents();

    function getBlockNode(block){
        var _block;

        switch (typeof block) {
            case 'string':
                _block = document.querySelector(block);
                break;
            case 'object':
                if (block.nodeType > 0) {
                    _block = block;
                } else {
                    try { console.log('FlexText: wrong block type'); } catch (e) {}
                }
                break;
        }

        this._block = _block;
    }

    function makeFlexText() {
        var node = this._block.cloneNode(true),
            text = document.createElement('div'),
            checkContainer = document.createElement('div'),
            resultFs = this._currentFs || this._baseFs;

        node.style.width = this._block.clientWidth + 'px';
        node.style.height = this._block.clientHeight + 'px';
        text.innerHTML = node.innerHTML;
        node.innerHTML = '';
        node.appendChild(text);

        checkContainer.style.position = 'fixed';
        checkContainer.style.visibility = 'hidden';
        checkContainer.style.zIndex = -10;
        checkContainer.style.left = '500px';
        checkContainer.appendChild(node);

        document.body.appendChild(checkContainer);

        if (text.clientHeight > node.clientHeight) {
            while(text.clientHeight > node.clientHeight){
                resultFs -= 1;
                text.style.fontSize = resultFs + 'px';
            }
        } else {
            while(text.clientHeight < node.clientHeight){
                resultFs += 1;
                text.style.fontSize = resultFs + 'px';
            }
            resultFs -= 1;
        }

        this._currentFs = resultFs;
        this._block.style.fontSize = resultFs + 'px';
        checkContainer.remove();
    }

    function collectParams(){
        this._baseFs = parseInt(window.getComputedStyle(this._block, null).getPropertyValue('font-size'), 10);
        this._height = this._block.offsetHeight;
    }

    bindEvents();

    function FlexText(block){
        self = this;
        getBlockNode.call(this, block);
        collectParams.call(this);
        makeFlexText.call(this);
    }

    window.FlexText = FlexText;
})(window, document);<commit_msg>fix 4 padding work<commit_after>var FlexText = (function(window, document){
    'use strict';
    var self;
        function bindEvents(){
            window.addEventListener('resize', function(){
                makeFlexText.call(self);
            }, false);
        }

        bindEvents();

    function getBlockNode(block){
        var _block;

        switch (typeof block) {
            case 'string':
                _block = document.querySelector(block);
                break;
            case 'object':
                if (block.nodeType > 0) {
                    _block = block;
                } else {
                    try { console.log('FlexText: wrong block type'); } catch (e) {}
                }
                break;
        }

        this._block = _block;
    }

    function makeFlexText() {
        var node = this._block.cloneNode(true),
            text = document.createElement('div'),
            checkContainer = document.createElement('div'),
            resultFs = this._currentFs || this._baseFs;

//            node.style.width = this._block.clientWidth + 'px';
        node.style.width = window.getComputedStyle(this._block, null).getPropertyValue('width');
//            node.style.height = this._block.clientHeight + 'px';
        node.style.height = window.getComputedStyle(this._block, null).getPropertyValue('height');

        text.innerHTML = node.innerHTML;
        node.innerHTML = '';
        node.appendChild(text);

        checkContainer.style.position = 'fixed';
        checkContainer.style.visibility = 'hidden';
        checkContainer.style.zIndex = -10;
        checkContainer.style.left = '500px';
        checkContainer.appendChild(node);

        document.body.appendChild(checkContainer);

//            var nodeHeight = Math.floor(+ window.getComputedStyle(node, null).getPropertyValue('height').replace('px', ''));
        var nodeHeight = + window.getComputedStyle(node, null).getPropertyValue('height').replace('px', '');

//            console.log(window.getComputedStyle(node, null).getPropertyValue('height'));

        if ((+ window.getComputedStyle(text, null).getPropertyValue('height').replace('px', '')) > nodeHeight) {
            while((+ window.getComputedStyle(text, null).getPropertyValue('height').replace('px', '')) > nodeHeight){
                resultFs -= 1;
                text.style.fontSize = resultFs + 'px';
            }
        } else if ((+ window.getComputedStyle(text, null).getPropertyValue('height').replace('px', '')) < nodeHeight) {
            while((+ window.getComputedStyle(text, null).getPropertyValue('height').replace('px', '')) < nodeHeight){
                resultFs += 1;
                text.style.fontSize = resultFs + 'px';
            }
            resultFs -= 1;
        }

        this._currentFs = resultFs;
        this._block.style.fontSize = resultFs + 'px';
        checkContainer.remove();
    }

    function collectParams(){
        this._baseFs = parseInt(window.getComputedStyle(this._block, null).getPropertyValue('font-size'), 10);
//            this._height = this._block.clientHeight;
//            this._height = window.getComputedStyle(this._block, null).getPropertyValue('height');
    }

    function FlexText(block){
        self = this;
        getBlockNode.call(this, block);
        collectParams.call(this);
        makeFlexText.call(this);
    }

    return FlexText;
})(window, document);
{'fraction_non_alphanumeric': 0.13032454361054766, 'fraction_numerical': 0.003887762001352265, 'mean_word_length': 2.0096642929806716, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 9, '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': '6760149', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1538, 'n_words': 276}