-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
195 lines (179 loc) · 6.96 KB
/
index.html
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Autumn | Lead Edge Ash Tree Reflex</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
//padding-top: 20px;
background-color: white;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
max-width: 100%;
}
#googleSheetFrame {
width: 875px;
height: 1200px;
border: none;
}
.row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
max-width: 100%;
--bs-gutter-x: 0;
}
textarea#responseField, #calculationResult {
width: 80%;
height: 150px;
padding: 10px;
margin-top: 20px;
border-radius: 5px;
background-color: whitesmoke;
resize: none;
}
.buttonContainer, .buttonContainer2 {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>
</head>
<body>
<div class="container">
<div class="text-center mb-4">
<img src="https://static.wixstatic.com/media/2451db_4bae2fd1cdf640d78af7f29836d95b4c~mv2.png" alt="Autumn" style="max-width: 40%; height:auto;">
<h2 style="color: black; font-weight: bold;">Autumn | Lead Edge Ash Tree Reflex</h2>
<br>
<button type="button" id="startInstanceBtn" onclick="startUserInstance()" style="background-color: deepskyblue; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;">Create Ash</button>
<br>
<br>
<h6>Note: Allow a moment for the instance to be created.<br>The Master Sheet is subject to frequent updates and may not reflect in your current instance.</h6>
</div>
<div id="interactiveElements" style="display: none;">
<div class="container">
<h4>Autumn | Ash Sculpt</h4>
<form id="userInputForm">
<label for="userInput">Enter your Ash:</label>
<input type="text" id="userInput" placeholder="Type something..." style="width: 400px;">
<button type="button" onclick="submitUserInput(event)" style="background-color: deepskyblue; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;">Submit</button>
</form>
<textarea id="responseField" placeholder="Autumn :" disabled></textarea>
</div>
<br>
<div class="buttonContainer">
<button onclick="downloadResponse()" style="background-color: deepskyblue; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;">Download Ash Sculpt</button>
</div>
<br>
<div class="container">
<h4>Arc Lake Element Algebra Ash</h4>
<form id="algebraicValueForm">
<label for="algebraicValue">Enter Algebraic Ash:</label>
<input type="text" id="algebraicValue" placeholder="e.g., 2x + 3 = 15" style="width: 400px;">
<button type="button" onclick="submitAlgebraicValue(event)" style="background-color: deepskyblue; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;">Submit</button>
</form>
<textarea id="calculationResult" placeholder="Autumn | Calculation Result:" disabled></textarea>
</div>
<br>
<div class="buttonContainer2">
<button onclick="downloadAlgebraResponse()" style="background-color: deepskyblue; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;">Download Algebra Ash</button>
</div>
</div>
<br>
<br>
<iframe id="googleSheetFrame" src="" style="display:none;"></iframe>
</div>
<script>
function startUserInstance() {
fetch('https://script.google.com/macros/s/AKfycbzthCAgveCNyw_Cp3WdzHQBbsMYiKHEIZiC9g-RKjaQb4f3tbjma29egU7Jgyyt3LdYFA/exec')
.then(response => response.text())
.then(sheetUrl => {
document.getElementById('googleSheetFrame').src = sheetUrl;
document.getElementById('googleSheetFrame').style.display = 'block';
document.getElementById('startInstanceBtn').style.display = 'none';
document.getElementById('interactiveElements').style.display = 'block';
alert("Your personal sheet instance is ready. Please proceed.");
})
.catch(error => console.error('Error:', error));
}
function submitUserInput(event) {
event.preventDefault(); // Prevent the default form submission behavior
var userInput = document.getElementById('userInput').value;
var formData = new FormData();
formData.append('encodetoAutumn', userInput);
fetch('https://script.google.com/macros/s/AKfycbwKWaUL1hOF_bXITYJknZfynRTcAvTfb9HASZKs7X8mr6zmdfaStNYBeoMTtaTj1SnTRA/exec', {
method: 'POST',
body: formData,
})
.then(response => response.text())
.then(text => {
document.getElementById('responseField').value = text; // Display Autumn's response
document.getElementById('userInput').value = ''; // Clear the input field after submission
})
.catch(error => {
console.error('Error:', error);
document.getElementById('responseField').value = "Error processing request.";
});
}
x
function submitAlgebraicValue(event) {
event.preventDefault(); // Prevent the default form submission behavior
var algebraicValue = document.getElementById('algebraicValue').value;
var formData = new FormData();
formData.append('algebraicValue', algebraicValue);
fetch('https://script.google.com/macros/s/AKfycbzhRCS88J2s9HrV0HJjUp6_uebt5JJuYsD9GpfWVHkI09dbfRsgCDqLb8v4K_XjHBrY_A/exec', {
method: 'POST',
body: formData,
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text();
})
.then(text => {
document.getElementById('calculationResult').value = text; // Display the response in the textarea
document.getElementById('algebraicValue').value = ''; // Clear the input field
})
.catch(error => {
console.error('Error:', error);
document.getElementById('calculationResult').value = "Error processing request.";
});
}
function downloadResponse() {
var response = document.getElementById('responseField').value;
var blob = new Blob([response], {type: "text/plain"});
var anchor = document.createElement("a");
anchor.download = "Autumn.ash";
anchor.href = window.URL.createObjectURL(blob);
anchor.style.display = "none";
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
}
function downloadAlgebraResponse() {
var response = document.getElementById('calculationResult').value;
var blob = new Blob([response], {type: "text/plain"});
var anchor = document.createElement("a");
anchor.download = "Element Algebra.ash";
anchor.href = window.URL.createObjectURL(blob);
anchor.style.display = "none";
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
}
</script>
</body>
</html>