From 1950a66cd2c95d541ff7ebd08f3b19c396419247 Mon Sep 17 00:00:00 2001 From: gleb-kun <94681073+gleb-kun@users.noreply.github.com> Date: Thu, 27 Feb 2025 21:51:34 +0300 Subject: [PATCH] fix(disqusjs): refactor local DisqusJS loading check for improved readability --- layouts/partials/comments/provider/disqusjs.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/layouts/partials/comments/provider/disqusjs.html b/layouts/partials/comments/provider/disqusjs.html index 967c38c..f4f4c03 100644 --- a/layouts/partials/comments/provider/disqusjs.html +++ b/layouts/partials/comments/provider/disqusjs.html @@ -21,8 +21,12 @@ } function lazyLoadDisqusJS() { - if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { - document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.'; + const excludedHosts = ["localhost", "127.0.0.1"]; + const hostname = window.location.hostname; + + if (excludedHosts.includes(hostname)) { + document.getElementById('disqus_thread').innerHTML = + 'Disqus comments not available by default when the website is previewed locally.'; return; }