Browse Source

JS: Prevent error when quote element not found

TEC 6 months ago
parent
commit
7ae45931cc
1 changed files with 2 additions and 2 deletions
  1. 2 2
      resources/js/org-quotes.js

+ 2 - 2
resources/js/org-quotes.js

@@ -16,6 +16,6 @@ var r_text = [
     "Little by little org-mode will take over my life.   -- Mehul Sanghvi",
     "The best thing that happened to Emacs since Emacs itself: Org Mode.  -- Tomas S. Grigera on twitter",
     "Every time I go to use Org-mode, I find something new and helpful.  -- Katherine Cox on Google+"]
-document.addEventListener("DOMContentLoaded", () => {
+document.addEventListener("DOMContentLoaded", () => {if (document.getElementById("a-quote")) {
     document.getElementById("a-quote").innerHTML = r_text[Math.floor((1 + r_text.length)*Math.random())].replace("--", "—");
-})
+}})