-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdeck.js
More file actions
27 lines (27 loc) · 1013 Bytes
/
deck.js
File metadata and controls
27 lines (27 loc) · 1013 Bytes
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
onPage('Decks', function () {
debug('Deck editor');
eventManager.on('jQuery', () => {
$(document).ajaxSuccess((event, xhr, options) => {
if (options.url !== 'DecksConfig' || !options.data) return;
const data = JSON.parse(options.data);
eventManager.emit('Deck:Change', data, options, xhr);
eventManager.emit(`Deck:${data.action}`, data, options, xhr);
});
$(document).ajaxComplete((event, xhr, options) => {
if (options.url !== 'DecksConfig') return;
if (options.type === 'GET') {
eventManager.emit('Deck:Loaded', xhr.responseJSON);
return;
}
const data = JSON.parse(options.data);
eventManager.emit('Deck:postChange', data, options, xhr);
eventManager.emit(`Deck:${data.action}`, data, options, xhr);
});
// Class change
$('#selectClasses').change(function () {
// Sometimes it takes too long, so lets change it now
classe = $(this).val();
eventManager.emit('Deck:Soul');
});
});
});