Refactored weapon forms and enhanced styling.

This commit is contained in:
IM23a-spirgif
2025-05-19 22:31:10 +02:00
parent 0f0137c2e9
commit 2217cfbdb8
3 changed files with 158 additions and 40 deletions
+1 -1
View File
@@ -573,7 +573,7 @@ form.addEventListener('submit', e => {
mag_size: parseFloat(data.get('magazin')), mag_size: parseFloat(data.get('magazin')),
reload_time: parseFloat(data.get('reload-time')), reload_time: parseFloat(data.get('reload-time')),
damage_multiplier: parseFloat(data.get('multiplier')), damage_multiplier: parseFloat(data.get('multiplier')),
guntype: data.getAll('gun-type') guntype: data.get('gun-type') ? [data.get('gun-type')] : []
}; };
// 2) Add it local // 2) Add it local
+112
View File
@@ -491,3 +491,115 @@ body.menu-open {
.select-wrapper > input[type="text"]::placeholder { .select-wrapper > input[type="text"]::placeholder {
color: #888; color: #888;
} }
#weapon-form {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 40px 0;
background: rgba(0, 0, 0, 0.5);
justify-content: center;
align-items: center;
z-index: 2500;
}
/* When JS opens it, we set display:flex */
#weapon-form.show {
display: flex;
}
/* The white “card” in the center */
#weapon-form > div {
background: #fff;
padding: 24px;
border-radius: 8px;
width: 90%;
max-width: 480px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
position: relative;
}
/* Header inside the card */
#weapon-form h2 {
margin-top: 0;
color: #222;
font-size: 1.75rem;
text-align: center;
}
/* All form inputs stretch full width */
#weapon-form form input[type="text"],
#weapon-form form input[type="number"],
#weapon-form form select {
width: 100%;
padding: 8px 12px;
margin-top: 4px;
margin-bottom: 16px;
border: 1px solid #ccc;
border-radius: 6px;
font-size: 1rem;
background: #fafafa;
transition: border-color 0.2s ease;
}
/* Multi-select box a bit taller */
#weapon-form form select[multiple] {
min-height: 120px;
}
/* On focus, highlight */
#weapon-form form input:focus,
#weapon-form form select:focus {
outline: none;
border-color: darkred;
box-shadow: 0 0 4px rgba(139, 0, 0, 0.4);
}
/* Buttons in the modal */
#weapon-form form button {
padding: 10px 20px;
border: none;
border-radius: 6px;
font-size: 1rem;
cursor: pointer;
margin-right: 8px;
}
/* Confirm (Create) */
#weapon-form form button[type="submit"] {
background-color: darkred;
color: #fff;
}
#weapon-form form button[type="submit"]:hover {
background-color: red;
}
/* Cancel */
#weapon-form form button#weapon-cancel {
background-color: #666;
color: #fff;
}
#weapon-form form button#weapon-cancel:hover {
background-color: #444;
}
/* The “Create New Weapon” opener button */
#weapon-create {
margin: 0 0 20px;
padding: 10px 16px;
background-color: darkred;
border: none;
border-radius: 6px;
color: white;
font-size: 1rem;
cursor: pointer;
}
#weapon-create:hover {
background-color: red;
}
+12 -6
View File
@@ -25,6 +25,7 @@
</header> </header>
<body> <body>
<main> <main>
<div class="select-wrapper">
<label for="weapon-search"></label> <label for="weapon-search"></label>
<input type="text" id="weapon-search" placeholder="Search weapons..." onkeyup="filterWeapons()"> <input type="text" id="weapon-search" placeholder="Search weapons..." onkeyup="filterWeapons()">
<br> <br>
@@ -32,6 +33,7 @@
<select id="weapon-select" name="weapons"> <select id="weapon-select" name="weapons">
<option value="">Select a Weapon</option> <option value="">Select a Weapon</option>
</select> </select>
</div>
<button id="weapon-create">Create New Weapon</button> <button id="weapon-create">Create New Weapon</button>
<div id="weapon-form"> <div id="weapon-form">
<div> <div>
@@ -67,16 +69,18 @@
<input type="number" name="multiplier" min="0" required> <input type="number" name="multiplier" min="0" required>
</label><br><br> </label><br><br>
<label> <div class="select-wrapper">
Weapon Type:<br> <label for="gun-type">Weapon Type:</label>
<select name="gun-type" multiple> <select id="gun-type" name="gun-type">
<option value="">Select a type</option>
<option value="PISTOL">Pistol</option> <option value="PISTOL">Pistol</option>
<option value="SECONDARY">Secondary</option> <option value="SECONDARY">Secondary</option>
<option value="WW2">WW2</option> <option value="WW2">WW2</option>
<option value="RIFLE">Rifle</option> <option value="RIFLE">Rifle</option>
<option value="SOVIET">Soviet</option> <option value="SOVIET">Soviet</option>
</select> </select>
</label><br><br> </div>
<button type="submit">Create</button> <button type="submit">Create</button>
<button type="button" id="weapon-cancel">Cancel</button> <button type="button" id="weapon-cancel">Cancel</button>
@@ -97,14 +101,16 @@
<label><input type="checkbox" id="special" value="SPECIAL"> Special</label> <label><input type="checkbox" id="special" value="SPECIAL"> Special</label>
<label><input type="checkbox" id="semi-auto" value="SEMI-AUTO"> Semi-Auto</label> <label><input type="checkbox" id="semi-auto" value="SEMI-AUTO"> Semi-Auto</label>
</div> </div>
<div class="select-wrapper">
<label for="operative-search"></label> <label for="operative-search"></label>
<input type="text" id="operative-search" placeholder="Search operatives..." onkeyup="filterOperatives()"> <input type="text" id="operative-search" placeholder="Search operatives..." onkeyup="filterOperatives()">
<br> <br>
<label for="operative-select"></label> <label for="operative-select"></label>
<select id="operative-select"> <select id="operative-select">
<option value="">Select an operative</option> <option value="">Select an operative</option>
</select><br> </select>
</div>
<br>
<div id="weapon-stats"></div> <div id="weapon-stats"></div>
<div id="calculated-stats"></div> <div id="calculated-stats"></div>
<h3>Operative Specific Modifiers</h3> <h3>Operative Specific Modifiers</h3>