From a77bc12b1c09942c71063daff1764bb8c0d4ecd3 Mon Sep 17 00:00:00 2001 From: Wes Bryie <93141203+WesleyBryie@users.noreply.github.com> Date: Thu, 18 Nov 2021 11:03:23 -0500 Subject: [PATCH] Making it a seperate script because i am not a simple kind of dev --- js/domainChecker.js | 23 +++++++++++++++++++++++ js/scripts.js | 26 +------------------------- 2 files changed, 24 insertions(+), 25 deletions(-) create mode 100644 js/domainChecker.js diff --git a/js/domainChecker.js b/js/domainChecker.js new file mode 100644 index 0000000..c596ab5 --- /dev/null +++ b/js/domainChecker.js @@ -0,0 +1,23 @@ +var firstDot = window.location.hostname.indexOf('.'); +var tld = ".cf"; +var isSubdomain = firstDot < window.location.hostname.indexOf(tld); +var domain; + +if (isSubdomain) { + domain = window.location.hostname.substring(firstDot == -1 ? 0 : firstDot + 1); +} +else { + domain = window.location.hostname; +} + +function isDomainCorrect() { + if (domain = "wesbryie") { +console.log("Thank you for using wesbryie.cf."); +} + +else { + console.log("why uh, why ya doin that? why ya taking my code?"); +} +} + +isDomainCorrect(); \ No newline at end of file diff --git a/js/scripts.js b/js/scripts.js index dbfdca6..04598bb 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -7,28 +7,4 @@ // Use this file to add JavaScript to your project 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."); - -var firstDot = window.location.hostname.indexOf('.'); -var tld = ".cf"; -var isSubdomain = firstDot < window.location.hostname.indexOf(tld); -var domain; - -if (isSubdomain) { - domain = window.location.hostname.substring(firstDot == -1 ? 0 : firstDot + 1); -} -else { - domain = window.location.hostname; -} - -function isDomainCorrect() { - if (domain = "wesbryie") { -console.log("Thank you for using wesbryie.cf."); -} - -else { - console.log("why uh, why ya doin that? why ya taking my code?"); -} -} - -isDomainCorrect(); \ No newline at end of file +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."); \ No newline at end of file