<commit_before>/* Author: Loconomics */
// OUR namespace (abbreviated Loconomics), same as 'var LC' with caution
window['LC'] = window['LC'] || {};

/* Generic blockUI options sets */
var loadingBlock = { message: '<img src="' + UrlUtil.AppPath + 'img/loading.gif"/>' };
var errorBlock = function (error, reload, style) {
    return {
        css: $.extend({ cursor: 'default' }, style || {}),
        message: '<a class="close-popup" href="#close-popup">X</a><div class="info">There was an error'
            + (error ? ': ' + error : '')
            + (reload ? ' <a href="javascript: ' + reload + ';">Click to reload</a>' : '')
            + '</div>'
    }
};
var infoBlock = function (message, options) {
    return $.extend({
        message: '<a class="close-popup" href="#close-popup">X</a><div class="info">' + message + '</div>'
        /*,css: { cursor: 'default' }*/
        ,overlayCSS: { cursor: 'default' }
    }, options);
}
var gLoadingRetard = 300;

// Array Remove - By <NAME> (MIT Licensed)
Array.prototype.remove = function (from, to) {
    var rest = this.slice((to || from) + 1 || this.length);
    this.length = from < 0 ? this.length + from : from;
    return this.push.apply(this, rest);
};

/*
 * Our jQuery additions (small plugins)
 */
$.fn.hasScrollBar = function () {
    if (!this || this.length == 0) return { vertical: false, horizontal: false };
    //note: clientHeight= height of holder
    //scrollHeight= we have content till this height
    var t = this.get(0);
    return {
        vertical: t.clientHeight < t.scrollHeight,
        horizontal: t.clientWidth < t.scrollWidth
    };
}
$.fn.reload = function (newurl, onload) {
    this.each(function () {
        var $t = $(this);
        if (newurl)
            $t.data('source-url', newurl);
        var url = $t.data('source-url');
        if (url) {
            // TODO ADD auto cancelation of previous requests (use .ajax instead .load)
            // TODO Add lcJSON code interpreter (.ajax instead .load), and errors
            // Loading, with retard
            var loadingtimer = setTimeout(function () {
                smoothBoxBlock(loadingBlock.message, $t, 'loading');
                //$t.block(loadingBlock);
            }, gLoadingRetard);
            $t.load(url, function () {
                clearTimeout(loadingtimer);
                if (onload) $.proxy(onload, this)();
                //smoothBoxBlock(null, $t, true);
                //$t.unblock();
            });
        }
    });
}

/*
* Tabbed interface logic
*/
var TabbedUX = {
    init: function () {<commit_msg>Fixed an error on our jquery extension 'hasScrollbar' to be aware of possible borders on elements that increase scrollWidth/Height but not clientWidth/Height (using jquery.outerWidth/Height instead client*). This affects issue #111, showing tabs-slider when no need.<commit_after>/* Author: Loconomics */
// OUR namespace (abbreviated Loconomics), same as 'var LC' with caution
window['LC'] = window['LC'] || {};

/* Generic blockUI options sets */
var loadingBlock = { message: '<img src="' + UrlUtil.AppPath + 'img/loading.gif"/>' };
var errorBlock = function (error, reload, style) {
    return {
        css: $.extend({ cursor: 'default' }, style || {}),
        message: '<a class="close-popup" href="#close-popup">X</a><div class="info">There was an error'
            + (error ? ': ' + error : '')
            + (reload ? ' <a href="javascript: ' + reload + ';">Click to reload</a>' : '')
            + '</div>'
    }
};
var infoBlock = function (message, options) {
    return $.extend({
        message: '<a class="close-popup" href="#close-popup">X</a><div class="info">' + message + '</div>'
        /*,css: { cursor: 'default' }*/
        ,overlayCSS: { cursor: 'default' }
    }, options);
}
var gLoadingRetard = 300;

// Array Remove - By <NAME> (MIT Licensed)
Array.prototype.remove = function (from, to) {
    var rest = this.slice((to || from) + 1 || this.length);
    this.length = from < 0 ? this.length + from : from;
    return this.push.apply(this, rest);
};

/*
 * Our jQuery additions (small plugins)
 */
$.fn.hasScrollBar = function () {
    if (!this || this.length == 0) return { vertical: false, horizontal: false };
    //note: clientHeight= height of holder
    //scrollHeight= we have content till this height
    var t = this.get(0);
    return {
        vertical: this.outerHeight() < t.scrollHeight,
        horizontal: this.outerWidth() < t.scrollWidth
    };
}
$.fn.reload = function (newurl, onload) {
    this.each(function () {
        var $t = $(this);
        if (newurl)
            $t.data('source-url', newurl);
        var url = $t.data('source-url');
        if (url) {
            // TODO ADD auto cancelation of previous requests (use .ajax instead .load)
            // TODO Add lcJSON code interpreter (.ajax instead .load), and errors
            // Loading, with retard
            var loadingtimer = setTimeout(function () {
                smoothBoxBlock(loadingBlock.message, $t, 'loading');
                //$t.block(loadingBlock);
            }, gLoadingRetard);
            $t.load(url, function () {
                clearTimeout(loadingtimer);
                if (onload) $.proxy(onload, this)();
                //smoothBoxBlock(null, $t, true);
                //$t.unblock();
            });
        }
    });
}

/*
* Tabbed interface logic
*/
var TabbedUX = {
    init: function () {
{'fraction_non_alphanumeric': 0.16418185164734034, 'fraction_numerical': 0.0031290263206331676, 'mean_word_length': 2.370967741935484, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 27, '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': '5957444', 'n_tokens_mistral': 1629, 'n_tokens_neox': 1571, 'n_words': 454}