<commit_before>function loading_progress(){
    $('img.lac-loading-indicator').removeClass('hide-bloc');
}

function finish_progress(){
    $('img.lac-loading-indicator').addClass('hide-bloc');
}

function update_notification_id(id, url){
   $.post(url, {id: id}, function(data) {
     console.log(data)

   });
}

function collapse_current_collpsein(){
  var current_btn = $(this);
  var btns = $('.navbar-toggle.collapsed');
  for(var i = 0; i<= btns.length; i++){
      var btn = $(btns[i]);
      if (btn != current_btn){
        $(btn.data('target')).collapse('hide');
      }
  }

}

function activate_explanation(event){
  if($(event.target).parents('.proposal-explanation').length == 0){
    var explanation = $($(this).find('.proposal-explanation').first());
    explanation.removeClass('hide-bloc');}
};

function close_explanation(event){
    var explanation = $($(this).parents('.proposal-explanation').first());
    explanation.addClass('hide-bloc');
};


function set_visited(){
    $.cookie('visited', 'true', {path: '/',  expires: 1});
}


function initscroll(){
  var result_scrolls = $(".result-scroll")
  for(var i = 0; i<= result_scrolls.length; i++){
    var result_scroll = $(result_scrolls[i]);
    var id = result_scroll.attr('id')
    result_scroll.mCustomScrollbar({
    theme:"minimal-dark",
    scrollInertia: 100,
    callbacks:{
      onTotalScroll:function(){
        $(this).trigger('scroll');
      }
    }
  });
  $(result_scroll.find('.mCSB_container')).infinitescroll({
    behavior: 'local',
    bufferPx: 0,

    binder: result_scroll,
    navSelector  : "#"+id+" .batch",
                   // selector for the paged navigation (it will be hidden)
    nextSelector : "#"+id+" .pager .next",
                   // selector for the NEXT link (to page 2)
    itemSelector : "#"+id+" .result-container",

    pathParse: function(path, next_page) {
       var new_path = path;
       var id = result_scroll.attr('id')
       var filter = $('#filter-'+id);
       if (filter.length>0){
            var form = $($(filter).find('form').first());
            var filter_container = $(form.parents('.filter-container'));
            var filter_btn = $(filter_container.find('.filter-btn').first());
            var data_get = $(form).serialize();
            data_get += '&'+'op=filter_result';
            var filter_source = filter_btn.data('filter_source');
            if (filter_source !== ''){
              data_get += '&'+'filter_source='+filter_source;
            }
            data_get += '&'+'filter_result=true';
            data_get += '&'+'scroll=true';
            data_get += '&'+'view_only=1';
            new_path += '&'+ data_get;
      };
      // var parts = new_path.match(/^(.*?batch_num=)1(.*|$)/).slice(1);
// ["http://0.0.0.0:6543/@@seemyideas?batch_num=", "&batch_size=1&action_uid=-4657697968224339750"]
// substanced Batch starts at 0, not 1
       var f = function(currPage) {
          var next_path = $($('#'+id+' .result-container').first().parents('div').first().find('>.result-container').last()).data('nex_url')
          return next_path +'&'+ data_get;
       };
       return f;
    },
    loading: {
      finishedMsg: '<span class="label label-warning">'+ novaideo_translate("No more item.")+"</span>",
      img: window.location.protocol + "//" + window.location.host + "/novaideostatic/images/progress_bar.gif",
      msgText: "",
    }
  });
}
};


function init_content_text(){
     var texts = $('.content-text');
     for(i=0; i<texts.length; i++){
         if ($(texts[i]).height()>600){
             $(texts[i]).addClass("content-text-scroll")
         }
     }
};

