Нет описания

optout.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <div id="analyst-opt-out-modal" class="analyst-modal" style="display: none">
  2. <div class="analyst-modal-content" style="width: 600px">
  3. <div class="analyst-disable-modal-mask" id="analyst-disable-opt-out-modal-mask" style="display: none"></div>
  4. <div style="display: flex">
  5. <div class="analyst-install-image-block" style="width: 120px">
  6. <img src="<?=$shieldImage?>"/>
  7. </div>
  8. <div class="analyst-install-description-block">
  9. <strong class="analyst-modal-header">By opting out, we cannot alert you anymore in case of important security updates.</strong>
  10. <p class="analyst-install-description-text">
  11. In addition, we won’t get pointers how to further improve the plugin based on your integration with our plugin.
  12. </p>
  13. </div>
  14. </div>
  15. <div class="analyst-modal-def-top-padding">
  16. <button class="analyst-btn-success opt-out-modal-close">Ok, don't opt out</button>
  17. </div>
  18. <div class="analyst-modal-def-top-padding" style="text-align: center;">
  19. <button class="analyst-btn-secondary-ghost" id="opt-out-action">Opt out</button>
  20. </div>
  21. <div id="analyst-opt-out-error" class="analyst-modal-def-top-padding" style="display: none;">
  22. <span style="color: #dc3232; font-size: 16px">Service unavailable. Please try again later</span>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. <script type="text/javascript">
  28. (function ($) {
  29. var isOptingOut = false
  30. $('#analyst-opt-out-modal').appendTo($('body'))
  31. $(document).on('click', '.analyst-opt-out', function() {
  32. var pluginId = $(this).attr('analyst-plugin-id')
  33. $('#analyst-opt-out-modal')
  34. .attr({'analyst-plugin-id': pluginId})
  35. .show()
  36. })
  37. $('.opt-out-modal-close').click(function () {
  38. $('#analyst-opt-out-modal').hide()
  39. })
  40. $('#opt-out-action').click(function () {
  41. if (isOptingOut) return
  42. var $mask = $('#analyst-disable-opt-out-modal-mask')
  43. var $error = $('#analyst-opt-out-error')
  44. var pluginId = $('#analyst-opt-out-modal').attr('analyst-plugin-id')
  45. $mask.show()
  46. $error.hide()
  47. var self = this
  48. isOptingOut = true
  49. $(self).text('Opting out...')
  50. $.ajax({
  51. url: ajaxurl,
  52. method: 'POST',
  53. data: {
  54. action: 'analyst_opt_out_' + pluginId,
  55. },
  56. success: function (data) {
  57. $(self).text('Opt out')
  58. if (data && !data.success) {
  59. $('#analyst-opt-out-modal').hide()
  60. return
  61. }
  62. $error.hide()
  63. $('#analyst-opt-out-modal').hide()
  64. isOptingOut = false
  65. var optInAction = $('<a />').attr({
  66. class: 'analyst-action-opt analyst-opt-in',
  67. 'analyst-plugin-id': pluginId,
  68. 'analyst-plugin-signed': '1'
  69. })
  70. .text('Opt In')
  71. $('.analyst-opt-out[analyst-plugin-id="'+ pluginId +'"').replaceWith(optInAction)
  72. $('[analyst-plugin-id="' + pluginId + '"').attr('analyst-plugin-opted-in', 0)
  73. $mask.hide()
  74. },
  75. error: function () {
  76. $('#analyst-opt-out-error').show()
  77. $(self).text('Opt out')
  78. }
  79. }).done(function () {
  80. $mask.hide()
  81. isOptingOut = false
  82. })
  83. })
  84. })(jQuery)
  85. </script>