-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+

120

121
diff --git a/nightreign/site.css b/nightreign/site.css
index fffe80e..ed6849e 100644
--- a/nightreign/site.css
+++ b/nightreign/site.css
@@ -38,6 +38,25 @@ body {
margin: 0.5em 0 0.5em 0;
text-align: center;
}
+.filter-controls {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ gap: 20px;
+ flex-wrap: wrap;
+}
+.filter-group {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+.filter-group.earth-filter {
+ display: none;
+}
+#earthFilter, #nightlordFilter {
+ padding: 2px 4px;
+ font-size: 16px;
+}
.nav {
margin: 0 0 0.2em 0;
text-align: center;
diff --git a/nightreign/site.js b/nightreign/site.js
index 8ffe597..7348456 100644
--- a/nightreign/site.js
+++ b/nightreign/site.js
@@ -25,12 +25,74 @@ function updateSort() {
const idsort = document.getElementById('sortid').checked;
document.getElementById('idgrid').style.display = idsort ? '' : 'none';
document.getElementById('spawngrid').style.display = !idsort ? '' : 'none';
+
+ const earthFilterGroup = document.querySelector('.filter-group.earth-filter');
+ if (earthFilterGroup) {
+ earthFilterGroup.style.display = !idsort ? 'flex' : 'none';
+ }
+
localStorage.setItem('nightreign.sort', idsort ? 'id' : 'spawn');
+
+ if (!idsort) {
+ updateEarthFilter();
+ }
+}
+
+function updateEarthFilter() {
+ const filter = document.getElementById('earthFilter');
+ if (!filter) {
+ return;
+ }
+
+ const selectedValue = filter.value;
+ const spawnsets = document.querySelectorAll('.spawnset');
+
+ spawnsets.forEach(spawnset => {
+ const legend = spawnset.querySelector('legend').textContent;
+ let shouldShow = true;
+
+ if (selectedValue === 'none') {
+ shouldShow = !legend.includes('(Mountaintop)') &&
+ !legend.includes('(Crater)') &&
+ !legend.includes('(Rotted Woods)') &&
+ !legend.includes('(Noklateo)');
+ } else if (selectedValue === 'mountaintop') {
+ shouldShow = legend.includes('(Mountaintop)');
+ } else if (selectedValue === 'crater') {
+ shouldShow = legend.includes('(Crater)');
+ } else if (selectedValue === 'rotted-woods') {
+ shouldShow = legend.includes('(Rotted Woods)');
+ } else if (selectedValue === 'noklateo') {
+ shouldShow = legend.includes('(Noklateo)');
+ }
+
+ spawnset.style.display = shouldShow ? '' : 'none';
+ });
+
+ localStorage.setItem('nightreign.earthFilter', selectedValue);
}
function selectSort() {
document.getElementById('sortid').addEventListener('change', updateSort);
document.getElementById('sortspawn').addEventListener('change', updateSort);
+
+ const earthFilter = document.getElementById('earthFilter');
+ if (earthFilter) {
+ earthFilter.addEventListener('change', updateEarthFilter);
+ const savedFilter = localStorage.getItem('nightreign.earthFilter');
+ if (savedFilter) {
+ earthFilter.value = savedFilter;
+ }
+ }
+
+ const nightlordFilter = document.getElementById('nightlordFilter');
+ if (nightlordFilter) {
+ nightlordFilter.addEventListener('change', function() {
+ const selectedNightlord = this.value;
+ window.location.href = `../${selectedNightlord}/`;
+ });
+ }
+
const pref = localStorage.getItem('nightreign.sort');
if (pref === 'id') {
document.getElementById('sortid').checked = true;