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 pathui_panels.js
More file actions
110 lines (92 loc) · 3.38 KB
/
Copy pathui_panels.js
File metadata and controls
110 lines (92 loc) · 3.38 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
var path = require('path');
var UIPanels = {
substringMatcher: function(strs) {
return function findMatches(q, cb) {
var matches, substrRegex;
matches = [];
substrRegex = new RegExp(q, 'i');
$.each(strs, function(i, str) {
if (substrRegex.test(str)) matches.push({ value: str });
});
cb(matches);
};
},
showMenuPanel: function(callback) {
var panel = {
type: 'options',
icon: 'settings',
title: 'Standing Fleet Options',
footer: '© 2015 Goonswarm Federation',
closeable: true,
formitems: [
{checkbox: {label: 'Clipboard Polling', checked: Data.state.poll.clipboard, onclick: 'UI.togglePolling(this, "clipboard");' }},
{checkbox: {label: 'Log Polling', checked: Data.state.poll.logs, onclick: 'UI.togglePolling(this, "logs");' }}
]
};
if (/^win/.test(process.platform)) {
panel.formitems.push({input: {legend: 'Log Path', label: 'Log Path', class: 'log-path', onblur: 'UI.updateLogPath(this);', value: Data.state.datasources.logs.path.win}});
} else {
panel.formitems.push({input: {legend: 'Log Path', label: 'Log Path', class: 'log-path', onblur: 'UI.updateLogPath(this);', value: Data.state.datasources.logs.path.darwin}});
}
var channels = {group: {legend: 'Intel Channels', formitems: []}};
for (var channel in Data.state.datasources.logs.channels) {
channels.group.formitems.push(
{checkbox: {label: channel, checked: Data.state.datasources.logs.channels[channel], onclick: 'UI.toggleChannel(this, "' + channel + '");' }}
);
}
panel.formitems.push(channels);
UIPanels.showPanel(panel, callback);
},
showPendingPanel: function (callback) {
var panel = {
type: 'pending',
image: 'spinner.gif',
text: 'Waiting for Standing Fleet to accept...',
formitems: [
{button: {text: 'Cancel', class: 'abort-pending', onClick: 'leaveFleetButtonClick(this)'}}
],
};
UIPanels.showPanel(panel, callback);
},
showLoadingPanel: function (text, callback) {
var panel = {
type: 'loading',
title: text || UI.getLoadingText(),
image: 'spinner.gif'
};
UIPanels.showPanel(panel, callback);
},
showPanel: function (params, callback) {
var compiledPanel = $(Data.templates.panel(params));
if (Data.ui.dim.children().length) {
Data.ui.dim.children().remove();
compiledPanel
.css('display','none')
.appendTo(Data.ui.dim)
.fadeIn(Data.config.uiSpeed, function () {
$(this).find('.textinput').focus().on('keydown', function (event) {
if (event.keyCode == 13) {
$(this).siblings('.submit-join, .submit-scan').click();
return false;
}
});
if (callback) callback();
});
} else {
compiledPanel.appendTo(Data.ui.dim);
UI.dim(function () {
compiledPanel.find('.textinput').focus().on('keydown', function (event) {
if (event.keyCode == 13) {
$(this).siblings('.submit-join, .submit-scan').click();
return false;
}
});
if (callback) callback();
});
}
},
hidePanel: function (callback) {
Data.ui.dim.children().remove();
UI.unDim(callback);
}
};