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

@@ -134,6 +134,25 @@ if (isset($_SESSION['steamid'])) {
?>
</select>
<br></br>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#weaponModal<?php echo $defindex ?>">
Settings
</button>
</div>
<div class="modal fade" id="weaponModal<?php echo $defindex ?>" tabindex="-1" role="dialog" aria-labelledby="weaponModalLabel<?php echo $defindex ?>" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class='card-title item-name'>
<?php
if (array_key_exists($defindex, $selectedSkins)) {
echo "{$skins[$defindex][$selectedSkins[$defindex]]["paint_name"]} Settings";
} else {
echo "{$default["paint_name"]} Settings";
}
?>
</h5>
</div>
<div class="modal-body">
<div class="form-group">
<select class="form-select" id="wearSelect<?php echo $defindex ?>" name="wearSelect" onchange="updateWearValue<?php echo $defindex ?>(this.value)">
<option value="0.00">Factory New</option>
@@ -147,8 +166,7 @@ if (isset($_SESSION['steamid'])) {
<div class="col-md-6">
<div class="form-group">
<label for="wear">Wear:</label>
<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">
<span id="wearValue<?php echo $defindex ?>">0.00</span>
<input type="text" value="0" class="form-control" id="wear<?php echo $defindex ?>" name="wear">
</div>
</div>
<div class="col-md-6">
@@ -158,19 +176,26 @@ if (isset($_SESSION['steamid'])) {
</div>
</div>
</div>
</form>
</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>
// wear
function updateWearValue<?php echo $defindex ?>(selectedValue) {
document.getElementById("wear<?php echo $defindex ?>").value = selectedValue;
document.getElementById("wearValue<?php echo $defindex ?>").innerText = selectedValue;
var wearInputElement = document.getElementById("wear<?php echo $defindex ?>");
wearInputElement.value = selectedValue;
}
function validateWear(inputElement) {
inputElement.value = inputElement.value.replace(/[^0-9]/g, '');
}
// Add JavaScript to dynamically update the span with the current wear value
document.getElementById('wear<?php echo $defindex ?>').addEventListener('input', function () {
document.getElementById('wearValue<?php echo $defindex ?>').innerText = this.value;
});
// seed
function validateSeed(input) {
// Check entered value