<commit_before>/**
 * The TabsView view.
 *
 * @return TabsView view (extends Backbone.View)
 */
define([
  'underscore',
  'handlebars',
  'd3',
  'map/presenters/TabsPresenter',
  'map/views/tabs/AnalysisView',
  'map/views/tabs/CountriesView',
  'map/views/tabs/BasemapsView',
  'map/views/tabs/HighresolutionView',
  'map/views/tabs/SubscribeView',
  'views/ShareView',
  'text!map/templates/tabs.handlebars',
  'text!map/templates/tabs-mobile.handlebars'
], function(_, Handlebars, d3, Presenter, AnalysisView, CountriesView, BasemapsView, HighresolutionView, SubscribeView, ShareView, tpl, tplMobile) {

  'use strict';

  var TabsView = Backbone.View.extend({

    el: '#module-tabs',

    events: {
      'click .tab' : 'toggleTabs',
      'click .share-mobile' : 'toggleShareMobile',
      'click .tab-mobile' : 'toggleTabsMobile',
      'click .tab-mobile-close' : 'hideTabsMobile',
      'click .tab-mobile-reset-country' : 'resetCountry',
      'click ul' : 'checkForestChangeAvailability'
    },

    template: Handlebars.compile(tpl),
    templateMobile: Handlebars.compile(tplMobile),

    initialize: function(map, countries) {
      this.map = map;
      this.countries = countries;
      this.presenter = new Presenter(this);
      // Render
      enquire.register("screen and (min-width:"+window.gfw.config.GFW_MOBILE+"px)", {
        match: _.bind(function(){
          this.render();
          this.cacheVars();
        },this)
      });
      enquire.register("screen and (max-width:"+window.gfw.config.GFW_MOBILE+"px)", {
        match: _.bind(function(){
          this.renderMobile();
          this.cacheVars();
        },this)
      });
      // this.setListeners();
    },

    cacheVars: function(){
      this.$tabs = this.$el.find('.tab');
      this.$tabMobileButtons = $('.tab-mobile');
      this.$tabMobileBackButtons = $('.tab-mobile-back');
      this.$settingsTabButton = $('#settings-tab-button');
      this.$tabsMobileContent = this.$el.find('.tab-mobile-content');
      this.$tabsContent = this.$el.find('.tab-content');
      this.$container = this.$el.find('.content');
    },

    // setListeners: function(){

    // },

    render: function(){
      this.$el.html(this.template());
      this.$el.removeClass('hide');
      this.initCustomViews();
    },

    renderMobile: function(){
      this.$el.html(this.templateMobile());
      this.$el.removeClass('hide');
      this.initCustomViews();
    },

    initCustomViews: function(){
      new AnalysisView(this.map, this.countries);
      // new CountriesView(this.map, this.countries);
      new BasemapsView(this.map, this.countries);<commit_msg>Tabs: country tab only works on mobile devices<commit_after>/**
 * The TabsView view.
 *
 * @return TabsView view (extends Backbone.View)
 */
define([
  'underscore',
  'handlebars',
  'd3',
  'map/presenters/TabsPresenter',
  'map/views/tabs/AnalysisView',
  'map/views/tabs/CountriesView',
  'map/views/tabs/BasemapsView',
  'map/views/tabs/HighresolutionView',
  'map/views/tabs/SubscribeView',
  'views/ShareView',
  'text!map/templates/tabs.handlebars',
  'text!map/templates/tabs-mobile.handlebars'
], function(_, Handlebars, d3, Presenter, AnalysisView, CountriesView, BasemapsView, HighresolutionView, SubscribeView, ShareView, tpl, tplMobile) {

  'use strict';

  var TabsView = Backbone.View.extend({

    el: '#module-tabs',

    events: {
      'click .tab' : 'toggleTabs',
      'click .share-mobile' : 'toggleShareMobile',
      'click .tab-mobile' : 'toggleTabsMobile',
      'click .tab-mobile-close' : 'hideTabsMobile',
      'click .tab-mobile-reset-country' : 'resetCountry',
      'click ul' : 'checkForestChangeAvailability'
    },

    template: Handlebars.compile(tpl),
    templateMobile: Handlebars.compile(tplMobile),

    initialize: function(map, countries) {
      this.map = map;
      this.countries = countries;
      this.presenter = new Presenter(this);
      // Render
      enquire.register("screen and (min-width:"+window.gfw.config.GFW_MOBILE+"px)", {
        match: _.bind(function(){
          this.render();
          this.cacheVars();
        },this)
      });
      enquire.register("screen and (max-width:"+window.gfw.config.GFW_MOBILE+"px)", {
        match: _.bind(function(){
          this.renderMobile();
          this.cacheVars();
        },this)
      });
      // this.setListeners();
    },

    cacheVars: function(){
      this.$tabs = this.$el.find('.tab');
      this.$tabMobileButtons = $('.tab-mobile');
      this.$tabMobileBackButtons = $('.tab-mobile-back');
      this.$settingsTabButton = $('#settings-tab-button');
      this.$tabsMobileContent = this.$el.find('.tab-mobile-content');
      this.$tabsContent = this.$el.find('.tab-content');
      this.$container = this.$el.find('.content');
    },

    // setListeners: function(){

    // },

    render: function(){
      this.$el.html(this.template());
      this.$el.removeClass('hide');
      this.initCustomViews();
    },

    renderMobile: function(){
      this.$el.html(this.templateMobile());
      this.$el.removeClass('hide');
      this.initCustomViews();
    },

    initCustomViews: function(){
      new AnalysisView(this.map, this.countries);
      new CountriesView(this.map, this.countries);
      new BasemapsView(this.map, this.countries);
{'fraction_non_alphanumeric': 0.16904315196998124, 'fraction_numerical': 0.00075046904315197, 'mean_word_length': 3.0294784580498866, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5097664', 'n_tokens_mistral': 1691, 'n_tokens_neox': 1674, 'n_words': 268}