Skip to content

Commit 3074ecd

Browse files
committed
chore: restore old rarity behavior on crafting page
1 parent 2b3dc42 commit 3074ecd

File tree

1 file changed

+4
-30
lines changed

1 file changed

+4
-30
lines changed

src/base/library/filter.js

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ const setting = settings.register({
3636
key: 'underscript.deck.filter.disable',
3737
});
3838

39-
const splitBaseGen = settings.register({
40-
...base,
41-
name: Translation.Setting('filter.split'),
42-
key: 'underscript.deck.filter.split',
43-
});
44-
4539
const tribe = settings.register({
4640
...base,
4741
name: Translation.Setting('filter.tribe'),
@@ -78,16 +72,8 @@ style.add(
7872

7973
function applyLook(refresh = decks || crafting) {
8074
$('input[onchange^="applyFilters();"]').parent().parent().toggleClass('filter', !setting.value());
81-
if (crafting) {
82-
if (setting.value() || !splitBaseGen.value()) {
83-
$('#baseGenInput').prop('checked', false).prop('disabled', false);
84-
$('.rarityInput.custom').parent().remove();
85-
} else if (!$('#baseRarityInput').length) {
86-
// Add BASE
87-
$('#commonRarityInput').parent().before(createButton('BASE'), ' ');
88-
$('#baseGenInput').prop('checked', true).prop('disabled', true).parent()
89-
.after(createButton('TOKEN'));
90-
}
75+
if (crafting && !setting.value()) {
76+
$('input[rarity]:checked').prop('checked', false);
9177
}
9278

9379
// Tribe filter
@@ -145,14 +131,6 @@ function mergeShiny() {
145131
return shiny.value() === 'Always' || (decks && shiny.value() === 'Deck');
146132
}
147133

148-
function createButton(type) {
149-
return $(`
150-
<label>
151-
<input type="checkbox" id="${type.toLowerCase()}RarityInput" class="rarityInput custom" rarity="${type}" onchange="applyFilters(); showPage(currentPage);">
152-
<img src="images/rarity/BASE_${type}.png">
153-
</label>`);
154-
}
155-
156134
function allTribeButton() {
157135
return $(`
158136
<label>
@@ -236,12 +214,8 @@ filters.push(
236214
);
237215
},
238216
crafting && function baseGenFilter(card, removed) {
239-
if (removed || !splitBaseGen.value()) return null;
240-
return (
241-
card.rarity === 'BASE' && !card.shiny && !$('#baseRarityInput').prop('checked')
242-
) || (
243-
card.rarity === 'TOKEN' && !$('#tokenRarityInput').prop('checked')
244-
);
217+
if (removed || $('.rarityInput:checked').length) return null;
218+
return ['BASE', 'TOKEN'].includes(card.rarity);
245219
},
246220
function tribeFilter(card, removed) {
247221
if (removed || !tribe.value()) return null;

0 commit comments

Comments
 (0)