initial push
This commit is contained in:
commit
68ca4e8ec4
34
common.css
Normal file
34
common.css
Normal file
@ -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;
|
||||
}
|
49
common.js
Normal file
49
common.js
Normal file
@ -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);
|
||||
}
|
23
isnotprime.html
Normal file
23
isnotprime.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Is this prime?</title>
|
||||
|
||||
<link rel="stylesheet" href="common.css">
|
||||
|
||||
<style>
|
||||
* {
|
||||
background-color: hsl(0, 100%, 65%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="common.js"></script>
|
||||
</head>
|
||||
|
||||
<body id="wrapper">
|
||||
<div id="content">
|
||||
<h1 id="questionText">Is this prime?</h1>
|
||||
<h2>No</h2>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
23
isprime.html
Normal file
23
isprime.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Is this prime?</title>
|
||||
|
||||
<link rel="stylesheet" href="common.css">
|
||||
|
||||
<style>
|
||||
* {
|
||||
background-color: hsl(100, 100%, 65%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="common.js"></script>
|
||||
</head>
|
||||
|
||||
<body id="wrapper">
|
||||
<div id="content">
|
||||
<h1 id="questionText">Is this prime?</h1>
|
||||
<h2>Yes</h2>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
23
maybeprime.html
Normal file
23
maybeprime.html
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Is this prime?</title>
|
||||
|
||||
<link rel="stylesheet" href="common.css">
|
||||
|
||||
<style>
|
||||
* {
|
||||
background-color: hsl(50, 100%, 65%);
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="common.js"></script>
|
||||
</head>
|
||||
|
||||
<body id="wrapper">
|
||||
<div id="content">
|
||||
<h1 id="questionText">Is this prime?</h1>
|
||||
<h2>Maybe</h2>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user