1 2$(document).ready(function(){ 3 4 $(".js-slider-quotes").each(function() { 5 var quotes = $(this).find('.js-slider-quote'); 6 if (quotes.length > 1) { 7 $(this).slick({ 8 dots: true, 9 dotsClass: 'slick-dots c-quotes__dots', 10 ease: 'ease-in-out', 11 arrows: true, 12 infinite: true, 13 autoplay: true, 14 autoplaySpeed: 5000, 15 slidesToShow: 1, 16 prevArrow: '<svg class="icon svg-chevron-left-dims o-arrow o-arrow--square o-arrow--prev" width="100%" height="100%" preserveAspectRatio="xMinYMid" viewBox="0 0 41 30" role="img"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/typo3conf/ext/t23_theme/Resources/Public/Icons/symbol/icons-symbols.svg#icon-chevron-small"></use></svg>', 17 nextArrow:'<svg class="icon svg-chevron-right-dims o-arrow o-arrow--square o-arrow--next" width="100%" height="100%" preserveAspectRatio="xMinYMid" viewBox="0 0 41 30" role="img"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/typo3conf/ext/t23_theme/Resources/Public/Icons/symbol/icons-symbols.svg#icon-chevron-small"></use></svg>', 18 }); 19 } 20 }); 21 22}); 23/** 24 * Override of repeatable_form_elements because document.readyState is always 'loading' at platzl 25 */ 26document.addEventListener('DOMContentLoaded', () => { 27 var containerClones = {}; 28 29 document.querySelectorAll('[data-repeatable-container][data-is-root]').forEach((rootElement) => { 30 let containerClone = rootElement.cloneNode(true), 31 containerIdentifier = rootElement.dataset['identifier'], 32 formIdentifier = rootElement.closest('form').getAttribute('id'), 33 copyButton = containerClone.querySelector('[data-repeatable-container][data-copy-button]'); 34 35 containerClones[formIdentifier] = containerClones[formIdentifier] || {}; 36 37 for (const copyElement of containerClone.querySelectorAll('[data-repeatable-container][data-is-copy]')) { 38 copyElement.remove(); 39 } 40 if (copyButton !== null) { 41 copyButton.remove(); 42 } 43 for (const alertElement of containerClone.querySelectorAll('[role="alert"]')) { 44 alertElement.remove(); 45 } 46 47 containerClone.querySelectorAll('[data-repeatable-container][data-is-root]').forEach((cloneElement) => { 48 delete cloneElement.dataset.isRoot; 49 cloneElement.dataset.isCopy = ''; 50 cloneElement.dataset.copyMother = cloneElement.dataset['identifier']; 51 }); 52 delete containerClone.dataset.isRoot; 53 containerClone.dataset.isCopy = ''; 54 containerClone.querySelectorAll('*').forEach((cloneChildElement) => { 55 cloneChildElement.classList.remove('has-error'); 56 }); 57 58 let inputs = [...containerClone.querySelectorAll('input')]; 59 inputs.filter((input) => ['checkbox', 'radio', 'hidden'].indexOf(input.getAttribute('type')) == -1).forEach((inputElement) => { 60 inputElement.setAttribute('value', ''); 61 }); 62 inputs.filter((input) => ['file'].indexOf(input.getAttribute('type')) >= 0).forEach((inputElement) => { 63 [...inputElement.parentNode.children].filter((child) => child !== inputElement).forEach((siblingElement) => { 64 siblingElement.remove(); 65 }); 66 }); 67 inputs.filter((input) => ['checkbox', 'radio'].indexOf(input.getAttribute('type')) >= 0).forEach((inputElement) => { 68 inputElement.checked = false; 69 }); 70 containerClone.querySelectorAll('textarea').forEach((textareaElement) => { 71 textareaElement.setAttribute('value', ''); 72 }); 73 containerClone.querySelectorAll('select').forEach((selectElement) => { 74 let selected = selectElement.selectedOptions; 75 for (let i = 0; i < selected.length; i++) { 76 selected[i].removeAttribute('selected'); 77 } 78 selectElement.selectedIndex = -1; 79 }); 80 81 containerClones[formIdentifier][containerIdentifier] = containerClone; 82 }); 83 84 document.dispatchEvent(new CustomEvent('initialize-repeatable-container-copy-buttons', { 'detail': { 'containerClones': containerClones } })); 85 document.dispatchEvent(new CustomEvent('initialize-repeatable-container-remove-buttons')); 86}); 87 88document.addEventListener('initialize-repeatable-container-copy-buttons', (copyEvent) => {
89 let containerClones = copyEvent.detail.containerClones, 90 getNextCopyNumber = (referenceElement, formElement) => { 91 let highestCopyNumber = 0; 92 93 formElement.querySelectorAll('[data-repeatable-container][data-copy-reference="' + referenceElement.dataset['identifier'] + '"]').forEach((copyElement) => { 94 let copyNumber = parseInt(copyElement.dataset['identifier'].split('.').pop()); 95 96 if (copyNumber > highestCopyNumber) { 97 highestCopyNumber = copyNumber; 98 } 99 }); 100 101 return ++highestCopyNumber; 102 }, 103 setRandomIds = (subject) => { 104 let idReplacements = {}; 105 106 subject.querySelectorAll('[id]').forEach((subjectIdElement) => { 107 let id = subjectIdElement.getAttribute('id'), 108 newId = Math.floor(Math.random() * 99999999) + Date.now(); 109 110 subjectIdElement.setAttribute('id', newId); 111 idReplacements[id] = newId; 112 }); 113 114 subject.querySelectorAll('*').forEach((subjectChildElement) => { 115 for (let i = 0, len = subjectChildElement.attributes.length; i < len; i++) { 116 let attributeValue = subjectChildElement.attributes[i].nodeValue; 117 118 if (attributeValue in idReplacements) { 119 subjectChildElement.attributes[i].nodeValue = idReplacements[attributeValue]; 120 } 121 } 122 }); 123 }, 124 escapeRegExp = (subject) => { 125 return subject.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); 126 }; 127 128 document.querySelectorAll('[data-repeatable-container][data-copy-button]').forEach((copyBtnElement) => { 129 let formElement = copyBtnElement.closest('form'), 130 referenceElementIdentifier = copyBtnElement.dataset['copyButtonFor'], 131 referenceElement = formElement.querySelector('[data-repeatable-container][data-identifier="' + referenceElementIdentifier + '"]'), 132 elementCopies = formElement.querySelectorAll('[data-repeatable-container][data-copy-reference="' + referenceElementIdentifier + '"]'), 133 maxCopies = referenceElement.dataset['maxCopies'] || false; 134 135 if (maxCopies && elementCopies.length >= maxCopies) { 136 copyBtnElement.disabled = true; 137 } else { 138 copyBtnElement.disabled = false; 139 /* clone element to remove all event listeners */ 140 let copyBtnElementClone = copyBtnElement.cloneNode(true); 141 copyBtnElement.replaceWith(copyBtnElementClone); 142 copyBtnElementClone.addEventListener('click', (clickEvent) => { 143 clickEvent.preventDefault(); 144 let clickElement = clickEvent.currentTarget, 145 clickFormElement = clickElement.closest('form'), 146 referenceElementIdentifier = clickElement.dataset['copyButtonFor'], 147 formIdentifier = clickFormElement.getAttribute('id'), 148 referenceElement = clickFormElement.querySelector('[data-repeatable-container][data-identifier="' + referenceElementIdentifier + '"]'), 149 referenceElementIsRoot = 'isRoot' in referenceElement.dataset, 150 elementCopies = clickFormElement.querySelectorAll('[data-repeatable-container][data-copy-reference="' + referenceElementIdentifier + '"]'), 151 containerCloneIdentifier = referenceElementIsRoot ? referenceElementIdentifier : referenceElement.dataset['copyMother'], 152 copyMotherIdentifier = containerClones[formIdentifier][containerCloneIdentifier].dataset['identifier'], 153 newIdentifierParts = referenceElement.dataset['identifier'].split('.'), 154 oldIdentifierNameRegex = escapeRegExp('[' + copyMotherIdentifier.split('.').join('][') + ']'), 155 copyMotherIdentifierRegex = '(' + escapeRegExp('data-copy-mother="') + ')?' + escapeRegExp(copyMotherIdentifier), 156 newIdentifier = undefined, 157 newIdentifierNameRegex = undefined, 158 containerClone = undefined, 159 containerCloneHtml = undefined; 160 161 newIdentifierParts.pop(); 162 newIdentifierParts.push(getNextCopyNumber(referenceElement, clickFormElement)); 163 newIdentifier = newIdentifierParts.join('.'); 164 165 containerCloneHtml = containerClones[formIdentifier][containerCloneIdentifier].outerHTML; 166 // leading, negative lookbehind ("?<!") 167 containerCloneHtml = containerCloneHtml.replace(new RegExp(copyMotherIdentifierRegex, 'g'), ($0, $1) => { 168 return $1 ? $0 : newIdentifier; 169 }); 170 171 newIdentifierNameRegex = '[' + newIdentifierParts.join('][') + ']'; 172 containerCloneHtml = containerCloneHtml.replace(new RegExp(oldIdentifierNameRegex, 'g'), newIdentifierNameRegex); 173 174 let containerCloneWrap = document.createElement('div'); 175 containerCloneWrap.innerHTML = containerCloneHtml; 176 containerClone = containerCloneWrap.firstChild; 177 containerClone.dataset.copyReference = referenceElementIdentifier; 178 179 setRandomIds(containerClone); 180 181 if (elementCopies.length === 0) { 182 referenceElement.after(containerClone); 183 } else { 184 [...elementCopies].at(-1).after(containerClone); 185 } 186 187 document.dispatchEvent(new CustomEvent('after-element-copy', { 'detail': { 'containerClone': containerClone } })); 188 document.dispatchEvent(new CustomEvent('initialize-repeatable-container-copy-buttons', { 'detail': { 'containerClones': containerClones } })); 189 document.dispatchEvent(new CustomEvent('initialize-repeatable-container-remove-buttons')); 190 }); 191 } 192 }); 193}); 194 195document.addEventListener('initialize-repeatable-container-remove-buttons', (removeEvent) => { 196 document.querySelectorAll('[data-repeatable-container][data-remove-button]').forEach((removeBtnElement) => { 197 let formElement = removeBtnElement.closest('form'), 198 referenceElementIdentifier = removeBtnElement.dataset['removeButtonFor'], 199 referenceElement = formElement.querySelector('[data-repeatable-container][data-identifier="' + referenceElementIdentifier + '"]'), 200 referenceElementIsRoot = 'isRoot' in referenceElement.dataset, 201 referenceReferenceElementIdentifier = referenceElementIsRoot ? referenceElementIdentifier : referenceElement.dataset['copyReference'], 202 referenceReferenceElement = formElement.querySelector('[data-repeatable-container][data-identifier="' + referenceReferenceElementIdentifier + '"]'), 203 elementCopies = formElement.querySelectorAll('[data-repeatable-container][data-copy-reference="' + referenceReferenceElementIdentifier + '"]'), 204 minCopies = referenceReferenceElement?.dataset['minCopies'] || false; 205 206 if ((referenceElement.dataset['copyReference'] || false) && referenceElement.dataset['copyReference'] !== '') { 207 if (minCopies && elementCopies.length <= minCopies) { 208 // removeBtnElement.classList.remove('d-none'); 209 removeBtnElement.disabled = true; 210 } else { 211 // removeBtnElement.classList.remove('d-none'); 212 removeBtnElement.disabled = false;
213 } 214 } else { 215 removeBtnElement.remove(); 216 } 217 218 if (removeBtnElement.disabled) { 219 /* clone element to remove all event listeners */ 220 removeBtnElement.replaceWith(removeBtnElement.cloneNode(true)); 221 } else { 222 /* clone element to remove all event listeners */ 223 let removeBtnElementClone = removeBtnElement.cloneNode(true); 224 removeBtnElement.replaceWith(removeBtnElementClone); 225 removeBtnElementClone.addEventListener('click', (clickEvent) => { 226 clickEvent.preventDefault(); 227 228 let clickElement = clickEvent.currentTarget, 229 clickFormElement = clickElement.closest('form'), 230 referenceElementIdentifier = clickElement.dataset['removeButtonFor'], 231 referenceElement = clickFormElement.querySelector('[data-repeatable-container][data-identifier="' + referenceElementIdentifier + '"]'), 232 referenceElementIsRoot = 'isRoot' in referenceElement.dataset, 233 referenceReferenceElementIdentifier = referenceElementIsRoot ? referenceElementIdentifier : referenceElement.dataset['copyReference'], 234 referenceReferenceElement = clickFormElement.querySelector('[data-repeatable-container][data-identifier="' + referenceReferenceElementIdentifier + '"]'), 235 elementCopies = clickFormElement.querySelectorAll('[data-repeatable-container][data-copy-reference="' + referenceReferenceElementIdentifier + '"]'), 236 maxCopies = referenceReferenceElement?.dataset['maxCopies'] || false, 237 copyButton = clickFormElement.querySelector('[data-repeatable-container][data-copy-button-for="' + referenceReferenceElementIdentifier + '"]'); 238 239 if (maxCopies && elementCopies.length - 1 < maxCopies) { 240 copyButton.disabled = false; 241 } 242 243 referenceElement.remove(); 244 document.dispatchEvent(new CustomEvent('initialize-repeatable-container-remove-buttons')); 245 }); 246 } 247 }); 248}); 249 250/** 251 * Enhance event request form by toggling certain fields based on overnight stay selection 252 */ 253(function () { 254 const overnightRadioButtons = document.querySelectorAll('input[name*="overnight"]'); 255 const gridRows = document.querySelectorAll('[id*="gridrow-8"], [id*="gridrow-9"]'); 256 257 if (overnightRadioButtons.length === 0 || gridRows.length === 0) { 258 return; 259 } 260 261 // Initially hide the rows 262 hideRows(true); 263 264 // If 'yes' is selected on page load, keep the rows visible 265 if (document.querySelector('input[name*="overnight"]:checked')?.value === 'yes') { 266 hideRows(false); 267 } 268 269 overnightRadioButtons.forEach((radio) => { 270 radio.addEventListener('change', (e) => hideRows(e.target.value === 'no')); 271 }); 272 273 function hideRows(visible) { 274 gridRows.forEach((row) => row.hidden = visible); 275 } 276})(); 277 278/** 279 * Enhance event request form by filling hidden date inputs before submission 280 */ 281(function () { 282 const form = document.querySelector('form[id*="eventRequest-"]'); 283 284 if (!form) return; 285 286 form.addEventListener('submit', (e) => { 287 e.currentTarget.querySelectorAll('.repeatable-container').forEach((container) => { 288 const dateInput = container.querySelector('input[name*="dates-date"]'); 289 const startInput = container.querySelector('input[name*="dates-start"]'); 290 const endInput = container.querySelector('input[name*="dates-end"]'); 291 292 startInput.value = dateInput.value; 293 endInput.value = dateInput.value; 294 }); 295 }); 296})();
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.