1(($, Drupal) => { 2 /** 3 * Provide the summary information for the tracking settings vertical tabs. 4 */ 5 Drupal.behaviors.trackingSettingsSummary = { 6 attach(context) { 7 // Make sure this behavior is processed only if drupalSetSummary is defined. 8 if (typeof jQuery.fn.drupalSetSummary === 'undefined') { 9 return; 10 } 11 12 $('#edit-page-visibility-settings', context).drupalSetSummary( 13 (context) => { 14 const $radio = $( 15 'input[name="matomo_visibility_request_path_mode"]:checked', 16 context, 17 ); 18 if ($radio.val() === '0') { 19 if ( 20 !$( 21 'textarea[name="matomo_visibility_request_path_pages"]', 22 context, 23 ).val() 24 ) { 25 return Drupal.t('Not restricted'); 26 } 27 28 return Drupal.t('All pages with exceptions'); 29 } 30 31 return Drupal.t('Restricted to certain pages'); 32 }, 33 ); 34 35 $('#edit-role-visibility-settings', context).drupalSetSummary( 36 (context) => { 37 const vals = []; 38 // eslint-disable-next-line func-names 39 $('input[type="checkbox"]:checked', context).each(function () { 40 vals.push($(this).next('label').html().trim()); 41 }); 42 if (!vals.length) { 43 return Drupal.t('Not restricted'); 44 } 45 if ( 46 $( 47 'input[name="matomo_visibility_user_role_mode"]:checked', 48 context, 49 ).val() === '1' 50 ) { 51 return Drupal.t('Excepted: @roles', { '@roles': vals.join(', ') }); 52 } 53 54 return vals.join(', '); 55 }, 56 ); 57 58 $('#edit-user-visibility-settings', context).drupalSetSummary( 59 (context) => { 60 const $radio = $( 61 'input[name="matomo_visibility_user_account_mode"]:checked', 62 context, 63 ); 64 if ($radio.val() === '0') { 65 return Drupal.t('Not customizable'); 66 } 67 if ($radio.val() === '1') { 68 return Drupal.t('On by default with opt out'); 69 } 70 71 return Drupal.t('Off by default with opt in'); 72 }, 73 ); 74 75 $('#edit-linktracking', context).drupalSetSummary((context) => { 76 const vals = []; 77 if ($('input#edit-matomo-trackmailto', context).is(':checked')) { 78 vals.push(Drupal.t('Mailto links')); 79 } 80 if ($('input#edit-matomo-trackfiles', context).is(':checked')) { 81 vals.push(Drupal.t('Outbound links')); 82 vals.push(Drupal.t('Downloads')); 83 } 84 if ($('input#edit-matomo-trackcolorbox', context).is(':checked')) { 85 vals.push(Drupal.t('Colorbox')); 86 } 87 if (!vals.length) { 88 return Drupal.t('Not tracked'); 89 } 90 return Drupal.t('@items enabled', { '@items': vals.join(', ') }); 91 }); 92 93 $('#edit-messagetracking', context).drupalSetSummary((context) => { 94 const vals = []; 95 // eslint-disable-next-line func-names 96 $('input[type="checkbox"]:checked', context).each(function () { 97 vals.push($(this).next('label').html().trim()); 98 }); 99 if (!vals.length) { 100 return Drupal.t('Not tracked'); 101 } 102 return Drupal.t('@items enabled', { '@items': vals.join(', ') }); 103 }); 104 105 $('#edit-search', context).drupalSetSummary((context) => { 106 const vals = []; 107 if ($('input#edit-matomo-site-search', context).is(':checked')) { 108 vals.push(Drupal.t('Site search')); 109 } 110 if (!vals.length) { 111 return Drupal.t('Not tracked'); 112 } 113 return Drupal.t('@items enabled', { '@items': vals.join(', ') }); 114 }); 115 116 $('#edit-domain-tracking', context).drupalSetSummary((context) => { 117 const $radio = $('input[name="matomo_domain_mode"]:checked', context); 118 if ($radio.val() === '0') { 119 return Drupal.t('A single domain'); 120 } 121 if ($radio.val() === '1') { 122 return Drupal.t('One domain with multiple subdomains'); 123 } 124 }); 125 126 $('#edit-page-title-hierarchy', context).drupalSetSummary((context) => { 127 const vals = []; 128 if ( 129 $('input#edit-matomo-page-title-hierarchy', context).is(':checked') 130 ) { 131 vals.push(Drupal.t('Show page titles')); 132 } 133 if ( 134 $('input#edit-matomo-page-title-hierarchy-exclude-home', context).is( 135 ':checked', 136 ) 137 ) { 138 vals.push(Drupal.t('Hide home page')); 139 } 140 if (!vals.length) { 141 return Drupal.t('Not tracked'); 142 } 143 return Drupal.t('@items enabled', { '@items': vals.join(', ') }); 144 }); 145 146 $('#edit-status-codes', context).drupalSetSummary((context) => { 147 const vals = []; 148 if ($('input#edit-status-codes-disabled-404', context).is(':checked')) { 149 vals.push(Drupal.t('404')); 150 } 151 if ($('input#edit-status-codes-disabled-403', context).is(':checked')) { 152 vals.push(Drupal.t('403')); 153 } 154 if (!vals.length) { 155 return Drupal.t('Default'); 156 } 157 return Drupal.t('@items disabled', { '@items': vals.join(', ') }); 158 }); 159 160 $('#edit-privacy', context).drupalSetSummary((context) => { 161 const vals = []; 162 if ($('input#edit-matomo-privacy-donottrack', context).is(':checked')) { 163 vals.push(Drupal.t('Universal web tracking opt-out enabled')); 164 } 165 if ( 166 $('input#edit-matomo-privacy-disablecookies', context).is(':checked') 167 ) { 168 vals.push(Drupal.t('Cookies disabled')); 169 } 170 if (!vals.length) { 171 return Drupal.t('No privacy'); 172 } 173 return Drupal.t('@items', { '@items': vals.join(', ') }); 174 }); 175 }, 176 }; 177})(jQuery, Drupal);
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.