Skip to content

Commit de96a48

Browse files
committed
feature: optimize banner data initialization and adjust button height for improved UI
1 parent 4efd396 commit de96a48

File tree

2 files changed

+12
-42
lines changed

2 files changed

+12
-42
lines changed

script.js

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,56 +1257,26 @@ let weapons = [
12571257
];
12581258
let banners = {
12591259
standard: {
1260-
fiveStars: [],
1261-
fourStars: [],
1262-
threeStars: []
1260+
fiveStars: characters.filter(c => c.rarity == 5 && !['Venti', 'Klee', 'Xiao', 'Tartaglia', 'Zhongli'].includes(c.name))
1261+
.concat(weapons.filter(c => c.rarity == 5)),
1262+
fourStars: characters.filter(c => c.rarity == 4)
1263+
.concat(weapons.filter(c => c.rarity == 4)),
1264+
threeStars: weapons.filter(c => c.rarity == 3)
12631265
},
12641266
venti: {
12651267
featured: {
1266-
fiveStar: null,
1267-
fourStars: []
1268+
fiveStar: characters.filter(c => c.name == 'Venti'),
1269+
fourStars: characters.filter(c => c.rarity == 4 && ['Fischl', 'Sucrose', 'Xiangling'].includes(c.name))
12681270
},
12691271
regular: {
1270-
fiveStars: [],
1271-
fourStars: [],
1272-
threeStars: []
1272+
fiveStars: characters.filter(c => c.rarity == 5 && !['Venti', 'Klee', 'Xiao', 'Tartaglia', 'Zhongli'].includes(c.name)),
1273+
fourStars: characters.filter(c => c.rarity == 4 && !['Kaeya', 'Lisa', 'Amber', 'Fischl', 'Sucrose', 'Xiangling'].includes(c.name))
1274+
.concat(weapons.filter(c => c.rarity == 4)),
1275+
threeStars: weapons.filter(c => c.rarity == 3)
12731276
}
12741277
}
12751278
}
12761279

1277-
window.addEventListener('load', function() {
1278-
banners.standard.fiveStars = characters.filter((c) => {
1279-
return c.rarity == 5 && !['Venti', 'Klee', 'Xiao', 'Tartaglia', 'Zhongli'].includes(c.name);
1280-
}).concat(weapons.filter((c) => {
1281-
return c.rarity == 5;
1282-
}));
1283-
banners.standard.fourStars = characters.filter((c) => {
1284-
return c.rarity == 4;
1285-
}).concat(weapons.filter((c) => {
1286-
return c.rarity == 4;
1287-
}));
1288-
banners.standard.threeStars = weapons.filter((c) => {
1289-
return c.rarity == 3;
1290-
});
1291-
banners.venti.featured.fiveStar = characters.filter((c) => {
1292-
return c.name == 'Venti';
1293-
});
1294-
banners.venti.featured.fourStars = characters.filter((c) => {
1295-
return c.rarity == 4 && ['Fischl', 'Sucrose', 'Xiangling'].includes(c.name);
1296-
});
1297-
banners.venti.regular.fiveStars = characters.filter((c) => {
1298-
return c.rarity == 5 && !['Venti', 'Klee', 'Xiao', 'Tartaglia', 'Zhongli'].includes(c.name);
1299-
});
1300-
banners.venti.regular.fourStars = characters.filter((c) => {
1301-
return c.rarity == 4 && !['Kaeya', 'Lisa', 'Amber', 'Fischl', 'Sucrose', 'Xiangling'].includes(c.name);
1302-
}).concat(weapons.filter((c) => {
1303-
return c.rarity == 4;
1304-
}));
1305-
banners.venti.regular.threeStars = weapons.filter((c) => {
1306-
return c.rarity == 3;
1307-
});
1308-
});
1309-
13101280
document.getElementById('wish-button').addEventListener('click', function() {
13111281
// OK BUT WHY IS A BOOL STORED AS A STRING WTF JAVASCRIPT rant over
13121282
let result = [];

style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ button {
200200
margin-right: auto;
201201
text-align: center;
202202
border: 0.125rem solid white;
203-
height: 15rem;
203+
height: 20rem;
204204
border-radius: 0.625rem;
205205
background-color: #2a2a2a;
206206
padding: 1rem;

0 commit comments

Comments
 (0)