{"size": 1644, "ext": "js", "max_stars_repo_path": "src/main.js", "max_stars_repo_name": "Brookeruu/haiku-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/main.js", "max_issues_repo_name": "Brookeruu/haiku-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/main.js", "max_forks_repo_name": "Brookeruu/haiku-js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.5161290323, "max_line_length": 69, "alphanum_fraction": 0.5395377129}
import { Haiku } from './haiku.js';
import './styles.css';
import $ from 'jquery';
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.min.css';
//
$(document).ready(function() {

  $('#success-haiku').hide();
  $('#failure').hide()

  $('#generate-random').click(function(event){
    event.preventDefault();

    let haiku = new Haiku("placeholder", "Jen-R-Ator", "a", "b", "c")

    let result = true;
    while (result){
      haiku.generateHaiku();
      haiku.areLinesValid() ? result = false : null;
    }

    $('#failure').hide();
    $('#haiku-title').text(haiku.title);
    $('#haiku-author').text(haiku.author);
    $('#haiku-line1').text(haiku.line1);
    $('#haiku-line2').text(haiku.line2);
    $('#haiku-line3').text(haiku.line3);
    $('#success-haiku').show();

  });

  $("#haiku-form").submit( function(event) {
    event.preventDefault();

    let title = $("#title").val();
    let author = $("#author").val();
    let line1 = $("#line1").val();
    let line2 = $("#line2").val();
    let line3 = $("#line3").val();
    let haiku = new Haiku(title, author, line1, line2, line3);

    if (haiku.isValidInput()) {
      if (haiku.areLinesValid()) {
        $('#haiku-title').text(haiku.title);
        $('#haiku-author').text(haiku.author);
        $('#haiku-line1').text(haiku.line1);
        $('#haiku-line2').text(haiku.line2);
        $('#haiku-line3').text(haiku.line3);
        $('#failure').hide();
        $('#success-haiku').show();
      } else {
        $('#failure').show();
        $('#success-haiku').hide()
      }
    } else {
      $('#failure').show();
      $('#success-haiku').hide()
    }
  });
});
