Cdnfsd_StackPath_Page_View.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. jQuery(function($) {
  2. function w3tc_stackpath_fsd_resize(o) {
  3. o.resize();
  4. }
  5. $('body')
  6. .on('click', '.w3tc_cdn_stackpath_fsd_authorize', function() {
  7. W3tc_Lightbox.open({
  8. id:'w3tc-overlay',
  9. close: '',
  10. width: 800,
  11. height: 300,
  12. url: ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce +
  13. '&w3tc_action=cdn_stackpath_fsd_intro',
  14. callback: w3tc_stackpath_fsd_resize
  15. });
  16. })
  17. .on('click', '.w3tc_cdn_stackpath_fsd_list_zones', function() {
  18. var url = ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce +
  19. '&w3tc_action=cdn_stackpath_fsd_list_zones';
  20. var v = $('.w3tc_popup_form').find('input').each(function(i) {
  21. var name = $(this).attr('name');
  22. if (name)
  23. url += '&' + encodeURIComponent(name) + '=' +
  24. encodeURIComponent($(this).val());
  25. });
  26. W3tc_Lightbox.load(url, w3tc_stackpath_fsd_resize);
  27. })
  28. .on('click', '.w3tc_cdn_stackpath_fsd_view_zone', function() {
  29. var url = ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce +
  30. '&w3tc_action=cdn_stackpath_fsd_view_zone';
  31. var v = $('.w3tc_popup_form').find('input').each(function(i) {
  32. var name = $(this).attr('name');
  33. var type = $(this).attr('type');
  34. if (type == 'radio') {
  35. if (!$(this).prop('checked'))
  36. return;
  37. }
  38. if (name)
  39. url += '&' + encodeURIComponent(name) + '=' +
  40. encodeURIComponent($(this).val());
  41. });
  42. W3tc_Lightbox.load(url, w3tc_stackpath_fsd_resize);
  43. })
  44. .on('click', '.w3tc_cdn_stackpath_fsd_configure_zone', function() {
  45. var url = ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce +
  46. '&w3tc_action=cdn_stackpath_fsd_configure_zone';
  47. var v = $('.w3tc_popup_form').find('input').each(function(i) {
  48. var name = $(this).attr('name');
  49. if (name)
  50. url += '&' + encodeURIComponent(name) + '=' +
  51. encodeURIComponent($(this).val());
  52. });
  53. W3tc_Lightbox.load(url, w3tc_stackpath_fsd_resize);
  54. })
  55. .on('click', '.w3tc_cdn_stackpath_fsd_configure_zone_skip', function() {
  56. var url = ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce +
  57. '&w3tc_action=cdn_stackpath_fsd_configure_zone_skip';
  58. var v = $('.w3tc_popup_form').find('input').each(function(i) {
  59. var name = $(this).attr('name');
  60. if (name)
  61. url += '&' + encodeURIComponent(name) + '=' +
  62. encodeURIComponent($(this).val());
  63. });
  64. W3tc_Lightbox.load(url, w3tc_stackpath_fsd_resize);
  65. })
  66. .on('click', '.w3tc_cdn_stackpath_fsd_done', function() {
  67. // refresh page
  68. window.location = window.location + '&';
  69. })
  70. .on('size_change', '#cdn_cname_add', function() {
  71. w3tc_stackpath_fsd_resize(W3tc_Lightbox);
  72. })
  73. });