This repository was archived by the owner on Jul 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverview.js
More file actions
104 lines (84 loc) · 3.27 KB
/
Copy pathoverview.js
File metadata and controls
104 lines (84 loc) · 3.27 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
$(function () {
UI.registerEventHandlers();
initialize();
});
function initialize() {
log('Init...');
Data.load_wormhole_types();
WormholeMap.init();
Server.reports(function(error, data) {
Data.config.maxEvents = 10000;
$.each(data.reports, function(i, report) {
var event = {type: 'wormhole',
text: '<a href="javascript:CCPEVE.showInfo(5, ' + report.fromSystemId + ')">' + report.fromSystemName + '</a> ' +
' <i class="fa fa-arrows-h"></i> ' +
'<a href="javascript:CCPEVE.showInfo(5, ' + report.toSystemId + ')">' + report.toSystemName + '</a> '};
if (report.cleared) {
event.text += ' was cleared';
} else if (report.type == 'wormhole_updated') {
event.text += ' was updated';
} else {
event.text += ' was discovered';
}
event.text += ' by <a href="javascript:CCPEVE.showInfo(1377, ' + report.reporterId + ');">' + report.reporterName + '</a>';
EventList.addEvent(event);
});
});
}
function updateWormholeLink(button, from, to, data) {
var payload = {};
if (!data) {
payload.sig_a = $('#sig-a').val();
payload.sig_b = $('#sig-b').val();
payload.type_a = $('#type-a').val();
payload.type_b = $('#type-b').val();
payload.info = $('#wormhole-info').val();
UIPanels.hidePanel();
} else {
payload.info = data;
}
Server.postWormholeLinkUpdate(from, to, payload, function(error, data) {
if (error) {
handleError(error);
return;
}
EventList.addEvent({type: 'info',
alert: true,
text: 'Scheulding update for jump from ' +
'<a href="javascript:CCPEVE.showInfo(5, ' + from + ')">' + Data.systems[from].name + '</a> ' +
' to ' +
'<a href="javascript:CCPEVE.showInfo(5, ' + to + ')">' + Data.systems[to].name + '</a> '});
$('#link-'+ to + '-' + from).remove();
$('#link-'+ from + '-' + to).remove();
});
}
function updateWormholeTraversal(button, from, to) {
var payload = {};
payload.mass = $('#traversal-mass').val().replace(/,/g, '');
payload.fleet_name = $('#traversal-fleet').val();
payload.fc_characterName = $('#traversal-fc').val();
UIPanels.hidePanel();
Server.postWormholeTraversalUpdate(from, to, payload, function(error, data) {
if (error) {
handleError(error);
return;
}
EventList.addEvent({type: 'info',
alert: true,
text: 'Traversal logged for jump from ' +
'<a href="javascript:CCPEVE.showInfo(5, ' + from + ')">' + Data.systems[from].name + '</a> ' +
' to ' +
'<a href="javascript:CCPEVE.showInfo(5, ' + to + ')">' + Data.systems[to].name + '</a> '});
WormholeMap.redraw();
});
}
function handleError (error) {
log(error.message);
if (error.message) UI.showAlert({
type: 'error',
text: JSON.stringify(error.message)
});
}
function log(message) {
console.log('[' + moment().unix() + '] - ' + JSON.stringify(message));
}