-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
530 lines (487 loc) · 20.8 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
<!DOCTYPE html>
<html>
<head>
<meta name="keywords" content="timers, timerboard, timer board, eve online, eve, pvp, nullsec, sov, sovereignty, intel"/>
<meta name="description" content="timerboard.net shows a searchable view of all sovereignty-related event timers in EVE Online."/>
<meta name="author" content="Lucia Denniard"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="icon" type="image/png" href="./favicon.png">
<link rel="shortcut icon" type="image/png" href="./favicon.png">
<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css?light" />
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<link href="./css/font-awesome.min.css" rel="stylesheet">
<script src="./js/mustache.js"></script>
<script src="./js/jquery.tinysort.min.js"></script>
<script src="./js/jquery.knob.js"></script>
<script src="./js/moment.min.js"></script>
<script src="./js/system2region.json.js"></script>
<script src='./js/nprogress.js'></script>
<script src='./js/jsonpatch.min.js'></script>
<script src='./js/reconnecting-websocket.min.js'></script>
<script src='./js/jquery-ui.min.js'></script>
<link rel="stylesheet" type="text/css" href="./css/jquery-ui.css">
<script src="./js/tag-it.min.js" type="text/javascript" charset="utf-8"></script>
<link href="./css/jquery.tagit.css" rel="stylesheet" type="text/css">
<link rel='stylesheet' href='./css/nprogress.css'/>
<title>timerboard.net</title>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle" data-target=".navbar-collapse" data-toggle="collapse" type="button" data-target=".navbar-ex1-collapse">
<span class="sr-only">
Toggle navigation
</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/"><i class="fa fa-calendar"></i> timerboard.net
</a></div>
<nav class="collapse navbar-collapse navbar-ex1-collapse" role="navigtion">
<ul class="nav navbar-nav">
<li><a href = "/WorldWarBeeII">World War Bee II</a></li>
</ul>
</nav>
</div>
</div>
</nav>
<div class="container" id="main">
<div class="container" id="alerts">
</div>
<style type="text/css">
label { font-size: large;
text-align: right
}
input {width: 100%;
float: right;
}
.circlebox {
width: 100px;
float: left;
margin-left: 10px;
margin-right: 10px;
}
.circlebox-small {
width: 80px;
float: left;
margin-left: 10px;
margin-right: 10px;
padding-top: 20px;
}
p.label {
text-transform: uppercase;
font: small;
text-align: center;
width: 100px;
padding: 0;
}
.circleboxcontainer {
width: 440px ;
margin-left: auto ;
margin-right: auto ;
}
ul.tagit {
float: left;
}
.tablehover>tbody>tr>td.success, .table-hover>tbody>tr>th.success, .table-hover>tbody>tr.success>td {
background-color: rgba(185, 209, 191, 0.72);
border-color: #6bb85c;
}
.table-hover>tbody>tr>td.warning, .table-hover>tbody>tr>th.warning, .table-hover>tbody>tr.warning>td {
background-color: rgba(199, 184, 254, 0.44);
border-color: #9e42f0;
}
</style>
<script src="js/countdown.js" type="text/javascript"></script>
<div style="height:110px;">
<div class="circleboxcontainer">
<div class="circlebox-small">
<input id="uncontested" type="text" value="0" class="dial" data-readOnly="true" data-thickness="0.1" data-width="80" data-height="80" data-fgColor="#8B4513">
<center>
<p class="label" style="color: #8B4513">Uncontested</p>
</center>
</div>
<div class="circlebox">
<input id="active" type="text" value="0" class="dial" data-readOnly="true" data-thickness="0.1" data-width="100" data-height="100" data-fgColor="#ff1a1a">
<center>
<p class="label" style="color: #ff1a1a">Active</p>
</center>
</div>
<div class="circlebox">
<input id="upcoming" type="text" value="0" class="dial" data-readOnly="true" data-thickness="0.1" data-width="100" data-height="100">
<center>
<p class="label" style="color: #87CEEB">Upcoming</p>
</center>
</div>
<div class="circlebox-small">
<input id="start" type="text" value="0" class="dial" data-readOnly="true" data-thickness="0.1" data-width="80" data-height="80" data-fgColor="#FF8C00">
<center>
<p class="label" style="color: #FF8C00">Start in <4hrs</p>
</center>
</div>
</div>
</div>
<div>
<h3><input id="filter" placeholder="Filter by typing here, separate multiple terms by commas" autofocus style="position:absolute;"/>
<span id="externallink" style="float:right; margin-top: 15px;">
<a title="External link to this filter" href="#"><i class="fa fa-link"></i></a>
</span>
</h3>
</div>
<table class="table table-hover" id="timers">
<thead>
<tr>
<th><a href="#" onClick='sort("type");'>Type<span style="float:none;" id="type"></span></a></th>
<th><a href="#" onClick='sort("system");'>System<span style="float:none;" id="system"></span></a></th>
<th><a href="#" onClick='sort("region");'>Region<span style="float:none;" id="region"></span></a></th>
<th><a href="#" onClick='sort("owner");'>Owner<span style="float:none;" id="owner"></span></a></th>
<th><a href="#" onClick='sort("time");'>Time<span style="float:none;" id="time"></span></a></th>
<th><a href="#" onClick='sort("time");'>Remaining<span style="float:none;" id="remaining"></span></a></th>
<th><a href="#" onClick='sort("defended");'>Defender Score<span style="float:none;" id="defended"></span></a></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script type="text/template" id="timer_template">
<tr id="{{ id }}" class="timer_row" data-tags="{{ tags }}" data-system="{{ system }}">
<td class="type">{{ type }}</td>
<td class="system" data-system="{{ system }}"><a href="http://evemaps.dotlan.net/search?q={{ system }}">{{ system }}</a></td>
<td class="region">{{ region }}</td>
<td class="owner"><a href="http://evemaps.dotlan.net/search?q={{ owner }}">{{ owner }}</a></td>
<td class="time">{{ time }}</td>
<td class="remaining" style="width: 150px;"><span id="remaining.{{ id }}" style="font-family: monospace;"></span></td>
<td class="defended">{{ defended }}</td>
</tr>
</script>
<script type="text/template" id="error_template">
<div class="alert alert-danger">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
{{ message }}
</div>
</script>
<script>
// set up UI
$("#externallink a").hide();
$(".dial").knob({"bgColor": "#282828"});
$(".dial").click(function () {
if (storedFilter.indexOf(this.id) == -1) {
$("#filter").tagit("createTag", this.id);
$(".tagit input").focus();
} else {
$("#filter").tagit("removeTagByLabel", this.id);
$(".tagit input").focus();
}
});
var searchtags = ["uncontested", "active", "upcoming", "start"];
var imperium = [
"The Initiative.", "Goonswarm Federation", "The Bastion", "Tactical Narcotics Team", "Brothers in Arms Alliance",
"Space Violence.", "Get Off My Lawn", "Wildly Inappropriate.", "I too am gay", "Ranger Regiment",
"Infensus", "Initiative Associates", "Violente Fortuna", "Initiative Mercenaries",
"Greater Western Co-Prosperity Sphere", "Iron Armada", "French ConneXion.",
"United Earth Directorate.", "Pen Is Out", "The Hivemind Federation Alliance",
"The Exiled Gaming", "Divinity.", "Against ALL Authorities", "Good Sax", "Ferrata Victrix"
];
function addsearchtag(t) {
if (searchtags.indexOf(t) == -1) {
searchtags.push(t);
}
}
var storedFilter = [];
$('#filter').tagit({
availableTags: searchtags,
singleField: true,
singleFieldNode: $('#filter'),
afterTagAdded: function(event, ui) {
storedFilter = $("#filter").tagit("assignedTags");
doFilter();
},
afterTagRemoved: function(event, ui) {
storedFilter = $("#filter").tagit("assignedTags");
doFilter();
},
allowSpaces: true,
caseSensitive: false
});
// set up timer data
timers = {};
var sortkey = "time";
var sort_asc = false;
function do_sort() {
$(".timer_row").tsort("."+sortkey, {order: sort_asc ? "asc" : "desc"});
}
var ICON_ASC = '<i class="fa fa-sort-amount-asc"/></i>';
var ICON_DESC = '<i class="fa fa-sort-amount-desc"/></i>';
function sort(field) {
if (sortkey==field) {
sort_asc = !sort_asc;
$("#"+sortkey)[0].innerHTML = sort_asc ? ICON_ASC : ICON_DESC;
} else {
$("#"+sortkey)[0].innerHTML=""
sortkey = field;
$("#"+sortkey)[0].innerHTML = sort_asc ? ICON_ASC : ICON_DESC;
}
do_sort();
}
function add_timer(i, timer) {
if (!(timer["id"] in timers)) {
timers[timer["id"]] = countdown(
function(ts) {
var style = "<span>";
if (timer["realtime"] < new Date()) {
var style = "<span class='text-danger strong'>-"
}
document.getElementById("remaining." + timer["id"]).innerHTML = style+ts.days+"d "+ts.hours+"h "+ts.minutes+"m "+ts.seconds+"s </span>";
},
timer["realtime"],
countdown.DAYS|countdown.HOURS|countdown.MINUTES|countdown.SECONDS);
}
}
function timer_to_row(i, timer) {
if ($("#"+timer["id"]).length == 0) {
var template = $("#timer_template").html();
var completed = Mustache.to_html(template, timer);
$('#timers tbody').append(completed);
}
}
$.each(Object.keys(system2region), function(i,k) {addsearchtag(system2region[k])});
addsearchtag("WorldWarBeeII");
function pad(n, width, z) {
z = z || '0';
n = n + '';
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
};
NProgress.start(); //start the loading bar on first use
var timerBuffer = [];
function createWebSocket(path) {
var protocolPrefix = (window.location.protocol === 'https:') ? 'wss:' : 'ws:';
return protocolPrefix + '//' + location.host + path;
}
// new stuff
websocket = new ReconnectingWebSocket(createWebSocket("/stream"));
websocket.onopen = function(evt) { };
websocket.onclose = function(evt) { };
websocket.onmessage = function(evt) {
var active = 0;
NProgress.start();
var event = JSON.parse(evt["data"]);
if (event.hasOwnProperty('status')) {
if ($("#alerts").is(":empty")) {
$("#alerts").append(Mustache.to_html($("#error_template").html(), {"message": "Unable to pull new data from CREST, displaying cached data. This message will disappear if CREST becomes available again."}))
}
} else {
$("#alerts").empty();
}
// load our data
if ("initial" in event) {
timerBuffer = event["initial"];
}
if ("diff" in event) {
timerBuffer = jsonpatch.apply_patch(timerBuffer, event["diff"])
}
var idsrecvd = [];
// add and update entries
$.each(timerBuffer, function(i, packet) {
var e = packet["event"]
var system = packet["solar_system_name"]
var timer = {
type: e["event_type"].replace("_", " ").replace(" defense", ""),
system: system,
region: system2region[system],
time: e["start_time"],
realtime: moment.utc(e["start_time"]),
owner: "None",
id: e["campaign_id"].toString(),
defended: "N/A",
tags: []
};
idsrecvd.push(timer["id"]);
try {
timer["owner"] = packet["alliance"]["name"];
timer["defended"] = pad(Math.round(e["defender_score"] * 100), 2) + "%";
}
catch (err) {
}
if (timer["realtime"] < new Date()) {
active = active + 1;
timer.tags.push("active");
} else {
timer.tags.push("upcoming");
}
if ((timer["realtime"] > new Date())&& (timer["realtime"] < new Date(Date.now()+14400000))) {
timer.tags.push("start");
}
if ((timer.tags.indexOf("upcoming")) && (timer["defended"] === "60%")) {
timer.tags.push("uncontested");
}
if (!(timer["id"] in timers)) {
timer_to_row(0, timer);
add_timer(0, timer);
} else {
// update it's defense data and tags
var escapedId = timer["id"]
var selector = "#"+escapedId+" > .defended";
$("#"+escapedId+" > .defended").html("<td class=\"defended\">"+timer["defended"].toString()+"</td>");
$("#"+escapedId).data("tags", timer.tags.join(","));
};
// add searcht tags
addsearchtag(timer["owner"]);
addsearchtag(timer["defender_score"]);
addsearchtag(timer["system"]);
});
NProgress.inc();
// remove old entries
Object.keys(timers).forEach(function(i) {
if($.inArray(i, idsrecvd) == -1) {
var escapedId = i.replace(/:/g, "\\:");
window.clearInterval(timers[i]);
$("#"+escapedId).remove();
delete timers[i];
}
});
NProgress.inc();
do_sort();
NProgress.inc();
doFilter();
document.getElementById("counter").innerHTML = Object.keys(timers).length +" timers currently running."
NProgress.done();
};
websocket.onerror = function(evt) { };
function doFilter() {
var warmode = false;
// update link
$("#externallink a").attr("href", window.location.origin+"/"+encodeURI(storedFilter.join(",")));
if (storedFilter.length == 0) {
$("#externallink a").hide()
$("ul.tagit").css("width", "100%")
} else {
$("#externallink a").show()
$("ul.tagit").css("width", "96%")
}
$("tbody tr").hide();
// filtering
var terms = storedFilter.map(function (i) {
if (i=="WorldWarBeeII") {
warmode = true;
return "querious|period basis|delve|fountain|cloud ring|fade";
}
return i.trim().toLowerCase()
});
var tohide = $("tbody tr").filter(function() {var target = $(this).text().toLowerCase() + $(this).data().tags; return terms.every(function(term) {return target.search(term) == -1})});
var toshow = $("tbody tr").filter(function() {var target = $(this).text().toLowerCase() + $(this).data().tags; return terms.every(function(term) {return target.search(term) != -1})});
toshow.show();
// category counters
var total = toshow.length;
var active = toshow.filter(function() {return $(this).data().tags.split(",").indexOf("active") > -1}).length
var upcoming = toshow.filter(function() {return $(this).data().tags.split(",").indexOf("upcoming") > -1}).length
var start = toshow.filter(function() {return $(this).data().tags.split(",").indexOf("start") > -1}).length
var uncontested = toshow.filter(function() {return $(this).data().tags.split(",").indexOf("uncontested") > -1}).length
// set dials
$('#active').trigger(
'configure',
{
"min":0,
"max":total,
}
);
$('#upcoming').trigger(
'configure',
{
"min":0,
"max":total,
}
);
$('#start').trigger(
'configure',
{
"min":0,
"max":total,
}
);
$('#uncontested').trigger(
'configure',
{
"min":0,
"max":total,
}
);
if (total > 1000) {
$(".dial").stop();
$({animatedVal: 0}).animate({animatedVal: active}, {
duration: 200,
easing: "swing",
step: function() {
$("#active").val(Math.round(this.animatedVal)).trigger("change");
}
});
$({animatedVal: 0}).animate({animatedVal: upcoming}, {
duration: 200,
easing: "swing",
step: function() {
$("#upcoming").val(Math.round(this.animatedVal)).trigger("change");
}
});
$({animatedVal: 0}).animate({animatedVal: start}, {
duration: 200,
easing: "swing",
step: function() {
$("#start").val(Math.round(this.animatedVal)).trigger("change");
}
});
$({animatedVal: 0}).animate({animatedVal: uncontested}, {
duration: 200,
easing: "swing",
step: function() {
$("#uncontested").val(Math.round(this.animatedVal)).trigger("change");
}
});
} else {
$(".dial").stop();
$("#active").val(active).trigger("change");
$("#upcoming").val(upcoming).trigger("change");
$("#start").val(start).trigger("change");
$("#uncontested").val(uncontested).trigger("change");
}
// war mode
if (warmode) {
var imptimers = imperium.map(function(x) {return $("tr:contains("+x+")")}).reduce(function(p, c, i, a) {return p.add(c)});
var freeports = $("tbody tr:contains(Freeport)")
var othertimers = $("tbody tr").not(imptimers).not(freeports);
imptimers.addClass("warning");
othertimers.addClass("success");
} else {
$("tbody tr").removeClass("warning success");
}
}
if (window.location.pathname.length>1) {
storedFilter = decodeURI(window.location.pathname.slice(1)).split(",");
storedFilter.map(function(t) {$("#filter").tagit("createTag", t)});
doFilter();
};
window.setInterval(function() {
doFilter();
}, 10000);
$(".tagit input").focus();
sort("time");
</script>
</div>
<hr />
<footer>
<div class="container">
<p class=".small text-center text-muted" id="counter">0 timers currently running.</p>
<p class=".small text-center text-muted">This site is a deployment of <a href="https://github.com/xxpizzaxx/timerboard-net-fozziesov">timerboard-net-fozziesov</a>, fed by data from <a href="https://github.com/xxpizzaxx/pizza-sov-relay">pizza-sov-relay</a> which are both available under the <a href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
</div>
</footer>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-55713418-2', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>