$(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 question = $("#questionLabel").text();

    document.body.innerText = `ΕΡΩΤΗΣΗ:${question}\n\nΑπάντηση:\n${answer}\n\n`;
    // print
    window.print();
    // reload page
    window.location.reload();
  });

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