Простое приложение для игры "дурацких"


Это приложение для игры "дурацких". Я решил использовать Bootstrap модальные вопросы.

Безумные libs-это простая игра, где вы создаете шаблон история с пропусками слов. Вас, или другого игрока, затем создайте список слов и поместить их в сюжет, создавая часто глупые или смешные истории в результате.

Я буду признателен за любые советы о коде.

$(function(){
        const nounInput = $('#noun-input');
 const verbInput = $('#verb-input');
 const adjInput = $('#adjective-input');
 const adverbInput = $('#adverb-input');
 const sent = $('#sentence');
 var nounDisplay = "";
 var verbDisplay = "";
 var adjDisplay = "";
 var adverbDisplay = "";
 $('#first').click(function(){
  nounDisplay = nounInput.val();
 });
 $('#second').click(function(){
  verbDisplay = verbInput.val();
 });
 $('#third').click(function(){
  adjDisplay = adjInput.val();
 });
 $('#fourth').click(function(){
  adverbDisplay = adverbInput.val();
  sent.text("Do you " + nounDisplay + " your " + adjDisplay + " " + nounDisplay + adjDisplay + "? That's hilarious!")
 });

  });
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet">
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
 <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<body>
<!--main content-->
<div class="container rounded mt-2 mb-2 pt-5 pb-5 text-center">
 <h2>Mad Lib</h2>
 <button type="button" class="btn btn-primary mt-3 btn-lg" data-toggle="modal" data-target="#first_modal">Let's game!</button>
</div>

<!--first-modal-->
<div class="modal fade" id="first_modal" tabindex="-1" role="dialog" aria-labelledby="first_modalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="first_modalLabel">Enter a noun:</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form>
         <input type="text" class="form-control" id="noun-input">
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary" id="first" data-dismiss="modal"data-toggle="modal" data-target="#second_modal">Next step</button>
      </div>
    </div>
  </div>
</div>

<!--second-modal-->
<div class="modal fade" id="second_modal" tabindex="-1" role="dialog" aria-labelledby="second_modalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="second_modalLabel">Enter a verb:</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form>
         <input type="text" class="form-control" id="verb-input">
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary" id="second" data-dismiss="modal" data-toggle="modal" data-target="#third_modal">Next step</button>
      </div>
    </div>
  </div>
</div>

<!--third-modal-->
<div class="modal fade" id="third_modal" tabindex="-1" role="dialog" aria-labelledby="third_modalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="third_modalLabel">Enter an adjective:</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form>
         <input type="text" class="form-control" id="adjective-input">
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary" id="third" data-dismiss="modal" data-toggle="modal" data-target="#fourth_modal">Next step</button>
      </div>
    </div>
  </div>
</div>

<!--fourth-modal-->
<div class="modal fade" id="fourth_modal" tabindex="-1" role="dialog" aria-labelledby="fourth_modalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="fourth_modalLabel">Enter an adverb:</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form>
         <input type="text" class="form-control" id="adverb-input">
        </form>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary" id="fourth" data-dismiss="modal">Finish!</button>
      </div>
    </div>
  </div>
</div>

<!--Output sentence-->
<h3 class="text-center mt-1 mb-2" id="sentence"></h3>


 
</body>
  



Комментарии