From 7358a23351587ce0ea7a0d278db779b7917d843a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9D=E3=83=BC=E3=83=AB=20=E3=82=A6=E3=82=A7=E3=83=83?= =?UTF-8?q?=E3=83=96?= Date: Thu, 27 Sep 2018 15:55:51 -0500 Subject: [PATCH] Scoped tour-specific JS --- app/dist/scripts/sockets.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/dist/scripts/sockets.js b/app/dist/scripts/sockets.js index f4b0e8d..0ff09cf 100644 --- a/app/dist/scripts/sockets.js +++ b/app/dist/scripts/sockets.js @@ -47,16 +47,19 @@ function initializeWebSocketConnection() { // If `data.example` isn't found, reset the description area. else { - document.getElementById("tour-example-description").classList.remove("success"); + if (document.getElementById("tour-example-description")) { + document.getElementById("tour-example-description").classList.remove("success"); - document.getElementById("tour-example-description").innerHTML = - document.querySelector(".tour__navigation__example.active").dataset.description; + document.getElementById("tour-example-description").innerHTML = + document.querySelector(".tour__navigation__example.active").dataset.description; + } } if (document.getElementById("temp-loader")) document.getElementById("temp-loader").style.display = "none"; - document.querySelector(".tour").classList.remove("waiting"); + if (document.querySelector(".tour")) + document.querySelector(".tour").classList.remove("waiting"); break; case data.message === "notification": // TODO: Make work with appending so multiple notifications can be sent