gutenberg
4 years ago
debug-page.js
4 years ago
jquery.tipTip.js
4 years ago
network-settings-page.js
4 years ago
prior-consent-settings.js
4 years ago
settings-page.js
4 years ago
settings-page.js
74 lines
| 1 | /** |
| 2 | * Load init function when the page is ready |
| 3 | * |
| 4 | * @since 1.8.0 |
| 5 | */ |
| 6 | jQuery( document ).ready( init ); |
| 7 | |
| 8 | function init() { |
| 9 | language_toggle(); |
| 10 | advanced_settings_toggle(); |
| 11 | cookie_blocking_mode(); |
| 12 | } |
| 13 | |
| 14 | function language_toggle() { |
| 15 | jQuery( '#show_add_language_guide' ).on( 'click', function ( e ) { |
| 16 | e.preventDefault() |
| 17 | jQuery( '#add_language_guide' ).slideDown() |
| 18 | jQuery( this ).hide() |
| 19 | } ) |
| 20 | jQuery( '#hide_add_language_guide' ).on( 'click', function ( e ) { |
| 21 | e.preventDefault() |
| 22 | jQuery( '#add_language_guide' ).slideUp() |
| 23 | jQuery( '#show_add_language_guide' ).show() |
| 24 | } ) |
| 25 | |
| 26 | jQuery( '#cookiebot-language' ).on( 'change', function () { |
| 27 | if ( this.value === '' ) { |
| 28 | jQuery( '#info_lang_autodetect' ).show() |
| 29 | jQuery( '#info_lang_specified' ).hide() |
| 30 | } else { |
| 31 | jQuery( '#info_lang_autodetect' ).hide() |
| 32 | jQuery( '#info_lang_specified' ).show() |
| 33 | } |
| 34 | } ) |
| 35 | } |
| 36 | |
| 37 | function advanced_settings_toggle() { |
| 38 | jQuery( '.cookiebot_fieldset_header' ).on( 'click', function ( e ) { |
| 39 | e.preventDefault() |
| 40 | jQuery( this ).next().slideToggle() |
| 41 | jQuery( this ).toggleClass( 'active' ) |
| 42 | } ) |
| 43 | } |
| 44 | |
| 45 | function resetConsentMapping() { |
| 46 | if ( confirm( 'Are you sure you want to reset to default consent mapping?' ) ) { |
| 47 | jQuery( '.consent_mapping_table input[type=checkbox]' ).each( function () { |
| 48 | if ( !this.disabled ) { |
| 49 | this.checked = ( jQuery( this ).data( 'default-value' ) === '1' ) |
| 50 | } |
| 51 | } ) |
| 52 | } |
| 53 | return false |
| 54 | } |
| 55 | |
| 56 | function cookie_blocking_mode() { |
| 57 | var cookieBlockingMode = cookiebot_settings.cookieBlockingMode; |
| 58 | |
| 59 | jQuery( 'input[type=radio][name=cookiebot-cookie-blocking-mode]' ).on( 'change', function () { |
| 60 | if ( this.value === 'auto' && cookieBlockingMode !== this.value ) { |
| 61 | jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 ) |
| 62 | jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true ) |
| 63 | } |
| 64 | if ( this.value === 'manual' && cookieBlockingMode !== this.value ) { |
| 65 | jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 1 ) |
| 66 | jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', false ) |
| 67 | } |
| 68 | cookieBlockingMode = this.value |
| 69 | } ) |
| 70 | if ( cookieBlockingMode === 'auto' ) { |
| 71 | jQuery( '#cookiebot-setting-async, #cookiebot-setting-hide-popup' ).css( 'opacity', 0.4 ) |
| 72 | jQuery( 'input[type=radio][name=cookiebot-script-tag-uc-attribute], input[name=cookiebot-nooutput]' ).prop( 'disabled', true ) |
| 73 | } |
| 74 | } |