1$(document).ready(function() { 2 $(document).on("input",".input-couter .form-control",function(e){ 3 var $this = $(this); 4 var currentLength = $this.val().length; 5 var maxLength = $this.attr('maxlength'); 6 $this.siblings('.counter').text(currentLength + '/' + maxLength); 7 $this.css('height', 'auto'); 8 $this.css('height', $this[0].scrollHeight + 'px'); 9 }); 10 11 // show / hide password JS start here 12 $(document).on("click",".btnshowpsaaword",function(e){ 13 const passwordField = $(this).parents(".form-input").find(".form-control"); 14 const fieldType = passwordField.attr('type'); 15 if (fieldType === 'password') { 16 passwordField.attr('type', 'text'); 17 $(this).addClass('toggle'); 18 } else { 19 passwordField.attr('type', 'password'); 20 $(this).removeClass('toggle'); 21 } 22 }) 23 // show / hide password JS end here 24 25 // show / hide field on checkbox checked and unchecked JS start here 26 $('.showfield').each(function () { 27 const $checkbox = $(this); 28 const targetId = $checkbox.attr('id'); 29 const $target = $('[data-id="' + targetId + '"]'); 30 31 function toggleVisibility() { 32 if ($checkbox.is(':checked')) { 33 $target.removeClass('hide'); 34 } else { 35 $target.addClass('hide'); 36 } 37 } 38 toggleVisibility(); 39 $checkbox.on('change', toggleVisibility); 40 }); 41 // show / hide field on checkbox checked and unchecked JS end here 42}); 43 44// For each upload section on the page 45$(function() { 46 if ($('.upload').length > 0) { 47 $('.upload').each(function() { 48 const upload = $(this); 49 // Znajdź ukryte inputy CF7 50 const $form = upload.closest('form.wpcf7-form'); 51 const hiddenInputs = $form.find('.hidden-file-inputs .file-input'); 52 53 // Znajdź input triggera (może byÄ w .upload lub .hidden-file-inputs) 54 let fileInput = upload.find('.upload-input'); 55 if (fileInput.length === 0) { 56 fileInput = $form.find('.upload-input'); 57 } 58 59 const addButton = upload.find('.add-file-btn'); 60 const uploadList = upload.next('.upload-list'); 61 62 console.log('CBTC Upload init:', { 63 upload: upload[0], 64 fileInput: fileInput[0], 65 fileInputLength: fileInput.length, 66 addButton: addButton[0], 67 uploadList: uploadList[0], 68 hiddenInputsCount: hiddenInputs.length 69 }); 70 71 // Tablica przechowujÄ ca pliki i ich przypisania do CF7 inputów 72 const uploadedFiles = []; 73 const maxFiles = 10; // file, file-1, file-2, ... file-9 74 75 console.log('CBTC Upload: Found', hiddenInputs.length, 'hidden CF7 inputs'); 76 77 function assignFilesToInputs() { 78 // WyczyÅÄ wszystkie inputy 79 hiddenInputs.each(function() { 80 this.value = ''; 81 }); 82 83 // Przypisz pliki do inputów po koleji 84 uploadedFiles.forEach(function(fileData, index) { 85 if (index < hiddenInputs.length) { 86 const input = hiddenInputs[index]; 87 const dt = new DataTransfer(); 88 dt.items.add(fileData.file); 89 input.files = dt.files; 90 } 91 }); 92 } 93 94 function handleFiles(files) { 95 $.each(files, function(_, file) { 96 // Sprawdź limit plików 97 if (uploadedFiles.length >= maxFiles) { 98 alert('Możesz dodaÄ maksymalnie ' + maxFiles + ' plików!'); 99 return false; 100 } 101 102 const fileType = file.type; 103 const fileSizeMB = (file.size / 1024 / 1024).toFixed(2); 104 const fileSizeText = fileSizeMB + ' MB'; 105 106 if (file.size > 10 * 1024 * 1024) { 107 alert('Maksymalny rozmiar pliku to 10 MB!'); 108 return; 109 } 110 111 let imagePath = main_url + '/images/'; 112 let iconSrc = imagePath + 'icon-pdf.svg'; 113 if (fileType.includes('pdf')) iconSrc = imagePath + 'icon-pdf.svg'; 114 else if (fileType.includes('png')) iconSrc = imagePath + 'icon-png.svg'; 115 else if (fileType.includes('jpg') || fileType.includes('jpeg')) iconSrc = imagePath + 'icon-png.svg'; 116 else if (fileType.includes('gif')) iconSrc = imagePath + 'icon-png.svg'; 117 118 const fileId = 'file-' + Date.now() + '-' + Math.random(); 119 const uploadCard = $(` 120 <div class="upload-card" data-file-id="${fileId}"> 121 <div class="file-info"> 122 <div class="file-info-icon d-shrink"> 123 <img src="${iconSrc}" alt="File" /> 124 </div> 125 <div class="file-name fw-14 ls-14 text-black">${file.name}</div> 126 <div class="file-size">${fileSizeText}</div> 127 </div> 128 <button type="button" class="btn btn-secondary delete-file d-s
128hrink" title="UsuÅ plik"> 129 <img src="${imagePath}icon-delete.svg" alt=""> 130 </button> 131 </div> 132 `); 133 134 // Dodaj plik do tablicy 135 uploadedFiles.push({ 136 id: fileId, 137 file: file, 138 card: uploadCard 139 }); 140 141 uploadCard.find('.delete-file').on('click', function() { 142 // UsuÅ plik z tablicy 143 const index = uploadedFiles.findIndex(f => f.id === fileId); 144 if (index > -1) { 145 uploadedFiles.splice(index, 1); 146 } 147 148 // UsuÅ kartÄ wizualnÄ 149 uploadCard.remove(); 150 151 // Zaktualizuj przypisania do inputów 152 assignFilesToInputs(); 153 }); 154 155 uploadList.append(uploadCard); 156 }); 157 158 // Przypisz pliki do ukrytych inputów CF7 159 assignFilesToInputs(); 160 } 161 162 addButton.on('click', function(e) { 163 e.preventDefault(); 164 e.stopPropagation(); 165 166 if (fileInput.length > 0) { 167 // Użyj natywnego click() zamiast jQuery dla lepszej kompatybilnoÅci 168 fileInput[0].click(); 169 } else { 170 console.error('CBTC Upload: Nie znaleziono inputa file w .upload'); 171 } 172 }); 173 174 fileInput.on('change', function(e) { 175 handleFiles(e.target.files); 176 fileInput.val(''); // WyczyÅÄ input aby można byÅo dodaÄ ten sam plik ponownie 177 }); 178 179 upload.on('dragenter dragover', function(e) { 180 e.preventDefault(); 181 e.stopPropagation(); 182 upload.addClass('dragover'); 183 }); 184 185 upload.on('dragleave', function(e) { 186 e.preventDefault(); 187 e.stopPropagation(); 188 upload.removeClass('dragover'); 189 }); 190 191 upload.on('drop', function(e) { 192 e.preventDefault(); 193 e.stopPropagation(); 194 upload.removeClass('dragover'); 195 const files = e.originalEvent.dataTransfer.files; 196 handleFiles(files); 197 }); 198 }); 199 } 200}); 201 202// select dropdown on the page 203$(document).ready(function () { 204 $("select.form-control").each(function () { 205 const $select = $(this); 206 const selectedOption = $select.find("option:selected"); 207 const selectedText = selectedOption.text(); 208 const selectedIcon = selectedOption.data("icon"); 209 210 const $wrapper = $('<div class="custom-select"></div>'); 211 const iconHtml = selectedIcon ? `<img src="${selectedIcon}" alt="" class="option-icon">` : ""; 212 const $trigger = $(` 213 <button type="button" class="custom-select-trigger form-control"> 214 ${iconHtml}<span>${selectedText}</span> 215 </button> 216 `); 217 const $options = $('<div class="custom-options"></div>'); 218 219 if (selectedOption.is('[disabled], [hidden], [value=""]')) { 220 $trigger.addClass("placeholder"); 221 } 222 223 $select.find("option").each(function () { 224 const value = $(this).val(); 225 const text = $(this).text(); 226 const icon = $(this).data("icon"); 227 const isSelected = $(this).is(":selected"); 228 229 if (value) { 230 const iconHtml = icon ? `<img src="${icon}" alt="" class="option-icon">` : ""; 231 $options.append(` 232 <div class="custom-option${isSelected ? ' selected' : ''}" data-value="${value}"> 233 ${iconHtml}<span>${text}</span> 234 </div> 235 `); 236 } 237 }); 238 239 $wrapper.append($trigger).append($options); 240 $select.after($wrapper).addClass("select-input"); 241 242 $trigger.on("click", function (e) { 243 e.stopPropagation(); 244 const $currentTrigger = $(this); 245 const $currentOptions = $currentTrigger.siblings('.custom-options'); // Znajdź OPTIONS tego triggera 246 247 $(".custom-select-trigger").not($currentTrigger).removeClass("show"); 248 $currentTrigger.toggleClass("show"); 249 250 $(".custom-options").not($currentOptions).hide(); 251 $currentOptions.toggle(); 252 }); 253 254 $options.on("click", ".custom-option", function () { 255 const value = $(this).data("value"); 256 const text = $(this).find("span").text(); 257 const icon = $(this).find("img").attr("src"); 258 259 $options.find(".custom-option").removeClass("selected"); 260 $(this).addClass("selected"); 261 262 const iconHtml = icon ? `<img src="${icon}" alt="" class="option-icon">` : ""; 263 $trigger.html(`${iconHtml}<span>${text}</span>`); 264 265 if (value) { 266 $trigger.removeClass("placeholder"); 267 } else { 268 $trigger.addClass("placeholder"); 269 } 270 271 $trigger.removeClass("show"); 272 $select.val(value).trigger("change"); 273 $options.hide(); 274 275 $select.removeClass("error"); 276 $select.nextAll("label.error").remove(); 277 });
278 279 $(document).on("click", function (e) { 280 if (!$(e.target).closest(".custom-select").length) { 281 $(".custom-options").hide(); 282 $(".custom-select-trigger").removeClass("show"); 283 } 284 }); 285 }); 286}); 287 288// Contact Form 7 - Loading animation 289$(document).ready(function() { 290 // Show loader on form submit 291 $('.wpcf7').on('submit', function() { 292 const $btn = $(this).find('.input-group-btn button[type="submit"]'); 293 setTimeout(function() { 294 $btn.addClass('loading').prop('disabled', true); 295 }, 10); 296 }); 297 298 document.addEventListener('wpcf7submit', function(event) { 299 const $form = $(event.target); 300 const $btn = $form.find('.input-group-btn button[type="submit"]'); 301 $btn.removeClass('loading').prop('disabled', false); 302 }, false); 303 304 // Hide loader on success 305 document.addEventListener('wpcf7mailsent', function(event) { 306 const $form = $(event.target); 307 const $btn = $form.find('.input-group-btn button[type="submit"]'); 308 $btn.removeClass('loading').prop('disabled', false); 309 }, false); 310 311 // Hide loader on mail fail 312 document.addEventListener('wpcf7mailfailed', function(event) { 313 const $form = $(event.target); 314 const $btn = $form.find('.input-group-btn button[type="submit"]'); 315 $btn.removeClass('loading').prop('disabled', false); 316 }, false); 317 318 // Hide loader on validation fail 319 document.addEventListener('wpcf7invalid', function(event) { 320 const $form = $(event.target); 321 const $btn = $form.find('.input-group-btn button[type="submit"]'); 322 $btn.removeClass('loading').prop('disabled', false); 323 }, false); 324});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.