wear has been updated and settings have been moved into modal and added settings button
This commit is contained in:
Nilsu Derinder
2023-12-11 11:32:40 +03:00
committed by GitHub
parent 4e72f10326
commit 78649f5dcf

View File

@@ -133,46 +133,71 @@ if (isset($_SESSION['steamid'])) {
} }
?> ?>
</select> </select>
<br></br> <br></br>
<div class="form-group"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#weaponModal<?php echo $defindex ?>">
<select class="form-select" id="wearSelect<?php echo $defindex ?>" name="wearSelect" onchange="updateWearValue<?php echo $defindex ?>(this.value)"> Settings
<option value="0.00">Factory New</option> </button>
<option value="0.07">Minimal Wear</option> </div>
<option value="0.15">Field-Tested</option> <div class="modal fade" id="weaponModal<?php echo $defindex ?>" tabindex="-1" role="dialog" aria-labelledby="weaponModalLabel<?php echo $defindex ?>" aria-hidden="true">
<option value="0.38">Well-Worn</option> <div class="modal-dialog" role="document">
<option value="0.45">Battle-Scarred</option> <div class="modal-content">
</select> <div class="modal-header">
</div> <h5 class='card-title item-name'>
<div class="row"> <?php
<div class="col-md-6"> if (array_key_exists($defindex, $selectedSkins)) {
<div class="form-group"> echo "{$skins[$defindex][$selectedSkins[$defindex]]["paint_name"]} Settings";
<label for="wear">Wear:</label> } else {
<input type="range" class="form-range" min="0.00" max="1.00" step="0.01" id="wear<?php echo $defindex ?>" name="wear" value="0.00"> echo "{$default["paint_name"]} Settings";
<span id="wearValue<?php echo $defindex ?>">0.00</span> }
</div> ?>
</div> </h5>
<div class="col-md-6"> </div>
<div class="form-group"> <div class="modal-body">
<label for="seed">Seed:</label> <div class="form-group">
<input type="text" value="0" class="form-control" id="seed<?php echo $defindex ?>" name="seed" oninput="validateSeed(this)"> <select class="form-select" id="wearSelect<?php echo $defindex ?>" name="wearSelect" onchange="updateWearValue<?php echo $defindex ?>(this.value)">
</div> <option value="0.00">Factory New</option>
</div> <option value="0.07">Minimal Wear</option>
</div> <option value="0.15">Field-Tested</option>
</form> <option value="0.38">Well-Worn</option>
</div> <option value="0.45">Battle-Scarred</option>
</div> </select>
</div> </div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="wear">Wear:</label>
<input type="text" value="0" class="form-control" id="wear<?php echo $defindex ?>" name="wear">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="seed">Seed:</label>
<input type="text" value="0" class="form-control" id="seed<?php echo $defindex ?>" name="seed" oninput="validateSeed(this)">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-danger">Use</button>
// form end </form>
</div>
</div>
</div>
</div>
</div>
</div>
<script> <script>
function updateWearValue<?php echo $defindex ?>(selectedValue) { // wear
document.getElementById("wear<?php echo $defindex ?>").value = selectedValue; function updateWearValue<?php echo $defindex ?>(selectedValue) {
document.getElementById("wearValue<?php echo $defindex ?>").innerText = selectedValue; var wearInputElement = document.getElementById("wear<?php echo $defindex ?>");
} wearInputElement.value = selectedValue;
// Add JavaScript to dynamically update the span with the current wear value }
document.getElementById('wear<?php echo $defindex ?>').addEventListener('input', function () { function validateWear(inputElement) {
document.getElementById('wearValue<?php echo $defindex ?>').innerText = this.value; inputElement.value = inputElement.value.replace(/[^0-9]/g, '');
}); }
// seed // seed
function validateSeed(input) { function validateSeed(input) {
// Check entered value // Check entered value
var inputValue = input.value.replace(/[^0-9]/g, ''); // Just get the numbers var inputValue = input.value.replace(/[^0-9]/g, ''); // Just get the numbers
@@ -184,7 +209,7 @@ if (isset($_SESSION['steamid'])) {
input.value = numericValue; input.value = numericValue;
} }
} }
</script> </script>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>