Skip to content

Commit 0e9b7a8

Browse files
committed
Added manual WebKit mobile fix
1 parent f778d90 commit 0e9b7a8

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

mods/index.html

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,27 @@
7171
align-items: center;
7272
justify-content: space-between;
7373
font-size: 14pt;
74+
gap: 0.5em;
75+
min-height: 2.5em;
7476
}
7577
.modAuthor {
7678
font-size: 0.7em;
7779
white-space: nowrap;
7880
overflow: hidden;
7981
text-overflow: ellipsis;
80-
max-width: 60%;
82+
max-width: calc(100% - 3em);
8183
}
8284
.modIcon {
8385
width: 2.5em;
8486
height: 2.5em;
8587
flex-shrink: 0;
88+
object-fit: contain;
8689
box-shadow: 0 2px 5px black;
8790
border: 2px solid white;
8891
filter: brightness(1.1);
89-
object-fit: contain;
90-
align-self: center;
92+
}
93+
.webkit-mobile-fix {
94+
transform: translateY(-20px);
9195
}
9296
@media (max-width: 513px) {
9397
.modDescription {
@@ -1203,67 +1207,67 @@
12031207
<script src="/scripts/main/nodetails.js"></script>
12041208
<script src="/scripts/main/vines.js"></script>
12051209
<script>
1206-
// Select all checkboxes
12071210
const filters = document.querySelectorAll('.modFilter');
12081211

1209-
// Listen for changes to the filters
12101212
filters.forEach(filter => {
12111213
filter.addEventListener('change', filterMods);
12121214
});
12131215

12141216
function filterMods() {
1215-
// Get all mod items
12161217
const mods = document.querySelectorAll('.modItem');
12171218

1218-
// Get the checked filter values
12191219
const activeFilters = Array.from(filters)
12201220
.filter(filter => filter.checked)
12211221
.map(filter => ({ filter: filter.dataset.filter, value: filter.value }));
12221222

12231223
mods.forEach(mod => {
12241224
let showMod = true;
12251225

1226-
// Loop through all the active filters
12271226
activeFilters.forEach(activeFilter => {
1228-
const modAttr = mod.dataset[activeFilter.filter]; // e.g. "entity,enemy"
1227+
const modAttr = mod.dataset[activeFilter.filter];
12291228

1230-
// If the attribute exists, split it by comma into an array
12311229
const modValues = modAttr ? modAttr.split(',') : [];
12321230

1233-
// Check if the mod includes the active filter value
12341231
if (!modValues.includes(activeFilter.value)) {
12351232
showMod = false;
12361233
}
12371234
});
12381235

1239-
// Show or hide the mod based on the filter matching
12401236
mod.style.display = showMod ? '' : 'none';
12411237
});
12421238
}
12431239
</script>
12441240

12451241
<script>
12461242
window.addEventListener('DOMContentLoaded', () => {
1247-
// Get all the mod items
12481243
const modItems = document.querySelectorAll('.modItem');
12491244

1250-
// Convert NodeList to array for sorting
12511245
const modItemsArray = Array.from(modItems);
12521246

1253-
// Sort the mod items based on modHeader, ignoring 'The'
12541247
modItemsArray.sort((a, b) => {
12551248
const headerA = a.querySelector('.modHeader').textContent.replace(/^The\s+/i, '');
12561249
const headerB = b.querySelector('.modHeader').textContent.replace(/^The\s+/i, '');
12571250

12581251
return headerA.localeCompare(headerB);
12591252
});
12601253

1261-
// Append the sorted mod items back into the container
12621254
const container = modItems[0].parentElement;
12631255
modItemsArray.forEach(modItem => container.appendChild(modItem));
12641256
});
12651257

12661258
</script>
1259+
<script>
1260+
document.addEventListener("DOMContentLoaded", function () {
1261+
const isWebkitMobile = /AppleWebKit/.test(navigator.userAgent) && /Mobile|iPhone|iPad|Android/.test(navigator.userAgent);
1262+
1263+
if (isWebkitMobile) {
1264+
document.querySelectorAll('.modIcon').forEach(icon => {
1265+
icon.classList.add('webkit-mobile-fix');
1266+
});
1267+
}
1268+
});
1269+
1270+
</script>
12671271

12681272

12691273

0 commit comments

Comments
 (0)