-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.html
152 lines (144 loc) · 5.69 KB
/
search.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
<!DOCTYPE html>
<html lang="en">
<style>
/* Style the font of the header */
#language {
position: absolute;
top: 0;
left: 0;
font-size: 20px;
font-weight: bold;
padding: 5px;
background-color: #f9daff;
}
h1 {
font-size: 55px; /* Change the font size to 36px */
font-family: "Comic Sans MS", cursive, sans-serif;
margin-top: 5px; /* Add some margin to the top */
margin-bottom: 5px; /* Add some margin to the bottom */
text-align: center; /* Center the text */
}
h2{
font-size: 35px; /* Change the font size to 36px */
font-family: "Comic Sans MS", cursive, sans-serif;
margin-top: 50px; /* Add some margin to the top */
margin-bottom: 20px; /* Add some margin to the bottom */
text-align: left; /* Center the text */
}
a{
display: inline-block;
padding: 10px;
border-radius: 20px;
background-color: white;
border: 2px solid black;
font-size: 35px; /* Change the font size to 36px */
font-family: "Comic Sans MS", cursive, sans-serif;
margin-top: 10px; /* Add some margin to the top */
margin-bottom: 10px; /* Add some margin to the bottom */
text-align: left; /* Center the text */
}
/* Style the logo */
#logo {
display: block; /* Set the display property to block */
margin: 0 auto; /* Center the image horizontally */
width: 150px; /* Set the width to 100px */
height: 150px; /* Set the height to 100px */
margin-bottom: 40px; /* Add some margin to the bottom */
}
/* Style the header container */
header {
text-align: center; /* Center the header text */
}
input {
font-size: 24px; /* Change the font size to 24px or any other size you prefer */
font-family: "Comic Sans MS", cursive, sans-serif; /* Change the font family to Comic Sans */
}
label {
font-size: 34px; /* Change the font size to 24px or any other size you prefer */
font-family: "Comic Sans MS", cursive, sans-serif; /* Change the font family to Comic Sans */
}
div {
font-size: 22px; /* Change the font size to 24px or any other size you prefer */
font-family: "Comic Sans MS", cursive, sans-serif; /* Change the font family to Comic Sans */
}
body {
background-color: #f9daff; /* Update background color to be the 4.5:1 per compliance */
color: #000000;
}
button {
background-color: #ffffff; /* Green */
border: none;
color: rgb(0, 0, 0);
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 35px; /* Change the font size to 36px */
font-family: "Comic Sans MS", cursive, sans-serif;
margin: 4px 2px;
cursor: pointer;
}
/* Style the footer container */
footer {
position: absolute; /* Set the position property to absolute */
left: 0; /* Set the left property to 0 */
bottom: 0; /* Set the bottom property to 0 */
width: 100%; /* Set the width to 100% */
text-align: center; /* Center the text */
margin-top: 100px; /* Add some margin to the top */
margin-bottom: 100px; /* Add some margin to the bottom */
margin-left: 400px; /* Add some margin to the top */
margin-right: 100px; /* Add some margin to the bottom */
}
/* Style the GIF */
#gif {
display: block; /* Set the display property to block */
margin: 0 auto; /* Center the image horizontally */
width: 200px; /* Set the width to 200px */
height: 200px; /* Set the height to 200px */
margin-top: 100px; /* Add some margin to the top */
margin-bottom: 100px; /* Add some margin to the bottom */
}
</style>
<body>
<img src="languageFlag.png" alt="English language icon" title="English language icon" width="16" height="16">
<span style="font-size: 20px">English</span>
<main role="main">
<h2>Database Search</h2>
<form id="searchForm" action="https://purdue-soft-eng-384818-6x33ng5huq-uc.a.run.app/package/byRegEx" method="post">
<label for="searchInput">Search:</label>
<input type="text" id="searchInput" name="search">
<button type="submit" id="searchBtn">Search</button>
<div id="searchDesc">Please enter a keyword to search for in our database.</div>
<div id="results"></div>
</form>
<a href="index.html" class="back-button">Back</a>
</main>
<script>
const searchForm = document.getElementById('searchForm');
const searchInput = document.getElementById('searchInput');
const resultsDiv = document.getElementById('results');
searchForm.addEventListener('submit', function(event) {
event.preventDefault();
const searchValue = searchInput.value;
fetch('https://purdue-soft-eng-384818-6x33ng5huq-uc.a.run.app/package/byRegEx', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
RegEx: searchValue
})
})
.then(response => response.json())
.then(data => {
resultsDiv.textContent = JSON.stringify(data, null, 2);
})
.catch(error => {
console.error(error);
resultsDiv.textContent = 'An error occurred while searching';
});
});
</script>
</body>
</html>