1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your common JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32})( jQuery ); 33 34jQuery(document).ready(function ($) { 35 $(".wps_membership_buynow").on("click", function (e) { 36 e.preventDefault(); 37 let plan_price = jQuery(jQuery(jQuery(this).parent()).find('#wps_membership_plan_price')).val(); 38 let plan_id = jQuery(jQuery(jQuery(this).parent()).find('#wps_membership_plan_id')).val(); 39 let plan_title = jQuery(jQuery(jQuery(this).parent()).find('#wps_membership_title')).val(); 40 41 $.ajax({ 42 url: mfw_common_param.ajaxurl, 43 type: "POST", 44 data: { 45 action: "wps_membership_checkout", 46 plan_price: plan_price, 47 plan_id: plan_id, 48 plan_title: plan_title, 49 nonce : mfw_common_param.check_nonce, 50 }, 51 52 success: function (response) { 53 54 // setTimeout(() => { 55 56 // window.location.replace('cart'); 57 // }, 1000); 58 } 59 }); 60 }); 61 62 // Cancel membership. 63 $(document).on( 'click', '.memberhip-cancel-button', function(){ 64 var notice = "Are you sure to Cancel your membership account!"; 65 var membership_id = $(this).data('membership_id'); 66 if( confirm( notice ) == true ) { 67 $.ajax({ 68 url: mfw_common_param.ajaxurl, 69 type: "POST", 70 data: { 71 action: "wps_membership_cancel_membership_count", 72 membership_id : membership_id, 73 'security' : mfw_common_param.nonce, 74 }, 75 76 success: function (response) { 77 78 window.location.reload(); 79 } 80 }); 81 } 82 } ); 83 84 // Unified event listener for all notification toggles. 85 $(document).on('change', '.wps_msfw_stop_notifications', function() { 86 87 wps_mfw_toggle_notification( $(this), $(this).attr('data-type') ); 88 }); 89 90 function wps_mfw_toggle_notification( $checkbox, type ) { 91 92 let isChecked = $checkbox.is(':checked') ? $checkbox.val() : 'no'; 93 let data = { 94 action : 'stops_notification', 95 nonce : mfw_common_param.nonce, 96 stop : isChecked, 97 type : type, // 'whatsapp', 'sms', or 'email' 98 }; 99 100 $.ajax({ 101 url : mfw_common_param.ajaxurl, 102 method : 'POST', 103 data : data, 104 success : function(response) { 105 let $notice = $('.mfw_whatsapp_stop_notice'); 106 $notice 107 .show() 108 .css('color', response.result ? 'red' : 'green') 109 .html(response.msg); 110 111 setTimeout(() => { 112 $notice.hide(); 113 }, 2000); 114 } 115 }); 116 } 117 118 // popup to send sms to user. 119 120 // Cache the popup overlay 121 var popupOverlay = $(".wps-mfw_ul-popup-overlay"); 122 var popup_Overlay2 = $(".wps-mfw_ul-popup-2overlay"); 123 124 // SMS button click 125 $('.wps-mfw_u-list-wrap ul.wps-mfw_u-list li .wps-mfw_ul-cta .wps_msfw_sms').on('click', function(e) { 126 127 $('.wps-mfw_uld-msg').html(''); 128 var dataId = $(this).attr('data-id'); 129 $('.wps-mfw_ul-send').attr('data-id', dataId); 130 131 // Show the popup using jQuery 132 popupOverlay.css("display", "flex"); // or "block" 133 }); 134 135 // Handle Close button 136 jQuery(".wps-mfw_ul-close").on("click", function () { 137 popupOverlay.css("display", "none"); 138 popup_Overlay2.css("display", "none"); 139 }); 140 141 // send sms to community users. 142 jQuery(document).on('click', '.wps-mfw_ul-send', function () { 143 144 const $button = jQuery(this); 145 const userId = $button.attr('data-id'); 146 const message = jQuery('.wps-mfw_ul-description').val(); 147 const $loader = jQuery('.wps_wpr_sms_community_loader'); 148 const $msgBox = jQuery('.wps-mfw_uld-msg'); 149 150 if ( ! message ) { 151 152 $msgBox.css('color', 'red').html(mfw_common_param.msg_error).show().focus(); 153 return false;
154 } 155 $button.prop('disabled', true); 156 $loader.show(); 157 $msgBox.hide(); 158 159 jQuery.ajax({ 160 type : 'POST', 161 url : mfw_common_param.ajaxurl, 162 data : { 163 action : 'send_sms_community_user', 164 nonce : mfw_common_param.nonce, 165 user_id : userId, 166 message : message, 167 }, 168 success : function (response) { 169 $button.prop('disabled', false); 170 $loader.hide(); 171 $msgBox 172 .css('color', response.result ? 'green' : 'red') 173 .html(response.msg) 174 .show(); 175 jQuery('.wps-mfw_ul-description').val(''); 176 177 setTimeout(() => { 178 popupOverlay.hide(); 179 $msgBox.hide(); 180 }, 2000); 181 }, 182 error: function () { 183 $button.prop('disabled', false); 184 $loader.hide(); 185 $msgBox.css('color', 'red').text(mfw_common_param.ajax_error).show(); 186 } 187 }); 188 }); 189 190 // Open modal for sending mail. 191 $('.wps-mfw_u-list-wrap ul.wps-mfw_u-list li .wps-mfw_ul-cta .wps_msfw_email').on('click', function(e) { 192 193 jQuery('.wps_msfw_send_mail_to_comm_user').val(jQuery(this).attr('data-email'));// add email to input field. 194 popup_Overlay2.css("display", "flex"); // or "block". 195 }); 196 197 // Send mail to community users. 198 jQuery(document).on('click', '.wps-mfw_ul-email-send', function(){ 199 200 const $button = jQuery(this); 201 const userEmail = jQuery('.wps_msfw_send_mail_to_comm_user').val(); 202 const message = jQuery('#wps-mfw_ul-email-description').val(); 203 const $loader = jQuery('.wps_wpr_sms_community_loader'); 204 const $msgBox = jQuery('.wps-mfw_uld-msg'); 205 206 // validate email field. 207 if ( ! userEmail ) { 208 $msgBox.css('color', 'red').html(mfw_common_param.mail_error).show().focus(); 209 return false; 210 } 211 212 // validate mesage field. 213 if ( ! message ) { 214 215 $msgBox.css('color', 'red').html(mfw_common_param.msg_error).show().focus(); 216 return false; 217 } 218 219 $button.prop('disabled', true); 220 $loader.show(); 221 $msgBox.hide(); 222 223 const data = { 224 'action' : 'send_mail_to_community_users', 225 'nonce' : mfw_common_param.nonce, 226 'user_email' : userEmail, 227 'messages' : message, 228 }; 229 230 jQuery.ajax({ 231 type: 'POST', 232 url: mfw_common_param.ajaxurl, 233 data: data, 234 success: function (response) { 235 $button.prop('disabled', false); 236 $loader.hide(); 237 $msgBox 238 .css('color', response.result ? 'green' : 'red') 239 .html(response.msg) 240 .show(); 241 jQuery('#wps-mfw_ul-email-description').val(''); 242 setTimeout(() => { 243 popup_Overlay2.hide(); 244 $msgBox.hide(); 245 }, 2000); 246 }, 247 error: function () { 248 $button.prop('disabled', false); 249 $loader.hide(); 250 $msgBox.css('color', 'red').text(mfw_common_param.ajax_error).show(); 251 } 252 }); 253 }); 254 255}); 256
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.