-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.htm
More file actions
159 lines (134 loc) · 4.06 KB
/
index.htm
File metadata and controls
159 lines (134 loc) · 4.06 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
<!DOCTYPE html>
<html>
<head>
<title>Public Art</title>
<style>
.card{
width:60%;
text-align: center;
padding:50px;
margin:50px;
display:inline-block;
border-radius:10px;
box-shadow:black 5px 5px 5px;
}
h1{
text-align: center;
margin: auto;
font-family:"Georgia";
text-shadow:gray 2px 2px 2px;
background-color:SlateBlue ;
color:white;
font-weight:bold;
padding:5px;
box-shadow:black 3px 3px 3px;
}
h2{
font-family:"Times New Roman";
text-shadow:gray 2px 2px 2px;
background-color:SlateBlue;
text-decoration:none;
color:white;
font-weight:bold;
padding:5px;
border-radius:10px;
box-shadow:black 3px 3px 3px;
}
p,a{
font-size:14pt;
font-family:"Comic Sans MS";
color: white;
}
#head1{
font-size:30pt;
font-family:"Times New Roman";
color:white;
}
</style>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.3.0/mustache.min.js"></script>
<style>
body {
position: relative;
}
#section1 {padding-top:50px;height:250px;color: #fff; background-color: #000000;}
#section2 {padding-top:50px;height:280px;color: #fff; background-color: #3CB371;}
</style>
</head>
<body data-spy="scroll" data-target=".navbar" data-offset="50">
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Monuments</a>
</div>
<div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="#section1">Home</a></li>
<li><a href="#section2">All</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
<script type= "text/template" id="mTemplate">
<div id="section2" class="container-fluid">
<h2>{{name}}</h2>
<p>{{borough}}</p>
<p> Description: {{ descrip }} </p>
<p> {{ location }} </p>
<p> Given By: {{ donor }} </p>
<p> Made By: {{ sculptor }} </p>
</div>
</script>
<div id="section1" class="container-fluid">
<h1 id = "head1">Welcome to Public Monuments</h1>
<p>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
<p id = "para1">Just some data on public monuments...</p>
</div>
</body>
<script>
var data;
function loadJSON(){
$.getJSON("https://data.cityofnewyork.us/resource/g77k-nifh.json", function(results){
data = results;
})
}
function search(){
var build = "";
var borough = document.getElementById("borough");
var output = document.getElementById("output");
var cardTemplate = document.getElementById("mTemplate").innerHTML;
for(var index = 0; index < data.length; index++){
try {
//if(borough == "") throw "---";
if (data[index].borough.toUpperCase().indexOf(borough.value.toUpperCase()) != -1
){
build += Mustache.render(cardTemplate, data[index]);
}
}
catch(err) {
console.log("Error: " + err + ".");
}
}
output.innerHTML = build;
}
</script>
<body onload="loadJSON()">
<input type="text" id="borough" placeholder="Enter Borough">
<button onclick="search()"> Search </button>
<div id="output">
</div>
</body>
</html>