-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
173 lines (136 loc) · 4.58 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ConSearch</title>
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">
<style>
/* Color Theme:
#BFB8A3
#F2B28D
#BF5F56
#F25E5E
#0D0D0D
*/
html {
height: 100%;
}
body {
background: #BFB8A3;
/*background: linear-gradient(180deg, rgba(119,189,217,1) 0%, rgba(30,164,217,1) 100%);*/
height: 100%;
margin: 0;
background-repeat: no-repeat;
background-attachment: fixed;
font-family: 'Raleway', sans-serif;
}
h1 {
color: #F25E5E;
font-size: 66px;
}
#artist-form {
text-align: center;
}
.form-label {
color: #0D0D0D;
font-size: 36px;
}
#artist-input {
height: auto;
border: none;
border-radius: 9999px;
outline: none;
margin: 0px 30px;
padding: 10px 18px;
position: relative;
bottom: 6px;
background-color: transparent;
border: 4px solid #0D0D0D;
color: #0D0D0D;
font-size: 22px;
}
#select-artist {
margin: 30px;
font-size: 28px;
padding: 10px 30px;
border-radius: 999px;
color: #BFB8A3;
background: #F25E5E;
outline: none;
border: none;
}
#artist-div {
text-align: center;
}
#name {
text-decoration: none;
color: #BF5F56;
}
img {
border-radius: 26px;
}
#artist-link {
text-decoration-color: #0D0D0D;
color: #0D0D0D;
}
#space {
height: 40px;
width: 100%;
}
</style>
</head>
<body>
<h1 style="text-align: center;">ConSearch</h1>
<!-- Artist Select Box -->
<form id="artist-form">
<!-- Label for Text Box -->
<label for="artist-input" class="form-label">Search Your Artist</label>
<!-- Text Input Box -->
<input type="text" id="artist-input"><br>
<!-- Submit Button -->
<input id="select-artist" type="submit" value="Search">
</form>
<!-- Artist Information -->
<div id="artist-div"></div>
</body>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script>
function searchBandsInTown(artist)
{
// Querying the bandsintown api for the selected artist, the
// ?app_id parameter is required, but can equal anything
var queryURL = "https://rest.bandsintown.com/artists/" + artist + "?app_id=codingbootcamp";
$.ajax({
url: queryURL,
method: "GET"
}).done(function(response) {
// Printing the entire object to console
console.log(response);
// Constructing HTML containing the artist information
var artistName = $("<h1>").text(response.name);
var artistUrl = $("<a>").attr({"href": response.url, "id": "name"}).append(artistName);
var artistImage = $("<img>").attr("src", response.thumb_url);
var trackerCount = $("<h2>").text(response.tracker_count + " fans tracking this artist");
var upcomingEvents = $("<h2>").text(response.upcoming_event_count + " upcoming events");
var goToArtist = $("<a>").attr({"href": response.url, "id": "artist-link"}).text("See Tour Dates");
// Empty the contents of the artist-div, append the new artist content
$("#artist-div").empty();
$("#artist-div").append(artistUrl, artistImage, trackerCount, upcomingEvents, goToArtist);
});
}
// Event handler for user clicking the select-artist button
$("#select-artist").on("click", function(event) {
// Preventing the button from trying to submit the form
event.preventDefault();
// Storing the artist name
var artist = $("#artist-input").val().trim();
// Running the searchBandsInTown function (passing in the artist as an argument)
searchBandsInTown(artist);
});
</script>
</html>