forked from Unblockedgamesmakerskibidi/meandsilas
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
165 lines (138 loc) · 6.32 KB
/
index.html
File metadata and controls
165 lines (138 loc) · 6.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!DOCTYPE html>
<html lang="en">
<head>
<title>Awesome Website</title>
<link rel="stylesheet" href="css/homepage.css">
<style>
#bottom-center-controls {
position: fixed;
left: 50%;
bottom: 1000;
transform: translateX(-50%);
}
</style>
</head>
<body>
<h1>Me and Silas Collab Page Over Summer</h1>
<p>Hugo will do HTML and CSS, Silas will do HTML and JavaScript. Hugo will organize and make everything clean. Also, Hugo will fix any code that isn’t working.</p>
<p style="font-size: 150px; font-family: Arial;">MakeMeaSite.com</p>
<p>Create a Site When You Want it, How You Want it.</p>
<canvas id="myCanvas" width="500" height="350"></canvas>
<div id="bottom-center-controls">
<input type="text" id="myInput" placeholder="Type here">
<button onclick="updateText()">Alert Input & Update Text</button>
</div>
<p id="text"></p>
<p id="textOne"></p>
<div id="container"></div>
<input type="text" id="myUserName" placeholder="Type here">
<button onclick="getUserName()">Create Account</button>
<button onclick="createBox()">Create Box</button>
<script>
function getUserName(){
let username = document.getElementById("myUserName").value;
alert(username);
}
function updateText() {
let userInput = document.getElementById("myInput").value;
localStorage.setItem("savedText", userInput);
fetchText();
}
function fetchText() {
let savedText = localStorage.getItem("savedText") || "";
document.getElementById("text").textContent = savedText;
}
function createBox() {
let canvas = document.createElement("canvas");
canvas.width = 500;
canvas.height = 300;
canvas.style.border = "1px solid black";
document.body.appendChild(canvas);
let ctxOne = canvas.getContext("2d");
function showOptions() {
let heightInput = document.createElement("input");
heightInput.type = "text";
heightInput.id = "heightInput";
heightInput.placeholder = "Enter Height";
document.body.appendChild(heightInput);
let buttonHeightInput = document.createElement("button");
buttonHeightInput.innerText = "Set Height";
buttonHeightInput.onclick = enterHeight;
document.body.appendChild(buttonHeightInput);
function enterHeight() {
let newHeight = parseInt(document.getElementById("heightInput").value);
if (!isNaN(newHeight)) {
canvas.height = newHeight;
} else {
alert("Please enter a valid number for height.");
}
}
let widthInput = document.createElement("input");
widthInput.type = "text";
widthInput.id = "widthInput";
widthInput.placeholder = "Enter Width";
document.body.appendChild(widthInput);
let buttonWidthInput = document.createElement("button");
buttonWidthInput.innerText = "Set Width";
buttonWidthInput.onclick = enterWidth;
document.body.appendChild(buttonWidthInput);
function enterWidth() {
let newWidth = parseInt(document.getElementById("widthInput").value);
if (!isNaN(newWidth)) {
canvas.width = newWidth;
} else {
alert("Please enter a valid number for width.");
}
}
let backgroundInput = document.createElement("input");
backgroundInput.type = "text";
backgroundInput.id = "backgroundInput";
backgroundInput.placeholder = "Enter Background Color";
document.body.appendChild(backgroundInput);
let buttonBackgroundInput = document.createElement("button");
buttonBackgroundInput.innerText = "Set Background";
buttonBackgroundInput.onclick = function() { enterBackground(canvas); };
document.body.appendChild(buttonBackgroundInput);
}
showOptions();
}
function enterBackground(targetCanvas) {
let colorOfBG = document.getElementById("backgroundInput").value;
let canvas = targetCanvas || document.getElementById("myCanvas");
if (colorOfBG === "white") {
canvas.style.backgroundColor = "white";
} else if (colorOfBG === "black") {
canvas.style.backgroundColor = "black";
} else if (colorOfBG === "red") {
canvas.style.backgroundColor = "red";
} else if (colorOfBG === "orange") {
canvas.style.backgroundColor = "orange";
} else if (colorOfBG === "yellow") {
canvas.style.backgroundColor = "yellow";
} else if (colorOfBG === "green") {
canvas.style.backgroundColor = "green";
} else if (colorOfBG === "blue") {
canvas.style.backgroundColor = "blue";
} else if (colorOfBG === "purple") {
canvas.style.backgroundColor = "purple";
}
}
fetchText();
let printDaText = localStorage.getItem("savedText") || "";
document.getElementById("textOne").textContent = printDaText;
let canvasOne = document.getElementById("myCanvas");
let ctx = canvasOne.getContext("2d");
if (ctx) {
ctx.font = "30px Arial";
ctx.fillStyle = "black";
ctx.fillText("Why use us?", 80, 75);
ctx.font = "15px Arial";
let moveText = 110;
ctx.fillText("We are experienced web designers", 65, moveText);
ctx.fillText("We use many unique elements to design our sites", 65, moveText + 20);
ctx.fillText("We work fast", 65, moveText + 40);
ctx.fillText("Our products are clean and polished", 65, moveText + 60);
}
</script>
</body>
</html>