1;var wp_custom; 2 3(function($) { 4 'use strict'; 5 6 wp_custom = { 7 8 init: function() { 9 this.uploadfileRequire(); 10 this.toggleButton(); 11 this.accordionItems(); 12 this.updateHiddenTextCF7(); 13 this.fixScroll(); 14 }, 15 fixScroll: function () { 16 // Smooth scrolling on click 17 $('a[href*="#"]:not([href="#"]):not(.smooth-scroll-disabled)').click(function (e) { 18 var targetHash = this.hash; 19 var targetPath = this.pathname.replace(/^\//, ''); 20 var currentPath = location.pathname.replace(/^\//, ''); 21 22 if (targetPath === currentPath && location.hostname === this.hostname) { 23 e.preventDefault(); 24 var target = $(targetHash); 25 target = target.length ? target : $('[name=' + targetHash.slice(1) + ']'); 26 27 if (target.length) { 28 console.log('Scrolling to:', target); 29 30 function getHeaderHeight() { 31 return $('#header').outerHeight() || 0; 32 } 33 34 $('html, body').animate({ 35 scrollTop: target.offset().top - getHeaderHeight() 36 }, { 37 duration: 400, 38 step: function (now, fx) { 39 var newOffset = target.offset().top - getHeaderHeight(); 40 if (fx.end !== newOffset) { 41 fx.end = newOffset; 42 } 43 } 44 }); 45 46 return false; 47 } 48 } 49 }); 50 51 // Smooth scrolling after page load if URL contains a hash 52 $(window).on('load', function () { 53 setTimeout(function () { 54 if (window.location.hash) { 55 var target = $(window.location.hash); 56 if (target.length) { 57 console.log('Page loaded with hash:', window.location.hash); 58 59 function getHeaderHeight() { 60 return $('#header').outerHeight() || 0; 61 } 62 63 $('html, body').animate({ 64 scrollTop: target.offset().top - getHeaderHeight() 65 }, 400); 66 } 67 } 68 }, 100); 69 }); 70}, 71 updateHiddenTextCF7: function () { 72 jQuery(document).ready(function ($) { 73 function updateHiddenTextNode() { 74 var checkboxes = $('.experience-checkbox input[type="checkbox"]'); 75 checkboxes.each(function () { 76 var checkbox = $(this); 77 var checkboxId = checkbox.closest('.wpcf7-checkbox').attr('id'); 78 var hiddenTextNodeInput = $('input[name="text-default-' + checkboxId + '"]'); 79 80 if (checkbox.is(':checked')) { 81 if (!hiddenTextNodeInput.attr('data-filled')) { 82 hiddenTextNodeInput.val(hiddenTextNodeInput.attr('placeholder')); 83 hiddenTextNodeInput.attr('data-filled', 'true'); 84 } 85 hiddenTextNodeInput.show(); 86 } else { 87 hiddenTextNodeInput.val(''); 88 hiddenTextNodeInput.removeAttr('data-filled'); 89 hiddenTextNodeInput.hide(); 90 } 91 }); 92 } 93 94 $('.wpcf7-form').on('submit', function () { 95 var checkboxes = $('.experience-checkbox input[type="checkbox"]'); 96 checkboxes.each(function () { 97 var checkbox = $(this); 98 var checkboxId = checkbox.closest('.wpcf7-checkbox').attr('id'); 99 var hiddenTextNodeInput = $('input[name="text-default-' + checkboxId + '"]'); 100 101 if (hiddenTextNodeInput.is(':visible')) { 102 hiddenTextNodeInput.attr('value', hiddenTextNodeInput.val()); 103 } 104 }); 105 }); 106 107 updateHiddenTextNode(); 108 $('.experience-checkbox input[type="checkbox"]').on('change', updateHiddenTextNode); 109 }); 110}, 111 accordionItems:function(){ 112 var accordionItems = document.querySelectorAll('.accordion-item'); 113
114 accordionItems.forEach(function(item) { 115 var header = item.querySelector('.accordion-header'); 116 var content = item.querySelector('.accordion-content'); 117 118 header.addEventListener('click', function() { 119 item.classList.toggle('active'); 120 if (item.classList.contains('active')) { 121 content.style.maxHeight = (content.scrollHeight + 80) + 'px'; 122 } else { 123 content.style.maxHeight = '0'; 124 } 125 }); 126 }); 127 128 }, 129 toggleButton:function(){ 130 $(document).ready(function() { 131 $('.second-block').hide(); 132 $('#toggleButton').click(function(e) { 133 e.preventDefault(); 134 if ($('.second-block').is(':hidden')) { 135 $('.second-block').show(); 136 $(this).text('Hide more cards'); 137 } else { 138 $('.second-block').hide(); 139 $(this).text('Load more cards'); 140 } 141 }); 142 }); 143 }, 144 uploadfileRequire: function() { 145 const form = document.querySelector('form.wpcf7-form'); 146 const fileInput = document.querySelector('input[type="file"][aria-required="true"]'); 147 if (form && fileInput) { 148 form.addEventListener('submit', function (e) { 149 const existingError = fileInput.parentNode.querySelector('.error-message'); 150 if (existingError) { 151 existingError.remove(); 152 } 153 if (fileInput.value === '') { 154 e.preventDefault(); 155 const errorMessage = document.createElement('span'); 156 errorMessage.textContent = 'The file field is required.'; 157 errorMessage.className = 'error-message'; 158 errorMessage.style.color = '#f37e3c'; 159 errorMessage.style.fontSize = '12px'; 160 fileInput.parentNode.appendChild(errorMessage); 161 } 162 }); 163 } 164 }, 165 }; 166 167 $(document).ready(function(){ 168 wp_custom.init(); 169 }) 170 171}(jQuery));
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.