<commit_before>/**
 * options:
 *  - pubsub: PubSub object
 *  - $: jQuery
 *  - target: DOM element to write into
 *  - _: i18n module
 * 
 * TODO subscribe to all statusbar related events
 */

var 
StatusBar = function(options) {
var pubsub = options.pubsub,
    $ = options.$,
    target = options.target,
    _ = options._,
    list,
    displayItem = function(text) {
        var item = $('<li/>').text(text);
        list.append(item);
        setTimeout(function() {
            item.remove();
        }, 3000);
    } 
    ;
    
    list = $('<ul/>');
    target.append(list);
    
    pubsub.on('invalid_move', function(data) {
        displayItem(_(data.message));
    });
};<commit_msg>StatusBar: improved display, temporarirly omits use of i18n<commit_after>/**
 * options:
 *  - $: jQuery object
 *  - pubsub: PubSub object
 *  - target: DOM element to write into
 *  - _: i18n module | TODO out of use
 * 
 * TODO subscribe to all statusbar related events
 * TODO use changeGameSpeed
 */

var 
StatusBar = function(options) {
var $ = options.$,
    pubsub = options.pubsub,
    target = options.target,
    //_ = options._,
    setMargin = function() {
        target.css('margin-bottom', target.outerHeight() * -1);    
    },
    displayItem = function(text) {
        var item = $('<li/>').text(text);
        
        target.append(item);
        setMargin();
        
        target.show();
        
        setTimeout(function() {
            item.remove();
            if (target.children().length == 0) {
                target.hide();
            } else {
                setMargin();
            }
        }, 3000);
    } 
    ;
    
    target.hide();
    
    pubsub.on('invalid_move', function(data) {
        //displayItem(_(data.message));
        displayItem(data.message);
    });
};
{'fraction_non_alphanumeric': 0.14884233737596472, 'fraction_numerical': 0.008820286659316428, 'mean_word_length': 1.9321486268174475, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '394547', 'n_tokens_mistral': 570, 'n_tokens_neox': 554, 'n_words': 120}