dynamic map list

This commit is contained in:
shoopea 2024-11-16 12:01:58 +01:00
parent c22ea63d31
commit 106be0e2b2
2 changed files with 27 additions and 16 deletions

21
public/js/maps.js Normal file
View File

@ -0,0 +1,21 @@
$(document).ready(function () {
var map_list = [];
function update_maps() {
map_list = [];
map_list.push("cs_italy");
map_list.push("cs_office");
map_list.push("de_ancient");
map_list.push("de_anubis");
map_list.push("de_assembly");
map_list.push("de_dust2");
map_list.push("de_inferno");
map_list.push("de_memento");
map_list.push("de_mills");
map_list.push("de_mirage");
map_list.push("de_nuke");
map_list.push("de_overpass");
map_list.push("de_thera");
map_list.push("de_vertigo");
}
});

View File

@ -96,7 +96,7 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="game" class="form-label">Game Selection:</label> <label for="game" class="form-label">Game Selection:</label>
<select id="game" name="game" class="form-select"> <select id="game" name="game" class="form-select" onchange="update_maps(this.value)">
<option value="1">Competitive Short</option> <option value="1">Competitive Short</option>
<option value="2">Competitive Long</option> <option value="2">Competitive Long</option>
<option value="3">Casual Short</option> <option value="3">Casual Short</option>
@ -106,21 +106,10 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="map" class="form-label">Map:</label> <label for="map" class="form-label">Map:</label>
<select id="map" name="map" class="form-select"> <select id="map" name="map" class="form-select maps">
<option value="cs_italy">cs_italy</option> <% for (var i = 0; i < map_list.length; i++) { %>
<option value="cs_office">cs_office</option> <option value="<%map_list[i]%>"><%map_list[i]%></option>
<option value="de_ancient">de_ancient</option> <% } %>
<option value="de_anubis">de_anubis</option>
<option value="de_assembly">de_assembly</option>
<option value="de_dust2">de_dust2</option>
<option value="de_inferno">de_inferno</option>
<option value="de_memento">de_memento</option>
<option value="de_mills">de_mills</option>
<option value="de_mirage">de_mirage</option>
<option value="de_nuke">de_nuke</option>
<option value="de_overpass">de_overpass</option>
<option value="de_thera">de_thera</option>
<option value="de_vertigo">de_vertigo</option>
</select> </select>
</div> </div>
<div class="mb-3"> <div class="mb-3">
@ -273,6 +262,7 @@
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>
<script src="/js/console.js"></script> <script src="/js/console.js"></script>
<script src="/js/maps.js"></script>
<script> <script>
window.server_id = '<%= server_id %>'; window.server_id = '<%= server_id %>';
</script> </script>