| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | |
| 7 | 7 | (function ($) { |
| 8 | 8 | let zone_index = 0; |
| 9 | 9 | |
| 10 | - $('.add_cdn_hostname').click(function (e) { | |
| 10 | + $(document).on('click', '.add_cdn_hostname', function (e) { | |
| 11 | 11 | e.preventDefault(); |
| 12 | 12 | let ref_el = $('.cdn-zone:first').clone(); |
| 13 | 13 | |
| 14 | 14 | if (zone_index === 0) { |
| @@ -53,8 +53,16 @@ | ||
| 53 | 53 | $('#preload_page_cache_warning_message').show(); |
| 54 | 54 | } |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | + $('#cloudflare-api-token').on('keyup keypress change', function () { | |
| 58 | + if ($(this).val().length > 0) { | |
| 59 | + $('#cloudflare-api-details').hide(); | |
| 60 | + } else { | |
| 61 | + $('#cloudflare-api-details').show(); | |
| 62 | + } | |
| 63 | + }); | |
| 64 | + | |
| 57 | 65 | $('.heartbeat_dashboard_status').on('change', function () { |
| 58 | 66 | if ($(this).val() === 'modify') { |
| 59 | 67 | $('#heartbeat-dashboard-interval').show(); |
| 60 | 68 | } else { |
| @@ -92,5 +100,73 @@ | ||
| 92 | 100 | |
| 93 | 101 | $('#powered-cache-import-remove-file').on('click', function () { |
| 94 | 102 | $('#powered-cache-import-file-input').val('').trigger('change'); |
| 95 | 103 | }); |
| 104 | + | |
| 105 | + $('#js_execution_method').on('change', function (e) { | |
| 106 | + if ('blocking' !== $(this).val()) { | |
| 107 | + $('#js_execution_exclusions_field').show(); | |
| 108 | + } else { | |
| 109 | + $('#js_execution_exclusions_field').hide(); | |
| 110 | + } | |
| 111 | + }); | |
| 112 | + | |
| 113 | + $('#js_delay').on('change', function () { | |
| 114 | + if ($(this).is(':checked')) { | |
| 115 | + $('#combine_js').prop("checked", false).prop("disabled", true); | |
| 116 | + }else{ | |
| 117 | + if( $('#minify_js').is(':checked') ){ | |
| 118 | + $('#combine_js').prop("disabled", false); | |
| 119 | + } | |
| 120 | + } | |
| 121 | + }); | |
| 122 | + | |
| 123 | + $('#minify_js').on('change', function () { | |
| 124 | + if ($(this).is(':checked') && !$('#js_delay').is(':checked')) { | |
| 125 | + $('#combine_js').prop("disabled", false); | |
| 126 | + }else{ | |
| 127 | + $('#combine_js').prop("disabled", true); | |
| 128 | + } | |
| 129 | + }); | |
| 130 | + | |
| 131 | + $('#object_cache').on('change', function () { | |
| 132 | + // Check if new selection is memcached or memcache | |
| 133 | + if ($(this).val() === 'memcached' || $(this).val() === 'memcache') { | |
| 134 | + $.ajax({ | |
| 135 | + url : ajaxurl, | |
| 136 | + method: 'post', | |
| 137 | + data : { | |
| 138 | + nonce : $('#powered_cache_settings_nonce').val(), | |
| 139 | + action: 'powered_cache_check_alloptions', | |
| 140 | + }, | |
| 141 | + success(response) { | |
| 142 | + if (response.success && response.data.status) { | |
| 143 | + let $alloptionsContainer = $('#object_cache_alloptions_message'); | |
| 144 | + | |
| 145 | + if (response.data.status === 'success') { | |
| 146 | + return; | |
| 147 | + } | |
| 148 | + | |
| 149 | + let statusClass = 'sui-notice-warning'; // Default to warning | |
| 150 | + | |
| 151 | + if (response.data.status === 'critical') { | |
| 152 | + statusClass = 'sui-notice-error'; // Change to error if critical | |
| 153 | + } | |
| 154 | + | |
| 155 | + $alloptionsContainer.addClass(statusClass); | |
| 156 | + | |
| 157 | + let message = '<span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span>'; | |
| 158 | + message += response.data.message; | |
| 159 | + | |
| 160 | + $alloptionsContainer.find('.sui-notice-message').html(message); | |
| 161 | + $alloptionsContainer.removeClass('sui-hidden'); | |
| 162 | + $alloptionsContainer.show(); | |
| 163 | + } | |
| 164 | + }, | |
| 165 | + }); | |
| 166 | + } else { | |
| 167 | + $('#object_cache_alloptions_message').hide(); | |
| 168 | + } | |
| 169 | + }); | |
| 170 | + | |
| 171 | + | |
| 96 | 172 | })(jQuery); |