<commit_before>/*
 * onCreated
 */

Template.map.onCreated(function(){

  var instance = this;

  // local configuration
  instance.dur = 350;
  instance.dur2 = 550;

  if (Session.get('isMobile')) {
    instance.scale = instance.initial_scale = 2;
  } else {
    instance.scale = instance.initial_scale = 5;
  }

  instance.themes = Themes.find({});
  instance.natures = Natures.find({});

  /*
   * Helper functions
   */

  instance.reachToRadius = function (reach) {
    var level = IncidencyReachs.findOne(reach, {field: 'level'}).level;
    return 3 * Math.sqrt(level / Math.PI);
  }

  instance.centerMap = function() {
    var width = $(window).width();
    var height = $(window).height();
    var svg_map = instance.svg_map;

    instance.zoom
      .translate([width/2,height/2])
      .scale(instance.initial_scale)
      .event(
        instance.svg_map
          .transition()
          .duration(instance.dur2)
      );
  }

  instance.onResize = function() {


    var isMobile = Session.get('isMobile');
    var dbody = document.body;
  	instance.win_w = $( window ).width();
  	instance.win_h = $( window ).height();

    if (isMobile)
      bar_h = 50;
    else
      bar_h = 80;

    if (isMobile) {
      if (instance.win_w < instance.win_h) {
        $(dbody).addClass('port');
        $(dbody).removeClass('land');
        $(menu_bts).css({height: instance.win_h - 180, width: instance.win_w * 0.8 - 20});
      } else {
        $(dbody).removeClass('port');
        $(dbody).addClass('land');
        $(menu_bts).css({height: instance.win_h - 80, width: '75%' });
      }

      if (!menu.open)
        $(menu).css({left: -instance.win_w*0.8 });
    } else {
      if (instance.win_w > 1200)
        $(dbody).addClass('layout2');
      else
        $(dbody).removeClass('layout2');
    }

    instance.centerMap();

  }
});

Template.map.onRendered(function(){
  $('body').addClass('no_bg');
  $(document.body).addClass('mobile');

  var instance = this;

  /*
   * Reset view when rendered
   */
  Session.set('mapHelpIsOpen', false);
  Session.set('tooltipIsOpen', false);
  Session.set('tooltipIsPositioned', false);

  /*
   * Center map triggered after window resize
   */
  $(window).on('resize', instance.onResize );

  /*
   * Helper functions
   */

  var delta_drag = 3;
  var drag1 = [];
  var drag2 = [];
  var win_w;
  var win_h;
  var bar_h = 80;
  var filter_h = 25;

<commit_msg>add class only when client is mobile<commit_after>/*
 * onCreated
 */

Template.map.onCreated(function(){

  var instance = this;

  // local configuration
  instance.dur = 350;
  instance.dur2 = 550;

  if (Session.get('isMobile')) {
    instance.scale = instance.initial_scale = 2;
  } else {
    instance.scale = instance.initial_scale = 5;
  }

  instance.themes = Themes.find({});
  instance.natures = Natures.find({});

  /*
   * Helper functions
   */

  instance.reachToRadius = function (reach) {
    var level = IncidencyReachs.findOne(reach, {field: 'level'}).level;
    return 3 * Math.sqrt(level / Math.PI);
  }

  instance.centerMap = function() {
    var width = $(window).width();
    var height = $(window).height();
    var svg_map = instance.svg_map;

    instance.zoom
      .translate([width/2,height/2])
      .scale(instance.initial_scale)
      .event(
        instance.svg_map
          .transition()
          .duration(instance.dur2)
      );
  }

  instance.onResize = function() {


    var isMobile = Session.get('isMobile');
    var dbody = document.body;
  	instance.win_w = $( window ).width();
  	instance.win_h = $( window ).height();

    if (isMobile)
      bar_h = 50;
    else
      bar_h = 80;

    if (isMobile) {
      if (instance.win_w < instance.win_h) {
        $(dbody).addClass('port');
        $(dbody).removeClass('land');
        $(menu_bts).css({height: instance.win_h - 180, width: instance.win_w * 0.8 - 20});
      } else {
        $(dbody).removeClass('port');
        $(dbody).addClass('land');
        $(menu_bts).css({height: instance.win_h - 80, width: '75%' });
      }

      if (!menu.open)
        $(menu).css({left: -instance.win_w*0.8 });
    } else {
      if (instance.win_w > 1200)
        $(dbody).addClass('layout2');
      else
        $(dbody).removeClass('layout2');
    }

    instance.centerMap();

  }
});

Template.map.onRendered(function(){

  var instance = this;

  // remove background
  $('body').addClass('no_bg');

  // set mobile class
  if (Session.get('isMobile'))
    $(document.body).addClass('mobile');

  /*
   * Reset view when rendered
   */
  Session.set('mapHelpIsOpen', false);
  Session.set('tooltipIsOpen', false);
  Session.set('tooltipIsPositioned', false);

  /*
   * Center map triggered after window resize
   */
  $(window).on('resize', instance.onResize );

  /*
   * Helper functions
   */

  var delta_drag = 3;
  var drag1 = [];
  var drag2 = [];
  var win_w;
  var win_h;
  var bar_h = 80;
  var filter_h = 25;


{'fraction_non_alphanumeric': 0.16656547257640153, 'fraction_numerical': 0.017405383525602103, 'mean_word_length': 2.5630857966834895, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6171506', 'n_tokens_mistral': 1745, 'n_tokens_neox': 1641, 'n_words': 323}