bChaukar commited on
Commit
464ed8d
·
verified ·
1 Parent(s): c459849

Update practice.html

Browse files
Files changed (1) hide show
  1. practice.html +22 -7
practice.html CHANGED
@@ -56,14 +56,29 @@
56
  window.RISE_SELECTED_LEVEL = button.dataset.level;
57
  picker.style.display = "none";
58
  readingArea.style.display = "block";
59
- if (!document.getElementById("rise-frontend-script")) {
60
- const script = document.createElement("script");
61
- script.id = "rise-frontend-script";
62
- script.src = "rise-frontend.js";
63
- document.body.appendChild(script);
64
- } else {
65
- window.location.reload();
66
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  window.scrollTo({top: 0, behavior: "smooth"});
68
  });
69
  });
 
56
  window.RISE_SELECTED_LEVEL = button.dataset.level;
57
  picker.style.display = "none";
58
  readingArea.style.display = "block";
59
+ const container = document.getElementById("rise-reading-app");
60
+ container.innerHTML = "<p>Loading your reading activity...</p>";
61
+
62
+ const oldScript = document.getElementById("rise-frontend-script");
63
+
64
+ if (oldScript) {
65
+ oldScript.remove();
66
  }
67
+
68
+ const script = document.createElement("script");
69
+ script.id = "rise-frontend-script";
70
+ script.src = "./rise-frontend.js?v=2";
71
+
72
+ script.onload = () => {
73
+ console.log("RISE frontend script loaded.");
74
+ };
75
+
76
+ script.onerror = () => {
77
+ container.innerHTML =
78
+ "<p style='color:red'>Could not load rise-frontend.js. Check that the file is in the repository root.</p>";
79
+ };
80
+
81
+ document.body.appendChild(script);
82
  window.scrollTo({top: 0, behavior: "smooth"});
83
  });
84
  });