gutenberg
3 years ago
debug-page.js
3 years ago
jquery.tipTip.js
4 years ago
multiple-page.js
3 years ago
network-settings-page.js
3 years ago
prior-consent-settings.js
3 years ago
settings-page.js
3 years ago
support-page.js
3 years ago
network-settings-page.js
47 lines
| 1 | jQuery( document ).ready( function ( $ ) { |
| 2 | let cookieBlockingMode = cookiebotNetworkSettings.cbm |
| 3 | $( 'input[type=radio][name=cookiebot-cookie-blocking-mode]' ).on( 'change', function () { |
| 4 | if ( this.value === 'auto' && cookieBlockingMode !== this.value ) { |
| 5 | $( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 ) |
| 6 | $( '#declaration-tag').addClass('disabled__item'); |
| 7 | $( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true ) |
| 8 | } |
| 9 | if ( this.value === 'manual' && cookieBlockingMode !== this.value ) { |
| 10 | $( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 1 ) |
| 11 | $( '#declaration-tag, #cookie-popup').removeClass('disabled__item'); |
| 12 | $( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', false ) |
| 13 | } |
| 14 | cookieBlockingMode = this.value |
| 15 | } ) |
| 16 | if ( cookieBlockingMode === 'auto' ) { |
| 17 | $( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 ) |
| 18 | $( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true ) |
| 19 | } |
| 20 | |
| 21 | jQuery('.cb-submit__msg').on('click',function(){ |
| 22 | jQuery(this).addClass('hidden'); |
| 23 | }); |
| 24 | |
| 25 | const initialValues = jQuery('form').serialize(); |
| 26 | const events = { |
| 27 | change: 'input:not([type=text]), select', |
| 28 | input: 'input[type="text"], textarea' |
| 29 | }; |
| 30 | |
| 31 | Object.entries(events).forEach(entry => { |
| 32 | const [eventName, elements] = entry; |
| 33 | jQuery(document).on(eventName,elements,{initialValues: initialValues},function(event){ |
| 34 | checkValues(event.data.initialValues) |
| 35 | }); |
| 36 | }); |
| 37 | } ) |
| 38 | |
| 39 | function checkValues(initialValues){ |
| 40 | let submitBtn = jQuery('p.submit #submit'); |
| 41 | let newValues = jQuery('form').serialize(); |
| 42 | if(newValues !== initialValues) { |
| 43 | submitBtn.addClass('enabled'); |
| 44 | }else{ |
| 45 | submitBtn.removeClass('enabled'); |
| 46 | } |
| 47 | } |