-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
280 lines (249 loc) · 13.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MIL-STD-2525C Symbol Generator</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100 min-h-screen flex items-center justify-center p-4">
<div class="bg-white shadow-lg rounded-lg p-8 w-full max-w-2xl">
<h1 class="text-3xl font-bold text-center text-gray-800 mb-6">MIL-STD-2525C Symbol Generator</h1>
<form id="symbolForm" class="space-y-4">
<div class="grid md:grid-cols-2 gap-4">
<div>
<label class="block text-gray-700 font-semibold mb-2">Standard Identity (Affiliation):</label>
<select id="standardIdentity" class="w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" required>
<option value="P">Pending</option>
<option value="U">Unknown</option>
<option value="F">Friendly</option>
<option value="H">Hostile</option>
<option value="N">Neutral</option>
<option value="A">Assumed Friend</option>
<option value="S">Suspect</option>
</select>
</div>
<div>
<label class="block text-gray-700 font-semibold mb-2">Battle Dimension:</label>
<select id="battleDimension" class="w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" required>
<option value="P">Space</option>
<option value="A">Air</option>
<option value="G">Ground</option>
<option value="S">Sea Surface</option>
<option value="U">Subsurface</option>
<option value="F">Special Operations</option>
<option value="X">Unknown/Other</option>
</select>
</div>
</div>
<div class="grid md:grid-cols-2 gap-4">
<div>
<label class="block text-gray-700 font-semibold mb-2">Status:</label>
<select id="status" class="w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" required>
<option value="A">Anticipated</option>
<option value="P">Present</option>
<option value="C">Present/Fully Capable</option>
<option value="D">Damaged</option>
<option value="V">Fully Capable</option>
<option value="X">Destroyed</option>
<option value="M">Maintenance</option>
</select>
</div>
<div>
<label class="block text-gray-700 font-semibold mb-2">Symbol Code (Function ID):</label>
<div class="grid grid-cols-3 gap-2">
<select id="symbolCodePart1" class="px-2 py-1 border rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500">
<option value="U">Unit</option>
<option value="E">Equipment</option>
<option value="I">Installation</option>
</select>
<select id="symbolCodePart2" class="px-2 py-1 border rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500">
<option value="A">Air</option>
<option value="G">Ground</option>
<option value="S">Sea</option>
<option value="U">Subsurface</option>
</select>
<div class="flex items-center">
<input type="text" id="symbolCodePart3" placeholder="Code"
class="w-full px-2 py-1 border rounded-l-md focus:outline-none focus:ring-1 focus:ring-blue-500"
pattern="[A-Z0-9]{4}" maxlength="4">
<button type="button" onclick="openModal()"
class="bg-blue-500 hover:bg-blue-600 text-white px-2 py-1 rounded-r-md text-sm">
?
</button>
</div>
</div>
</div>
</div>
<div class="grid md:grid-cols-2 gap-4">
<div>
<label class="block text-gray-700 font-semibold mb-2">Modifier 1 (Optional Equipment):</label>
<input type="text" id="modifier1" placeholder="2-char modifier"
class="w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
pattern="[A-Z0-9]{2}" maxlength="2">
</div>
<div>
<label class="block text-gray-700 font-semibold mb-2">Modifier 2 (Tactical Multiplier):</label>
<input type="text" id="modifier2" placeholder="2-char multiplier"
class="w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
pattern="[A-Z0-9]{2}" maxlength="2">
</div>
</div>
<div class="text-center">
<button type="button" onclick="generateSymbolString()"
class="bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-6 rounded-md transition duration-300 ease-in-out">
Generate Symbol String
</button>
</div>
</form>
<div id="symbolString" class="mt-6 p-4 bg-gray-100 rounded-md text-center font-mono text-lg"></div>
</div>
<div id="codeModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center">
<div class="bg-white rounded-lg p-6 w-11/12 max-w-4xl max-h-[90vh] overflow-auto">
<div class="flex justify-between items-center mb-4">
<h2 class="text-2xl font-bold">Ground Unit Specific Codes</h2>
<button onclick="closeModal()" class="text-gray-600 hover:text-gray-900 text-3xl">×</button>
</div>
<div id="codeModalContent"></div>
</div>
</div>
<script>
const specificCodes = {
A: {
'UUAA': 'Aircraft, Fixed Wing',
'UUAB': 'Aircraft, Rotary Wing',
'UUAC': 'Unmanned Aerial Vehicle (UAV)',
'UUAD': 'Lighter than Air',
'UUAE': 'Missile',
'UUAF': 'Space',
'UUAG': 'Lighter than Air Balloon',
'UUAH': 'Glider',
},
G: {
'UUGA': 'Infantry',
'UUGB': 'Mechanized Infantry',
'UUGC': 'Motorized Infantry',
'UUGD': 'Armored Infantry',
'UUGE': 'Reconnaissance',
'UUGF': 'Special Forces',
'UUGG': 'Light Infantry',
'UUGH': 'Mounted Infantry',
'UUGI': 'Ambulance',
'UUGJ': 'Artillery',
'UUGK': 'Artillery Howitzer',
'UUGL': 'Artillery Rocket Launcher',
'UUGM': 'Mortar',
'UUGN': 'Self-Propelled Howitzer',
},
S: {
'UUSA': 'Carrier',
'UUSB': 'Cruiser',
'UUSC': 'Destroyer',
'UUSD': 'Frigate',
'UUSE': 'Submarine Tender',
'UUSF': 'Patrol Craft',
'UUSG': 'Amphibious Warfare Ship',
'UUSH': 'Underway Replenishment',
},
U: {
'UUUA': 'Submarine',
'UUUB': 'Submarine Nuclear Ballistic Missile',
'UUUC': 'Submarine Nuclear Attack',
'UUUD': 'Submarine Diesel Attack',
'UUUE': 'Submarine Diesel Patrol',
'UUUF': 'Submarine Rescue',
'UUUG': 'Deep Submergence Rescue Vehicle',
'UUUH': 'Submarine Support',
}
};
function openModal() {
const domain = document.getElementById('symbolCodePart2').value;
const modalContent = document.getElementById('codeModalContent');
// Clear previous content
modalContent.innerHTML = '';
// Get codes for the selected domain
const domainCodes = specificCodes[domain];
// Group codes by category (for Ground domain)
const categoryMap = domain === 'G' ? {
'Infantry Types': ['UUGA', 'UUGB', 'UUGC', 'UUGD', 'UUGG', 'UUGH'],
'Special Forces': ['UUGF', 'UUGE'],
'Support and Medical': ['UUGI'],
'Artillery': ['UUGJ', 'UUGK', 'UUGL', 'UUGM', 'UUGN']
} : null;
if (categoryMap) {
// Categorized rendering for Ground domain
Object.entries(categoryMap).forEach(([categoryName, codes]) => {
const categorySection = document.createElement('div');
categorySection.className = 'space-y-4 mb-4';
const categoryTitle = document.createElement('h3');
categoryTitle.className = 'text-xl font-semibold mb-2 text-blue-700';
categoryTitle.textContent = categoryName;
categorySection.appendChild(categoryTitle);
const codesContainer = document.createElement('div');
codesContainer.className = 'grid md:grid-cols-2 gap-2';
codes.forEach(code => {
const codeElement = document.createElement('div');
codeElement.className = 'bg-gray-100 p-2 rounded-md hover:bg-gray-200 cursor-pointer';
codeElement.innerHTML = `
<span class="font-bold text-blue-600">${code}</span>:
${domainCodes[code]}
`;
codeElement.onclick = () => selectCode(code);
codesContainer.appendChild(codeElement);
});
categorySection.appendChild(codesContainer);
modalContent.appendChild(categorySection);
});
} else {
// Default rendering for other domains
const codesContainer = document.createElement('div');
codesContainer.className = 'grid md:grid-cols-2 gap-2';
Object.entries(domainCodes).forEach(([code, description]) => {
const codeElement = document.createElement('div');
codeElement.className = 'bg-gray-100 p-2 rounded-md hover:bg-gray-200 cursor-pointer';
codeElement.innerHTML = `
<span class="font-bold text-blue-600">${code}</span>:
${description}
`;
codeElement.onclick = () => selectCode(code);
codesContainer.appendChild(codeElement);
});
modalContent.appendChild(codesContainer);
}
// Show modal
document.getElementById('codeModal').classList.remove('hidden');
}
function selectCode(code) {
document.getElementById('symbolCodePart3').value = code.slice(-4);
closeModal();
}
function closeModal() {
document.getElementById('codeModal').classList.add('hidden');
}
function generateSymbolString() {
const standardIdentity = document.getElementById('standardIdentity').value;
const battleDimension = document.getElementById('battleDimension').value;
const status = document.getElementById('status').value;
const symbolCodePart1 = document.getElementById('symbolCodePart1').value;
const symbolCodePart2 = document.getElementById('symbolCodePart2').value;
const symbolCodePart3 = document.getElementById('symbolCodePart3').value.toUpperCase();
if (symbolCodePart3.length !== 4) {
alert('Specific symbol code must be 4 characters');
return;
}
const symbolCode = symbolCodePart1 + symbolCodePart2 + symbolCodePart3;
const modifier1 = document.getElementById('modifier1').value.toUpperCase() || '--';
const modifier2 = document.getElementById('modifier2').value.toUpperCase() || '--';
document.getElementById('symbolString').textContent = standardIdentity +
battleDimension +
status +
symbolCode +
modifier1 +
modifier2;
}
document.getElementById('symbolCodePart2').addEventListener('change', function() {
document.getElementById('symbolCodePart3').value = '';
});
</script>
</body>
</html>