function init_result_scroll(event, default_top, element){
  if(default_top == undefined){
    default_top = 1600
  }
  var result_scrolls = element? $(element.find('.result-scroll')): $('.result-scroll');
  for(var i = 0; i<= result_scrolls.length; i++){
    var result_scroll = $(result_scrolls[i]);
    var last_child = $(result_scroll.find('.result-item, .small-result').last());
    if (last_child.length > 0){
        var top = last_child.offset().top - result_scroll.offset().top  + last_child.height() + 50
        if (top < default_top){
         result_scroll.height(top);
        }else{
          result_scroll.height(default_top);
        }
    }else{
         result_scroll.height(100);<commit_msg>fix js<commit_after>function loading_progress(){
    $('img.lac-loading-indicator').removeClass('hide-bloc');
}

function finish_progress(){
    $('img.lac-loading-indicator').addClass('hide-bloc');
}

function update_notification_id(id, url){
   $.post(url, {id: id}, function(data) {
     console.log(data)

   });
}

function collapse_current_collpsein(){
  var current_btn = $(this);
  var btns = $('.navbar-toggle.collapsed');
  for(var i = 0; i<= btns.length; i++){
      var btn = $(btns[i]);
      if (btn != current_btn){
        $(btn.data('target')).collapse('hide');
      }
  }

}

function activate_explanation(event){
  if($(event.target).parents('.proposal-explanation').length == 0){
    var explanation = $($(this).find('.proposal-explanation').first());
    explanation.removeClass('hide-bloc');}
};

function close_explanation(event){
    var explanation = $($(this).parents('.proposal-explanation').first());
    explanation.addClass('hide-bloc');
};


function set_visited(){
    $.cookie('visited', 'true', {path: '/',  expires: 1});
}


function initscroll(){
  var result_scrolls = $(".result-scroll")
  for(var i = 0; i<= result_scrolls.length; i++){
    var result_scroll = $(result_scrolls[i]);
    var id = result_scroll.attr('id')
    result_scroll.mCustomScrollbar({
    theme:"minimal-dark",
    scrollInertia: 100,
    callbacks:{
      onTotalScroll:function(){
        $(this).trigger('scroll');
      }
    }
  });
  $(result_scroll.find('.mCSB_container')).infinitescroll({
    behavior: 'local',
    bufferPx: 0,

    binder: result_scroll,
    navSelector  : "#"+id+" .batch",
                   // selector for the paged navigation (it will be hidden)
    nextSelector : "#"+id+" .pager .next",
                   // selector for the NEXT link (to page 2)
    itemSelector : "#"+id+" .result-container",

    pathParse: function(path, next_page) {
       var new_path = path;
       var id = result_scroll.attr('id')
       var filter = $('#filter-'+id);
       if (filter.length>0){
            var form = $($(filter).find('form').first());
            var filter_container = $(form.parents('.filter-container'));
            var filter_btn = $(filter_container.find('.filter-btn').first());
            var data_get = $(form).serialize();
            data_get += '&'+'op=filter_result';
            var filter_source = filter_btn.data('filter_source');
            if (filter_source !== ''){
              data_get += '&'+'filter_source='+filter_source;
            }
            data_get += '&'+'filter_result=true';
            data_get += '&'+'scroll=true';
            data_get += '&'+'view_only=1';
            new_path += '&'+ data_get;
      };
      // var parts = new_path.match(/^(.*?batch_num=)1(.*|$)/).slice(1);
// ["http://0.0.0.0:6543/@@seemyideas?batch_num=", "&batch_size=1&action_uid=-4657697968224339750"]
// substanced Batch starts at 0, not 1
       var f = function(currPage) {
          var next_path = $($('#'+id+' .result-container').first().parents('div').first().find('>.result-container').last()).data('nex_url')
          return next_path +'&'+ data_get;
       };
       return f;
    },
    loading: {
      finishedMsg: '<span class="label label-warning">'+ novaideo_translate("No more item.")+"</span>",
      img: window.location.protocol + "//" + window.location.host + "/novaideostatic/images/progress_bar.gif",
      msgText: "",
    }
  });
}
};


function init_content_text(){
     var texts = $('.content-text');
     for(i=0; i<texts.length; i++){
         if ($(texts[i]).height()>600){
             $(texts[i]).addClass("content-text-scroll")
         }
     }
};

function init_result_scroll(event, default_top, element){
  if(default_top == undefined){
    default_top = 1600
  }
  var result_scrolls = element? $(element.find('.result-scroll')): $('.result-scroll');
  for(var i = 0; i<= result_scrolls.length; i++){
    var result_scroll = $(result_scrolls[i]);
    var last_child = $(result_scroll.find('.result-item, .small-result').last());
    if (last_child.length > 0){
        var top = last_child.offset().top - result_scroll.offset().top  + last_child.height() + 10
        if (top < default_top){
         result_scroll.height(top);
        }else{
          result_scroll.height(default_top);
        }
    }else{
         result_scroll.height(100);
{'fraction_non_alphanumeric': 0.19027921406411583, 'fraction_numerical': 0.013328737217051592, 'mean_word_length': 2.9563636363636365, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '100175', 'n_tokens_mistral': 2878, 'n_tokens_neox': 2773, 'n_words': 496}