<commit_before>(function($) {

    jQuery.extend($.icescrum, {
                addToWidgetBar:function(id, callback) {
                    if ($.inArray(id,  $.icescrum.getWidgetsList()) == -1) {
                        jQuery.ajax({
                                type:'GET',
                                global:false,
                                url:this.o.urlOpenWidget + '/' + id,
                                success:function(data, textStatus) {
                                    if ($.inArray(id, $.icescrum.getWidgetsList()) == -1 && data) {
                                        $(data).appendTo($.icescrum.o.widgetContainer);
                                        $.icescrum.addToWidgetsList(id);
                                        if (callback) {
                                            callback();
                                        }
                                    }
                                },
                                error:function() {
                                    $.icescrum.removeFromWidgetsList(id);
                                }
                            });
                    }
                    return false;
                },

                widgetToWindow:function(obj, event) {
                    var opts = obj.data('opts');
                    $.icescrum.openWindow(obj.data('id'));
                    this.stopEvent(event);
                },

                closeWidget:function(obj, event) {
                    var opts = obj.data('opts');
                    obj.effect('blind', null, 'fast', function() { obj.remove(); });
                    this.removeFromWidgetsList(obj.data('id'));
                    if (opts && opts.onClose)
                        opts.onClose();
                    if (event)
                        this.stopEvent(event);
                },

                saveWidgetsList:function(widgetsList){
                    if ($.icescrum.product.id){
                        $.cookie('widgets-' + $.icescrum.product.id, widgetsList);
                    }else{
                        $.cookie('widgets-noproduct', widgetsList);
                    }
                },

                getWidgetsList:function(){
                    var list = $.icescrum.product.id ? $.cookie('widgets-' + $.icescrum.product.id) : $.cookie('widgets-noproduct');
                    return list ? list.split(',') : [];
                },

                removeFromWidgetsList:function(id){
                    var list = $.grep(this.getWidgetsList(), function(value) {
                        return value != id;
                    });
                    this.saveWidgetsList(list);
                },

                addToWidgetsList:function(id){
                    var list = this.getWidgetsList();
                    list.push(id);<commit_msg>- avoide duplicate widgets - cookie by user / project<commit_after>(function($) {

    jQuery.extend($.icescrum, {
                addToWidgetBar:function(id, callback) {
                    if ($.inArray(id,  $.icescrum.getWidgetsList()) == -1) {
                        jQuery.ajax({
                                type:'GET',
                                global:false,
                                url:this.o.urlOpenWidget + '/' + id,
                                success:function(data, textStatus) {
                                    if ($.inArray(id, $.icescrum.getWidgetsList()) == -1 && data) {
                                        $(data).appendTo($.icescrum.o.widgetContainer);
                                        $.icescrum.addToWidgetsList(id);
                                        if (callback) {
                                            callback();
                                        }
                                    }
                                },
                                error:function() {
                                    $.icescrum.removeFromWidgetsList(id);
                                }
                            });
                    }
                    return false;
                },

                widgetToWindow:function(obj, event) {
                    var opts = obj.data('opts');
                    $.icescrum.openWindow(obj.data('id'));
                    this.stopEvent(event);
                },

                closeWidget:function(obj, event) {
                    var opts = obj.data('opts');
                    obj.effect('blind', null, 'fast', function() { obj.remove(); });
                    this.removeFromWidgetsList(obj.data('id'));
                    if (opts && opts.onClose)
                        opts.onClose();
                    if (event)
                        this.stopEvent(event);
                },

                saveWidgetsList:function(widgetsList){
                    widgetsList = $.makeArray($(widgetsList).filter(function(i,itm){
                        return i == $(widgetsList).index(itm);
                    }));
                    if ($.icescrum.product.id){
                        $.cookie('widgets-' + ($.icescrum.product.id ? $.icescrum.product.id : 'noproduct') + '-' +($.icescrum.user.id ? $.icescrum.user.id : 'anonymous') , widgetsList);
                    }
                },

                getWidgetsList:function(){
                    var list = $.icescrum.product.id ? $.cookie('widgets-' + $.icescrum.product.id) : $.cookie('widgets-noproduct');
                    return list ? list.split(',') : [];
                },

                removeFromWidgetsList:function(id){
                    var list = $.grep(this.getWidgetsList(), function(value) {
                        return value != id;
                    });
                    this.saveWidgetsList(list);
                },

                addToWidgetsList:function(id){
                    var list = this.getWidgetsList();
                    list.push(id);
{'fraction_non_alphanumeric': 0.1188235294117647, 'fraction_numerical': 0.0006722689075630252, 'mean_word_length': 0.8922098569157393, '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': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1451473', 'n_tokens_mistral': 1430, 'n_tokens_neox': 1292, 'n_words': 187}