1(function ($) { 2 3 var PANDAMODAL = PANDAMODAL || {}, 4 5 PANDAMODAL = { 6 7 _: function () { 8 this.banner._(); 9 }, 10 11 banner: 12 { 13 //****************************// 14 //* Settings for Consent *****// 15 //****************************// 16 options: 17 { 18 selector: 19 { 20 bannerClass: '.banner', 21 settingsButton: '#tx-panda-modal-banner-open-settings', 22 acceptAllSettingsButton: 'button[type="accept-all"]', 23 acceptButton: 'button[type="submit"]', 24 formFieldSelector: '[name*="tx_pandamodal_handlebanner[consent]"]', 25 } 26 }, 27 28 _: function () 29 { 30 // variables 31 var options = this.options, 32 self = this, 33 banners = $(options.selector.bannerClass), 34 numberOfBanners = banners.length; 35 36 // check if banners even exist 37 if (numberOfBanners =! 0) { 38 $(banners).each(function() { 39 40 var banner = $(this); 41 42 // Check for settings-button on each banner 43 // Add eventlistener to open additional settings 44 // ************************************************************************************* 45 banner.find(options.selector.settingsButton).on('click', function() { 46 47 target = '#' + $(this).attr('data-target'); 48 $(target).attr('data-state', 'maximized'); 49 return false; 50 }); 51 52 // Accept all optional cookies if button "Accept All" is clicked 53 // Submit, BUT we need to toggle all optional checkboxes first 54 // ************************************************************************************* 55 banner.find(options.selector.acceptAllSettingsButton).on('click', function() { 56 57 var button = $(this), 58 form = button.closest('form'), 59 checkboxes = banner.find(options.selector.formFieldSelector); 60 61 self.toggleConsentCheckboxes(checkboxes); 62 self.submitForm(form); 63 64 return false; 65 }); 66 67 // Standard-Accept without settings to choose from 68 // Also called on condition_banner with optional cookies 69 // ************************************************************************************* 70 banner.find(options.selector.acceptButton).on('click', function(){ 71 72 var button = $(this), 73 form = button.closest('form'); 74 75 self.submitForm(form); 76 return false; 77 }); 78 }); 79 } 80 }, 81 82 // sets all checkboxes to 83 toggleConsentCheckboxes: function(checkboxes) { 84 85 if (checkboxes.length > 0) { 86 checkboxes.each(function() { 87 $(this)[0].checked = true; 88 }); 89 } 90 }, 91 92 // ajax call 93 submitForm: function(form) { 94 95 $.post( 96 form.data('ajax'), 97 $(form).serialize(), 98 function(){ 99 // success 100 } 101 ).fail(function(){ 102 console.log("Ajax failed :(") 103 }); 104 105 // refresh page with delay 106 setTimeout(() => { 107 location.reload(); 108 }, 750); 109 }, 110 } 111 } 112 113 PANDAMODAL._(); 114})(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.