|
15 | 15 | } |
16 | 16 |
|
17 | 17 | changeFilesizeInputType(checkbox); |
18 | | -
|
19 | | - const slider = document.getElementById('file_size'); |
20 | | - const sizeValueDisplay = document.getElementById('size_value'); |
21 | | - if (slider && sizeValueDisplay) { |
22 | | - updateSliderDisplay(slider.value); |
23 | | - } |
24 | 18 | }); |
25 | 19 |
|
26 | 20 | function changePattern(element) { |
|
48 | 42 | const hiddenSizeInput = document.getElementById('max_file_size_manual'); |
49 | 43 | const sizeUnitInput = document.getElementById('size_unit_input'); |
50 | 44 |
|
51 | | - if (sizeUnitInput.value === 'mb') { |
52 | | - document.getElementById('size-mb').checked = true; |
53 | | - } else { |
54 | | - document.getElementById('size-kb').checked = true; |
55 | | - } |
56 | | -
|
57 | 45 | hiddenInput.value = element.checked ? "true" : "false"; |
58 | 46 |
|
59 | 47 | if (element.checked) { |
60 | | - sliderContainer.classList.add('hidden'); |
61 | | - manualSizeInput.classList.remove('hidden'); |
| 48 | + sliderContainer.style.display = "none"; |
| 49 | + manualSizeInput.style.display = "flex"; |
62 | 50 | const sizeUnit = sizeUnitInput.value; |
63 | 51 | const maxValue = sizeUnit === 'kb' ? 100 * 1024 : 100; |
64 | 52 | manualSizeValueInput.max = maxValue; |
|
67 | 55 | } |
68 | 56 | hiddenSizeInput.value = manualSizeValueInput.value || "1024"; |
69 | 57 | } else { |
70 | | - sliderContainer.classList.remove('hidden'); |
71 | | - manualSizeInput.classList.add('hidden'); |
| 58 | + manualSizeInput.style.display = "none"; |
| 59 | + sliderContainer.style.display = "flex"; |
| 60 | + sliderContainer.style.flexDirection = "column"; |
72 | 61 |
|
73 | 62 | const sliderValue = document.getElementById('file_size').value; |
74 | 63 | hiddenSizeInput.value = sliderValue; |
|
96 | 85 | manualSizeValueInput.value = 100; |
97 | 86 | hiddenSizeInput.value = 100; |
98 | 87 | } |
99 | | -
|
100 | | - console.log("Size unit changed to: " + sizeUnit.toUpperCase()); |
101 | 88 | } |
102 | | -
|
103 | | - document.getElementById('max_file_size_manual_input').addEventListener('input', function() { |
104 | | - const maxValue = parseInt(this.max); |
105 | | - const currentValue = parseInt(this.value); |
106 | | -
|
107 | | - if (currentValue > maxValue) { |
108 | | - this.value = maxValue; |
109 | | - } |
110 | | - }); |
111 | 89 | </script> |
112 | 90 | <div class="relative"> |
113 | | - <div class="w-full h-full absolute inset-0 bg-gray-900 rounded-xl translate-y-2 translate-x-2"></div> |
| 91 | + <div class="w-full lg:h-[90%] sm:h-full absolute inset-0 bg-gray-900 rounded-xl translate-y-2 translate-x-2"></div> |
114 | 92 | <div class="rounded-xl relative z-20 pl-8 sm:pl-10 pr-8 sm:pr-16 py-8 border-[3px] border-gray-900 bg-[#fff4da]"> |
115 | 93 | <img src="https://cdn.devdojo.com/images/january2023/shape-1.png" |
116 | 94 | class="absolute md:block hidden left-0 h-[4.5rem] w-[4.5rem] bottom-0 -translate-x-full ml-3"> |
|
186 | 164 | </div> |
187 | 165 | </div> |
188 | 166 | </div> |
189 | | - <div class="flex items-center gap-4 h-[50px]"> |
| 167 | + <div class="flex items-center gap-4 h-[40px]"> |
190 | 168 | <div class="mt-4"> |
191 | 169 | <label class="flex flex-col items-center cursor-pointer"> |
192 | 170 | <input type="checkbox" |
193 | 171 | id="use_manual_input" |
194 | 172 | name="use_manual_input" |
195 | | - value="false" |
196 | 173 | class="sr-only peer w-12" |
197 | 174 | onchange="changeFilesizeInputType(this)"> |
198 | 175 | <div class="relative w-12 h-6 bg-[#ebdbb7] peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-[#FE4A60]/30 rounded-full peer border-[2px] border-gray-900 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-5 after:transition-all peer-checked:bg-[#FE4A60]"> |
199 | 176 | </div> |
200 | | - <p class="ms-1 text-sm font-medium text-gray-900">Manual</p> |
| 177 | + <p class="ms-1 text-xs font-medium text-gray-900">Manual</p> |
201 | 178 | </label> |
202 | 179 | </div> |
203 | 180 | <div id="slider_container" class="w-[200px] sm:w-[200px] mt-3"> |
|
213 | 190 | value="{{ default_file_size }}" |
214 | 191 | class="w-full h-3 bg-[#FAFAFA] bg-no-repeat bg-[length:50%_100%] bg-[#ebdbb7] appearance-none border-[3px] border-gray-900 rounded-sm focus:outline-none bg-gradient-to-r from-[#FE4A60] to-[#FE4A60] [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:h-7 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:bg-white [&::-webkit-slider-thumb]:rounded-sm [&::-webkit-slider-thumb]:cursor-pointer [&::-webkit-slider-thumb]:border-solid [&::-webkit-slider-thumb]:border-[3px] [&::-webkit-slider-thumb]:border-gray-900 [&::-webkit-slider-thumb]:shadow-[3px_3px_0_#000]"> |
215 | 192 | </div> |
216 | | - <div id="manual_size_input_container" class="hidden mt-3 flex gap-2"> |
| 193 | + <div id="manual_size_input_container" class="mt-3 flex gap-2"> |
217 | 194 | <div> |
218 | 195 | <label for="max_file_size_manual_input" class="block text-gray-700 mb-1">Include files under:</label> |
219 | 196 | <input type="number" |
220 | 197 | id="max_file_size_manual_input" |
221 | 198 | name="max_file_size_manual" |
222 | 199 | min="1" |
223 | 200 | max="{{ '102400' if size_unit == 'kb' else '100' }}" |
224 | | - value="{{ max_file_size_manual }}" |
| 201 | + value="{{ default_file_size_manual }}" |
225 | 202 | class="lg:w-[150px] sm:w-[100px] border-[3px] border-gray-900 rounded-sm focus:outline-none bg-[#ebdbb7] appearance-none indent-2" |
226 | 203 | style="-webkit-appearance: none; |
227 | 204 | color: #333" |
|
235 | 212 | name="size_unit" |
236 | 213 | class="w-4 h-4" |
237 | 214 | {% if size_unit == 'kb' %}checked{% endif %} |
238 | | - onchange="updateSizeUnit(this)" |
239 | | - style="background-color:red"> |
| 215 | + onchange="updateSizeUnit(this)"> |
240 | 216 | <label for="size-kb" class="ms-2 text-sm font-medium text-gray-900">KB</label> |
241 | 217 | </div> |
242 | 218 | <div class="flex items-center mt-1"> |
|
0 commit comments