{"size": 1726, "ext": "js", "max_stars_repo_path": "js/viewSlideshow.js", "max_stars_repo_name": "goodwid/rossellestudios", "max_stars_repo_stars_event_min_datetime": "2016-09-02T18:53:29.000Z", "max_stars_repo_stars_event_max_datetime": "2016-09-02T18:53:29.000Z", "max_issues_repo_path": "js/viewSlideshow.js", "max_issues_repo_name": "goodwid/rossellestudios", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/viewSlideshow.js", "max_forks_repo_name": "goodwid/rossellestudios", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.5538461538, "max_line_length": 102, "alphanum_fraction": 0.6083429896}
(function(module) {

  var slideshow = {};
  var slideshowView = {};

  slideshow.current = 0;
  slideshow.images = [];
  slideshow.$image = $('#slideshow-image');
  slideshow.$data = $('#info');


  slideshow.populateSlideshow = function(rawData) {
    slideshow.images = rawData;
  };

  slideshowView.changeImage = function(num) {
    slideshow.current += num;
    if (slideshow.current > slideshow.images.length - 1) {
      slideshow.current = 0;
    }
    if (slideshow.current <= -1) {
      slideshow.current = slideshow.images.length - 1;
    }
    var data = slideshow.images[slideshow.current].title + ', ' +
               slideshow.images[slideshow.current].show + ',  ' +
               slideshow.images[slideshow.current].year;
    slideshow.$data.text(data);
    slideshow.$image.hide();
    slideshow.$image.css('background-image', 'url(' + slideshow.images[slideshow.current].path + ')');
    slideshow.$image.show();
  };

  slideshowView.handleButtons = function() {
    $('#left-side, #button-left').on('click', function() {
      slideshowView.changeImage(-1);
    });
    $('#right-side, #button-right').on('click', function() {
      slideshowView.changeImage(1);
    });
    $(document).keydown(function(e) {
      // e.preventDefault();
      switch(e.which) {
      case 37: {
        slideshowView.changeImage(-1);
        break;
      }
      case 39:{
        slideshowView.changeImage(1);
        break;
      }
      default: return;
      }
    });
  };

  slideshowView.init = function(show) {
    slideshowView.handleButtons();
    slideshow.populateSlideshow(show);
    slideshowView.changeImage(0);
  };

  module.slideshow = slideshow;
  module.slideshowView = slideshowView;
}(window));
