$(document).ready(function () {
  /*
        $("#exportButton").click(function () {
          let text = $("#floatingTextarea").val();
          // generate a unique name
          let timestamp = new Date().getTime();
          let fileName = "text_" + timestamp + ".txt";
          // create a Blob
          let blob = new Blob([text], { type: "text/plain" });
          // download txt
          let a = document.createElement("a");
          a.href = URL.createObjectURL(blob);
          a.download = fileName;
          a.click();
        });
        */

  $("#printButton").click(() => {
    // only the answer
    // document.body.innerText = $("#floatingTextarea").val();

    // answer & question
    let answer = $("#floatingTextarea").val();
    let answer2 = $("#floatingTextarea2").val();
    let question = $("#questionLabel").text();
    let question2 = $("#questionLabel2").text();
    let answer3 = $("#floatingTextarea3").val();
    let answer4 = $("#floatingTextarea4").val();
    let question3 = $("#questionLabel3").text();
    let question4 = $("#questionLabel4").text();
    let answer5 = $("#floatingTextarea5").val();
    let answer6 = $("#floatingTextarea6").val();
    let question5 = $("#questionLabel5").text();
    let question6 = $("#questionLabel6").text();

    document.body.innerText = `ΕΡΩΤΗΣΗ:${question} ΑΠΑΝΤΗΣΗ:\n${answer}\n\n
		  ΕΡΩΤΗΣΗ:${question2} ΑΠΑΝΤΗΣΗ:\n${answer2}\n\n
		  ΕΡΩΤΗΣΗ:${question3} ΑΠΑΝΤΗΣΗ:\n${answer3}\n\n
		  ΕΡΩΤΗΣΗ:${question4} ΑΠΑΝΤΗΣΗ:\n${answer4}\n\n
		  ΕΡΩΤΗΣΗ:${question5} ΑΠΑΝΤΗΣΗ:\n${answer5}\n\n
		  ΕΡΩΤΗΣΗ:${question6} ΑΠΑΝΤΗΣΗ:\n${answer6}\n\n
		  `;
    // print
    window.print();
    // reload page
    window.location.reload();
  });

  $(window).resize();
});
