From 6c72e4fd8ee0364a89678b60a0bcd6eb9bf2c551 Mon Sep 17 00:00:00 2001 From: Wes Bryie <93141203+WesleyBryie@users.noreply.github.com> Date: Thu, 18 Nov 2021 10:51:12 -0500 Subject: [PATCH] error in javascript console but content is back --- js/scripts.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/js/scripts.js b/js/scripts.js index 733a807..c239fa1 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -9,15 +9,29 @@ console.log("Copyright *my code only, anything that is not my code is published and copyrighted by their respective owners* Wesley Bryie, 2021."); console.log("This website was designed and published to https://wesbryie.cf/. If you see it on a domain that is not wesbryie.cf please contact me at wesleybryie@protonmail.com."); -function getDomainName(hostName) -{ - return hostName.substring(hostName.lastIndexOf(".", hostName.lastIndexOf(".") - 1) + 1); +function getDomainName(url, subdomain) { + subdomain = subdomain || false; + + url = url.replace(/(https?:\/\/)?(www.)?/i, ''); + + if (!subdomain) { + url = url.split('.'); + + url = url.slice(url.length - 2).join('.'); + } + + if (url.indexOf('/') !== -1) { + return url.split('/')[0]; + } + + return url; } + getDomainName(); function isDomainCorrect() { - if (getDomainName("wesbryie.cf")) { + if ("url" = "*wesbryie.cf") { console.log("This websites javascript code says that it is correct."); stop(); }