Skip to content

Commit

Permalink
Avoid errors in feedback.js
Browse files Browse the repository at this point in the history
  • Loading branch information
pavpanchekha committed Dec 11, 2024
1 parent b946e8b commit 485482c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions www/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

// Thanks for reading the code! You can hit Ctrl-E / Cmd-E to access the feedback tools.

// This code is written in a bit of an odd style to avoid error
// messages in the WBE browser. There's a lot of old-school JS.

var chapter_overlay;

function ctrl_key_pressed(e) {
Expand All @@ -20,6 +23,7 @@ function ctrl_key_name() {
}
}

if (document.addEventListener)
document.addEventListener("DOMContentLoaded", function() {
if (window.localStorage["edit"] == "true") {
typo_mode();
Expand All @@ -36,7 +40,7 @@ document.addEventListener("DOMContentLoaded", function() {
}
});

let feedback_button = document.querySelector("#feedback-button");
var feedback_button = document.querySelector("#feedback-button");
if (feedback_button) {
feedback_button.addEventListener("click", function(e) {
setup_chapter_feedback();
Expand Down Expand Up @@ -239,7 +243,7 @@ function submit_chapter_comment(comment, email) {
}));
}

let previous_comment = null;
var previous_comment = null;

function setup_chapter_feedback() {
var submit = Element("button", { type: "submit" }, "Submit feedback");
Expand Down Expand Up @@ -294,11 +298,11 @@ function setup_chapter_feedback() {
this.querySelector("input[name='email']").value)
e.preventDefault();
this.querySelector(".confirm-feedback").classList.add("active");
setTimeout(() => chapter_overlay.remove(), 2000);
setTimeout(function() { chapter_overlay.remove(); }, 2000);
}

function do_cancel(e) {
let result = this.querySelector("textarea");
var result = this.querySelector("textarea");
if (result)
previous_comment = result.value;
chapter_overlay.remove();
Expand Down

0 comments on commit 485482c

Please sign in to comment.