Mint: A Fresh Look at your Site Minted
  1. 1 jQuery(document).ready( function($) {
  2. 2 /*Play button animation with duration */
  3. 3 $( '.sfba-main-form-container' ).on(
  4. 4 "animationend MSAnimationEnd webkitAnimationEnd oAnimationEnd",
  5. 5 function() {
  6. 6 $( this ).removeClass( 'animation-start' );
  7. 7 }
  8. 8 );
  9. 9 var set_animation = setInterval( function() {
  10. 10 $( '.sfba-main-form-container' ).addClass( 'animation-start' );
  11. 11 }, 3500 );
  12. 12
  13. 13 $( ".sfba_subscribe_form" ).on('submit', function() {
  14. 14 var form_id = jQuery(this).attr('id');
  15. 15 var sfba_page_link = jQuery( '#' + form_id + ' .sfba_page_link' ).val();
  16. 16 var post_id = jQuery( '#' + form_id + ' .sfba_post_type_id' ).val();
  17. 17 var name = jQuery( '#' + form_id + ' .sfba-form-name' ).val();
  18. 18 var email = jQuery( '#' + form_id + ' .sfba-form-email' ).val();
  19. 19 if(name == null){
  20. 20 data = {
  21. 21 action : 'sfba_ajax', 'subscriberemail':email,'post_id':post_id,'sfba_page_link':sfba_page_link,"wpnonce":the_ajax_script.ajax_nonce
  22. 22 };
  23. 23 }else{
  24. 24 data = {
  25. 25 action : 'sfba_ajax', 'subscribername':name,'subscriberemail':email,'post_id':post_id,'sfba_page_link':sfba_page_link,"wpnonce":the_ajax_script.ajax_nonce
  26. 26
  27. 27 };
  28. 28 }
  29. 29 $.post(the_ajax_script.ajaxurl , data , function (response){
  30. 30 $( '#' + form_id + ' .sfba_thanks_container' ).css({
  31. 31 "opacity":"0",
  32. 32 "display":"flex",
  33. 33 }).show().animate({opacity:1})
  34. 34 clearInterval( set_animation );
  35. 35 });
  36. 36 return false;
  37. 37 });
  38. 38
  39. 39 jQuery( document ).on('click', ".sfba_delete_entry", function(){
  40. 40 var deleterowid = $( this ).attr( "data-delete" );
  41. 41 var wpappp_confirm_delete = window.confirm("Are you sure you want to delete Record with ID# "+deleterowid);
  42. 42 var wpapp_redirect_refresh = window.location.href;
  43. 43 if (wpappp_confirm_delete == true) {
  44. 44 jQuery.ajax({
  45. 45 type: 'POST',
  46. 46 url: the_ajax_script.ajaxurl,
  47. 47 data: {"action": "sfba_delete_db_record","id":deleterowid, "wpnonce": the_ajax_script.ajax_nonce},
  48. 48 success: function(data){
  49. 49 location.href = wpapp_redirect_refresh;
  50. 50 },
  51. 51 error: function(XMLHttpRequest, textStatus, errorThrown) {
  52. 52 alert("Status: " + textStatus); alert("Error: " + errorThrown);
  53. 53 }
  54. 54 });
  55. 55 }
  56. 56 // Prevents default submission of the form after clicking on the submit button.
  57. 57 return false;
  58. 58 });
  59. 59
  60. 60 jQuery( document ).on('click', "#sfba_delete_all_data", function(){
  61. 61 var wpappp_confirm_delete = window.confirm("Are you sure you want to delete all subscribers from the database?");
  62. 62 var wpapp_redirect_refresh = window.location.href;
  63. 63 if (wpappp_confirm_delete == true) {
  64. 64 jQuery.ajax({
  65. 65 type: 'POST',
  66. 66 url: the_ajax_script.ajaxurl,
  67. 67 data: {"action": "sfba_delete_db_data", "wpnonce":the_ajax_script.ajax_nonce},
  68. 68 success: function(data){
  69. 69 location.href = wpapp_redirect_refresh;
  70. 70 },
  71. 71 error: function(XMLHttpRequest, textStatus, errorThrown) {
  72. 72 alert("Status: " + textStatus); alert("Error: " + errorThrown);
  73. 73 }
  74. 74 });
  75. 75 }
  76. 76 // Prevents default submission of the form after clicking on the submit button.
  77. 77 return false;
  78. 78 });
  79. 79
  80. 80 $('.sfba-form-submit-button').on( 'click', function (event){
  81. 81 var form_id = jQuery(this).data('form-id');
  82. 82 if ( typeof $('#' + form_id + ' input[type=checkbox]').prop("checked") !== 'undefined' && $('#' + form_id + ' input[type=checkbox]').prop("checked") !== true){
  83. 83 $('#' + form_id + ' .sfba-conset-field-error').show();
  84. 84 event.preventDefault();
  85. 85 return false;
  86. 86 } else {
  87. 87 $('#' + form_id + ' .sfba-conset-field-error').hide();
  88. 88 }
  89. 89
  90. 90 if ( $( 'form#' + form_id + ' .sfba-form-email' ).val() == '' ){
  91. 91 $( 'form#' + form_id + ' .sfba-email-field-error' ).show();
  92. 92 event.preventDefault();
  93. 93 } else {
  94. 94 $( 'form#' + form_id + ' .sfba-email-field-error' ).hide();
  95. 95 }
  96. 96 });
  97. 97 $( 'a.sfba-form-close' ).on( 'click', function( event ){
  98. 98 $('#' + $(this).data('form-id') ).slideToggle();
  99. 99 });
  100. 100
  101. 101 $("#sfba_subscription_selection_dd").select2({
  102. 102 closeOnSelect : false,
  103. 103 placeholder : "Integrations list",
  104. 104 allowHtml: false,
  105. 105 tags: false
  106. 106 });
  107. 107 });
Bookmark: javascript:location='http://shauninman.com/vs/?url='+escape(location)