|
146 | 146 | @media (max-width: 768px) { |
147 | 147 | .modsContainer { |
148 | 148 | flex-direction: column; |
| 149 | + position: relative; |
149 | 150 | } |
150 | 151 | .modsSidebar { |
151 | 152 | width: 100%; |
|
154 | 155 | } |
155 | 156 | .modsBody { |
156 | 157 | width: 100%; |
| 158 | + position: relative; |
157 | 159 | } |
| 160 | + #searchInput { |
| 161 | + position: static !important; |
| 162 | + width: calc(100% - 30px); |
| 163 | + margin-left: 15px; |
| 164 | + margin-right: 15px; |
| 165 | + margin-top: 15px; |
| 166 | + margin-bottom: 15px; |
| 167 | + } |
158 | 168 | } |
159 | 169 | @media (min-width: 768px) { |
160 | 170 | .modsSidebar { |
|
254 | 264 | </div> |
255 | 265 | </div> |
256 | 266 |
|
257 | | - <div style="width: 100%; height: 6.5em; background: linear-gradient(rgba(104, 40, 40, 0.4), rgba(203, 119, 119, 0.1)), url(/img/bg/chiseled_quartz_block_top.png); background-size: 32px; image-rendering: pixelated;"></div> |
| 267 | + <div style="width: 100%; height: 6.5em; background: linear-gradient(rgba(104, 40, 40, 0.4), rgba(203, 119, 119, 0.1)), url(/img/bg/chiseled_quartz_block_top.png); background-size: 32px; image-rendering: pixelated;"> |
| 268 | + |
| 269 | + <div style="position: relative;" id="desktopSearchContainer"> |
| 270 | + <input type="text" id="searchInput" placeholder="Search mods..." style=" |
| 271 | + position: absolute; |
| 272 | + right: 15px; |
| 273 | + top: calc(4em - 4px); |
| 274 | + background-color: rgba(0, 0, 0, 0.8); |
| 275 | + border: 2px solid black; |
| 276 | + outline: 2px solid white; |
| 277 | + color: rgba(255, 255, 255, 0.7); |
| 278 | + font-family: 'Minecraft Regular'; |
| 279 | + font-size: 13pt; |
| 280 | + padding-left: 35px; |
| 281 | + padding-bottom: 4px; |
| 282 | + background-image: url('/img/gui/oreui/search.png'); |
| 283 | + image-rendering: pixelated; |
| 284 | + background-repeat: no-repeat; |
| 285 | + background-position: 7px center; |
| 286 | + background-size: 20px 20px; |
| 287 | + "> |
| 288 | + </div> |
| 289 | + |
| 290 | + </div> |
258 | 291 |
|
259 | 292 | <div class="modsContainer"> |
260 | 293 |
|
|
315 | 348 | <img src="/img/gui/oreui/other.png">Other |
316 | 349 | </label> |
317 | 350 | <br> |
| 351 | + <div style="position: relative;" id="mobileSearchContainer"> |
| 352 | + </div> |
318 | 353 | </div> |
319 | 354 |
|
320 | 355 | <div class="modsBody"> |
| 356 | + |
321 | 357 | <div class="modItem" data-version="1.9.19" data-type="entity" onclick="window.location.href='https://github.com/Cracko298/mc3ds-creaking';"> |
322 | 358 | <div class="modContent"> |
323 | 359 | <div class="modHeader">The Creaking</div> |
|
1268 | 1304 | }); |
1269 | 1305 |
|
1270 | 1306 | </script> |
| 1307 | + <script> |
| 1308 | + document.getElementById('searchInput').addEventListener('input', function () { |
| 1309 | + searchMods(this.value); |
| 1310 | +}); |
| 1311 | + function searchMods(query) { |
| 1312 | + const mods = document.querySelectorAll('.modItem'); |
| 1313 | + const lowerQuery = query.toLowerCase(); |
| 1314 | + |
| 1315 | + mods.forEach(mod => { |
| 1316 | + const title = mod.querySelector('.modHeader').textContent.toLowerCase(); |
| 1317 | + if (title.includes(lowerQuery)) { |
| 1318 | + mod.style.display = 'block'; |
| 1319 | + } else { |
| 1320 | + mod.style.display = 'none'; |
| 1321 | + } |
| 1322 | + }); |
| 1323 | +} |
| 1324 | + |
| 1325 | + </script> |
| 1326 | + <script> |
| 1327 | + function moveSearchInput() { |
| 1328 | + const input = document.getElementById('searchInput'); |
| 1329 | + const desktopContainer = document.getElementById('desktopSearchContainer'); |
| 1330 | + const mobileContainer = document.getElementById('mobileSearchContainer'); |
| 1331 | + |
| 1332 | + if (window.innerWidth <= 768) { |
| 1333 | + if (mobileContainer && !mobileContainer.contains(input)) { |
| 1334 | + mobileContainer.appendChild(input); |
| 1335 | + } |
| 1336 | + } else { |
| 1337 | + if (desktopContainer && !desktopContainer.contains(input)) { |
| 1338 | + desktopContainer.appendChild(input); |
| 1339 | + } |
| 1340 | + } |
| 1341 | +} |
| 1342 | + |
| 1343 | +window.addEventListener('DOMContentLoaded', moveSearchInput); |
| 1344 | +window.addEventListener('resize', moveSearchInput); |
| 1345 | + |
| 1346 | + </script> |
1271 | 1347 |
|
1272 | 1348 |
|
1273 | 1349 |
|
|
0 commit comments