| 1 |
function powered_cache_clone_cdn_item() { |
| 2 |
|
| 3 |
var $html = jQuery('.primary-cdn-zone').clone(); |
| 4 |
$html.removeClass('primary-cdn-zone'); |
| 5 |
|
| 6 |
// reset value for edit screen |
| 7 |
$html.find('input').val(''); |
| 8 |
$html.find('select').val('all'); |
| 9 |
$html.append('<span class="dashicons dashicons-no remove-cdn-item" ></span>'); |
| 10 |
jQuery('#cdn-zones').append($html); |
| 11 |
|
| 12 |
return false; |
| 13 |
} |
| 14 |
|
| 15 |
function powered_cache_remove_cdn_item() { |
| 16 |
console.log('tikladim'); |
| 17 |
var el = jQuery(this).parents('.cdn-zone'); |
| 18 |
console.log(el); |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
jQuery(document).ready(function ($) { |
| 23 |
|
| 24 |
$('body').on('click', '.remove-cdn-item', function () { |
| 25 |
$(this).parent().remove(); |
| 26 |
}); |
| 27 |
|
| 28 |
$('#powered_cache_mobile_cache').change(function () { |
| 29 |
if (this.checked) { |
| 30 |
$('#separate-mobile-cache').fadeIn('slow'); |
| 31 |
} else { |
| 32 |
$('#separate-mobile-cache').fadeOut('slow'); |
| 33 |
} |
| 34 |
}); |
| 35 |
|
| 36 |
|
| 37 |
$("#powered-cache-support-btn").click(function () { |
| 38 |
var serialized_data = $('#powered-cache-settings-form').serializeArray(); |
| 39 |
var $submit_btn = $("#powered-cache-support-btn"); |
| 40 |
|
| 41 |
$submit_btn.attr('disabled', 'disabled'); |
| 42 |
|
| 43 |
var data = { |
| 44 |
action : 'powered_cache_support_request', |
| 45 |
nonce : powered_cache_vars.nonce, |
| 46 |
form_data: serialized_data |
| 47 |
}; |
| 48 |
|
| 49 |
//the_ajax_script.ajaxurl is a variable that will contain the url to the ajax processing file |
| 50 |
$.post( powered_cache_vars.ajaxurl, data, function (response) { |
| 51 |
resp = JSON.parse(response); |
| 52 |
$submit_btn.removeAttr('disabled'); |
| 53 |
|
| 54 |
var $placeholder = $('#form-message-placeholder'); |
| 55 |
|
| 56 |
if (resp.success == false) { |
| 57 |
$placeholder.addClass('error'); |
| 58 |
} else { |
| 59 |
$placeholder.addClass('updated'); |
| 60 |
$('#support-form-table').hide(); |
| 61 |
} |
| 62 |
|
| 63 |
$placeholder.html('<p>' + resp.msg + '</p>'); |
| 64 |
}); |
| 65 |
return false; |
| 66 |
}); |
| 67 |
|
| 68 |
}); |
| 69 |
|
| 70 |
|
| 71 |
|