From 6b9c7e3cbdfb3ee1a1f0163ba06d7acc3c61342e Mon Sep 17 00:00:00 2001 From: uwaa Date: Sun, 26 Jan 2025 01:31:23 +0000 Subject: [PATCH] rot.js resilience --- static/js/rot.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/static/js/rot.js b/static/js/rot.js index 6c6e2690..a6d33f31 100644 --- a/static/js/rot.js +++ b/static/js/rot.js @@ -131,12 +131,19 @@ //Configure by post waitUntilSpecial(".pin", (pinnedPost) => { - if (pinnedPost.nextElementSibling - .querySelector(".StatusBody") - .querySelector(".text") - .innerHTML - .replace(/(<([^>]+)>)/ig, '') - .search(/profile them/ig) == -1) + let p = pinnedPost.nextElementSibling; + if (!p) + return false; + + let statusBody = p.querySelector(".StatusBody"); + if (!statusBody) + return false; + + let txtElm = statusBody.querySelector(".text"); + if (!txtElm) + return false; + + if (txtElm.innerHTML.replace(/(<([^>]+)>)/ig, '').search(/profile them/ig) == -1) return false; const ptp = pinnedPost.nextElementSibling.querySelector(".StatusBody"); @@ -217,7 +224,7 @@ break; case "notice": - //Continue playing + applyMainTheme(); //Statuses break; default: