| 1 |
'use strict'; |
| 2 |
(window => { |
| 3 |
jQuery('#cb-consent-api-reset-defaults').on('click',resetConsentMapping); |
| 4 |
function resetConsentMapping() { |
| 5 |
if ( confirm( 'Are you sure you want to reset to default consent mapping?' ) ) { |
| 6 |
const resetButton = jQuery(this); |
| 7 |
if(resetButton.hasClass('uc-consent')){ |
| 8 |
const categorySelectors = jQuery('.cb-category-selectors'); |
| 9 |
categorySelectors.each(function(){ |
| 10 |
const defaultCategory = jQuery(this).attr('data-default'); |
| 11 |
jQuery(this).val(defaultCategory).change(); |
| 12 |
}); |
| 13 |
} else { |
| 14 |
jQuery('.cb-settings__consent__mapping-table input[type=checkbox]').each(function () { |
| 15 |
if (!jQuery(this).prop('disabled')) { |
| 16 |
jQuery(this).prop('checked', jQuery(this).data('default-value')); |
| 17 |
} |
| 18 |
}) |
| 19 |
} |
| 20 |
jQuery('p.submit #submit').addClass('enabled'); |
| 21 |
} |
| 22 |
} |
| 23 |
})(window); |