From 68ca4e8ec4e1a472dc718b8c2a7cc920555a7b00 Mon Sep 17 00:00:00 2001 From: TheArrayser Date: Sun, 12 Jan 2025 11:49:30 +0100 Subject: [PATCH] initial push --- common.css | 34 ++++++++++++++++++++++++++++++++++ common.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ isnotprime.html | 23 +++++++++++++++++++++++ isprime.html | 23 +++++++++++++++++++++++ maybeprime.html | 23 +++++++++++++++++++++++ 5 files changed, 152 insertions(+) create mode 100644 common.css create mode 100644 common.js create mode 100644 isnotprime.html create mode 100644 isprime.html create mode 100644 maybeprime.html diff --git a/common.css b/common.css new file mode 100644 index 0000000..edd44bd --- /dev/null +++ b/common.css @@ -0,0 +1,34 @@ +* { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; + border: none; + margin: 0; + padding: 0; + box-sizing: border-box; +} + +html, body, #wrapper { + height: 100%; +} + +#wrapper { + align-items: center; + display: flex; +} + +#content { + color: #333; + margin: 0 auto; + padding: 0.5rem; + text-align: center; +} + +h1 { + font-weight: normal; + font-size: 4.5rem; +} + +h2 { + display: block; + font-size: 9rem; + font-weight: bold; +} \ No newline at end of file diff --git a/common.js b/common.js new file mode 100644 index 0000000..ae075c8 --- /dev/null +++ b/common.js @@ -0,0 +1,49 @@ +let urlPart = ".prime.cringe-studios.com" +let titleStart = "Is "; +let titleEnd = " prime?"; +let evasiveString = "this"; +function GetQuestion() { + let hostname = window.location.hostname; + while(true) { + if( !hostname.endsWith(urlPart) ) { + let dotIndex = hostname.indexOf("."); + // If no dot was found, just return the hostname + if(dotIndex == -1) { + return hostname; + } + // If there is a dot where the most sub level domain should be, restart with the dot trimmed + if(dotIndex == 0) { + hostname = hostname.substring(1); + continue; + } + // return everything starting from 0 to the dot index + return hostname.substring(0, dotIndex); + }else{ + if(urlPart.length == hostname.length) { + // if the url entered is just the url part, return an evasive string + return evasiveString; + } + let urlPartIndex = hostname.lastIndexOf(urlPart); + hostname = hostname.substring(0, urlPartIndex); + let dotIndex = hostname.lastIndexOf("."); + // If no dot was found, just return the hostname + if(dotIndex == -1) { + return hostname; + } + // return everything after the dot + return hostname.substring(dotIndex + 1); + } + } +} +function SetTitle(question) { + document.title = titleStart + question + titleEnd; +} +function UpdateContents(question) { + questionTextElement = document.getElementById("questionText"); + questionTextElement.textContent = titleStart + question + titleEnd; +} +window.onload = function() { + let question = GetQuestion(); + UpdateContents(question); + SetTitle(question); +} \ No newline at end of file diff --git a/isnotprime.html b/isnotprime.html new file mode 100644 index 0000000..4d6b4f9 --- /dev/null +++ b/isnotprime.html @@ -0,0 +1,23 @@ + + + + Is this prime? + + + + + + + + + +
+

Is this prime?

+

No

+
+ + \ No newline at end of file diff --git a/isprime.html b/isprime.html new file mode 100644 index 0000000..ccaaa9d --- /dev/null +++ b/isprime.html @@ -0,0 +1,23 @@ + + + + Is this prime? + + + + + + + + + +
+

Is this prime?

+

Yes

+
+ + \ No newline at end of file diff --git a/maybeprime.html b/maybeprime.html new file mode 100644 index 0000000..b96417c --- /dev/null +++ b/maybeprime.html @@ -0,0 +1,23 @@ + + + + Is this prime? + + + + + + + + + +
+

Is this prime?

+

Maybe

+
+ + \ No newline at end of file