-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·56 lines (56 loc) · 2.3 KB
/
index.html
File metadata and controls
executable file
·56 lines (56 loc) · 2.3 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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>cmnode</title>
<style type="text/css">body { font-family: Georgia; }</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
$(document).ready(function() {
var cent = new google.maps.LatLng(-25.363882,131.044922);
var opts = { zoom: 2, center: cent, mapTypeId: google.maps.MapTypeId.ROADMAP }
var map = new google.maps.Map(document.getElementById("map_canvas"), opts);
var ws;
function dropMarker(o, marker) {
var iw = new google.maps.InfoWindow({
content: o.EmailAddress + ' opened your email!'
});
google.maps.event.addListener(marker, 'click', function() {
iw.open(map, marker);
});
iw.open(map, marker);
setTimeout(function() { iw.close(); }, 3000);
}
function openSocket() {
ws = new WebSocket("ws://192.168.126.17:8000/");
ws.onmessage = function(evt) {
var data = JSON.parse(evt.data);
$("h4#campaign").html("Campaign: " + data.CampaignName + " (" + data.CampaignSubject + ")");
for (open in data.NewOpens) {
var o = data.NewOpens[open];
$("#messages").prepend("<div>" + o.EmailAddress + " opened your email...</div>");
var marker = new google.maps.Marker({
position: new google.maps.LatLng(o.latitude, o.longitude),
map: map,
title: 'Open: ' + o.EmailAddress
});
dropMarker(o, marker);
};
};
ws.onclose = function() {};
ws.onopen = function() {};
}
openSocket();
});
</script>
</head>
<body>
<h3>Monitoring a campaign in realtime...</h3>
<h4 id="campaign"></h4>
<div id="map_canvas" style="width: 1000px; height: 600px;"></div>
<h4>Messages...</h4>
<div id="messages" style="width: 100%; height: 100%;"></div>
</body>
</html>