$().ready(function(){
  function init(){
    var initialYear = new Date().getFullYear() - 100;
    renderMap();

    requestYears(function(years, formattedYears){
      renderSlider(years, formattedYears, {
        onChange: function(currentYear){
          requestInfluences(currentYear, function(influences){
            renderInfluencesInMap(influences);
          });
        },
        onInit: function(){
          requestInfluences(initialYear, function(influences){
            renderInfluencesInMap(influences);
          });
        }
      });
    });

    listenSearch({
      onSearch: function(term){
        requestYearByInfluenceName(term, function(year){
          changeSliderTo(year);

          requestInfluences(year, function(influences){
            renderInfluencesInMap(influences);
          });
        })
      }
    });

    listenRequestYear({
      onSearch: function(year){
        changeSliderTo(year);

        requestInfluences(year, function(influences){
          renderInfluencesInMap(influences);
        });
      }
    });
  }
  init();
});

$().ready(function(){
  function init(){
    var initialYear = new Date().getFullYear() - 100;
    renderMap();

    requestYears(function(years, formattedYears){
      renderSlider(years, formattedYears, {
        onChange: function(currentYear){
          requestInfluences(currentYear, function(influences){
            renderInfluencesInMap(influences);
          });
        },
        onInit: function(){
          changeSliderTo(initialYear);
          requestInfluences(initialYear, function(influences){
            renderInfluencesInMap(influences);
          });
        }
      });
    });

    listenSearch({
      onSearch: function(term){
        requestYearByInfluenceName(term, function(year){
          changeSliderTo(year);

          requestInfluences(year, function(influences){
            renderInfluencesInMap(influences);
          });
        })
      }
    });

    listenRequestYear({
      onSearch: function(year){
        changeSliderTo(year);

        requestInfluences(year, function(influences){
          renderInfluencesInMap(influences);
        });
      }
    });
  }
  init();
});

Change initial year in slider for 100 years ago from now
Change initial year in slider for 100 years ago from now
