<commit_before>/**
 * Render a shim
 * @namespace view
 * @class Shim
 */
ludo.view.Shim = new Class({
    txt:'Loading content...',
    el:undefined,
    shim:undefined,
    renderTo:undefined,

    initialize:function (config) {
        if (config.txt)this.txt = config.txt;
        this.renderTo = config.renderTo;
    },

    getEl:function () {
        if (this.el === undefined) {
            this.el = ludo.dom.create({
                renderTo:this.getRenderTo(),
                cls:'ludo-shim-loading',
                css:{'display':'none'},
                html : this.getText(this.txt)
            });
        }
        return this.el;
    },

    getShim:function () {
        if (this.shim === undefined) {
			if(ludo.util.isString(this.renderTo))this.renderTo = ludo.get(this.renderTo).getEl();
            this.shim = ludo.dom.create({
                renderTo:this.getRenderTo(),
                cls:'ludo-loader-shim',
                css:{'display':'none'}
            });
        }
        return this.shim;
    },

	getRenderTo:function(){
		if(ludo.util.isString(this.renderTo)){
			var view = ludo.get(this.renderTo);
			if(!view)return undefined;
			this.renderTo = ludo.get(this.renderTo).getEl();
		}
		return this.renderTo;
	},

    show:function (txt) {
        if (txt !== undefined) {
            this.getEl().set('html', this.getText(txt));
        }else{
			this.getEl().set('html', this.getText(this.txt));
		}
        this.css('');
		this.resizeShim();
    },

	resizeShim:function(){
		var span = document.id(this.el).getElement('span');
		var width = (span.offsetWidth + 5);
		this.el.style.width = width + 'px';
		this.el.style.marginLeft = (Math.round(width/2) * -1) + 'px';
<commit_msg>code refactorign<commit_after>/**
 * Render a shim
 * @namespace view
 * @class Shim
 */
ludo.view.Shim = new Class({
    txt:'Loading content...',
    el:undefined,
    shim:undefined,
    renderTo:undefined,

    initialize:function (config) {
        if (config.txt)this.txt = config.txt;
        this.renderTo = config.renderTo;
    },

    getEl:function () {
        if (this.el === undefined) {
            this.el = ludo.dom.create({
                renderTo:this.getRenderTo(),
                cls:'ludo-shim-loading',
                css:{'display':'none'},
                html : this.getText(this.txt)
            });
        }
        return this.el;
    },

    getShim:function () {
        if (this.shim === undefined) {
			if(ludo.util.isString(this.renderTo))this.renderTo = ludo.get(this.renderTo).getEl();
            this.shim = ludo.dom.create({
                renderTo:this.getRenderTo(),
                cls:'ludo-loader-shim',
                css:{'display':'none'}
            });
        }
        return this.shim;
    },

	getRenderTo:function(){
		if(ludo.util.isString(this.renderTo)){
			var view = ludo.get(this.renderTo);
			if(!view)return undefined;
			this.renderTo = ludo.get(this.renderTo).getEl();
		}
		return this.renderTo;
	},

    show:function (txt) {
		this.getEl().set('html', this.getText(txt ? txt : this.txt));
        this.css('');
		this.resizeShim();
    },

	resizeShim:function(){
		var span = document.id(this.el).getElement('span');
		var width = (span.offsetWidth + 5);
		this.el.style.width = width + 'px';
		this.el.style.marginLeft = (Math.round(width/2) * -1) + 'px';

{'fraction_non_alphanumeric': 0.16860291927316057, 'fraction_numerical': 0.0017873100983020554, 'mean_word_length': 2.1353874883286648, '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': '1254864', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1101, 'n_words': 171}