-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmissingImport.js
More file actions
40 lines (35 loc) · 1.1 KB
/
missingImport.js
File metadata and controls
40 lines (35 loc) · 1.1 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
wrap(function() {
style.add(
'.missingArt { color: orange; }',
'.missing { color: red; }',
);
function init() {
globalSet('showPage', function (page) {
this.super(page);
thing(page * 10);
});
fn.dismissable({
title: 'Did you know?',
text: `An <span class="missingArt">orange arrow</span> means you're missing artifact(s) and a <span class="missing">red arrow</span> means you're missing card(s)`,
key: 'underscript.notice.hubImport',
});
}
function thing(start) {
const pages = global('pages');
for (let i = start; i < start + 10 && i < pages.length; i++) {
check(pages[i]);
}
}
function check({code, id}) {
const checkArt = global('ownArtifactHub');
const deck = JSON.parse(atob(code));
const missingCard = getOwnedCardsArrayHub(deck).some((a) => !a);
const missingArt = deck.artifactIds.some((id) => !checkArt(id));
$(`#hub-deck-${id} .show-button`)
.toggleClass('missingArt', missingArt)
.toggleClass('missing', missingCard);
}
onPage('Hub', () => {
eventManager.on(':loaded', init);
});
});