forked from ConnieGuan/YellowCow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
155 lines (140 loc) · 5.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PINtura</title>
<!--
https://developers.google.com/speed/libraries/
links: https://connieguan.github.io/YellowCow/
NOTE:
this index.html is for prototyping front-end,
server home page is in home.hbs.hbs which uses handlebars template
-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<!-- map in map.html <div id="map" style="height: 500px; width: auto;"></div>-->
<div class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavBar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="myNavBar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Pintura Catalog</a></li>
<li><a href="map.html">Map</a></li>
<li><a href="posts.html">Post A Pintura!</a></li>
<li><a href="#">Help</a></li>
<li><a href="#">Log Out</a></li>
</ul>
</div>
</div>
</div>
<h1>Pintura</h1>
<dl>
<dd>Votes: 69 <button type="button">Upvote</button> <button type="button">Downvote</button> </dd>
<dt><img class="graffiti" src="https://i.imgur.com/QjurNdW.jpg" alt="graffiti 1 s drawing"></dt>
<dd><a href="map.html">View on Map</a></dd>
<br>
<br>
<dd>Votes: 13 <button type="button">Upvote</button> <button type="button">Downvote</button> </dd>
<dt><img class="graffiti" src="https://i.ytimg.com/vi/zJkcjp1AjUI/hqdefault.jpg" alt="graffiti 2 squidward"></dt>
<dd><a href="map.html">View on Map</a></dd>
<br>
<br>
<dd>Votes: 24 <button type="button">Upvote</button> <button type="button">Downvote</button> </dd>
<dt><img class="graffiti" src="http://wrmc.middlebury.edu/files/2015/09/Skool_4_Chumps1.jpg" alt="graffiti 3 chumps"></dt>
<dd><a href="map.html">View on Map</a></dd>
<br>
<br>
</dl>
</body>
<script>
// initialize the map
var ucsd_coor = [32.88044, -117.23758];
var map = L.map('map',{
center: ucsd_coor, // at UCSD
zoom: 20
});
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
let marker = L.marker(ucsd_coor).addTo(map);
var polygon = L.polygon([
[32.882, -0.08],
[32.822, -0.06],
[32.892, -0.047]
]).addTo(map);
var polygon = L.polygon([
[32.88038,-117.23632],
[32.88070, -117.23685],
[32.88092, -117.23626]
]).addTo(map);
var circle = L.circle(ucsd_coor, {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5,
radius: 70
}).addTo(map);
marker.bindPopup("<b>Hello world!</b><br>I am a popup.").openPopup();
circle.bindPopup("I am a circle.");
polygon.bindPopup("I am a polygon.");
var popup = L.popup()
.setLatLng([32.88070, -117.23685])
.setContent("I am a standalone popup.")
.openOn(map);
var popup = L.popup();
var LeafIcon = L.Icon.extend({
options: {
shadowUrl: 'leaf-shadow.png',
iconSize: [38, 95],
shadowSize: [50, 64],
iconAnchor: [22, 94],
shadowAnchor: [4, 62],
popupAnchor: [-3, -76]
}
});
var greenIcon = new LeafIcon({iconUrl: 'leaf-green.png'}),
redIcon = new LeafIcon({iconUrl: 'leaf-red.png'}),
orangeIcon = new LeafIcon({iconUrl: 'leaf-orange.png'});
// var customPopup = "Mozilla Toronto Offices<br/>" +
// "<img src='http://joshuafrazier.info/images/maptime.gif' alt='maptime logo gif' width='350px'/>";
// var imgSrc = 'http://joshuafrazier.info/images/maptime.gif';
var imgSrc = 'http://inthesetimes.com/images/articles/trump_flicker_face_yess.jpg';
// var cusImg = $("p").text('sadfadsfasd').append('</br>').$("img").attr('src', imgSrc);
var imgPop = $('<img class="popup" src="'+imgSrc+'" />');
var btnUpVote = $('<input type="button" value="Upvote"/>');
var btnDnVote = $('<input type="button" value="Downvote"/>');
var customPopup = $("<div></div>").html( "asdasdsadas</br>asdsafas" )
.append( imgPop )
.append(btnUpVote)
.append(btnDnVote);
// var customPopup = document.createElement("img").attr('src', imgSrc);
var customOptions = {
'maxWidth': '500',
'className' : 'custom'
};
function onMapClick(e) {
console.log('adasdas');
console.log(customPopup.html());
L.marker([e.latlng.lat, e.latlng.lng], {icon: greenIcon}).bindPopup(customPopup.html(), customOptions)
.addTo(map);
popup
.setLatLng(e.latlng)
.setContent("You clicked the map at " + e.latlng.toString())
.openOn(map);
}
map.on('click', onMapClick);
</script>
</html>