121 + ' <div class="bws-modal-dialog">' |
121 + ' <div class="bws-modal-dialog">' |
122 + ' <div class="bws-modal-body">' |
122 + ' <div class="bws-modal-body">' |
123 + ' <h2><?php _e( 'Quick Feedback', 'bestwebsoft' ); ?></h2>' |
123 + ' <h2><?php _e( 'Quick Feedback', 'bestwebsoft' ); ?></h2>' |
124 + ' <div class="bws-modal-panel active"><p><?php _e( 'If you have a moment, please let us know why you are deactivating', 'bestwebsoft' ); ?>:</p><ul>' + <?php echo json_encode( $reasons_list_items_html ); ?> + '</ul>' |
124 + ' <div class="bws-modal-panel active"><p><?php _e( 'If you have a moment, please let us know why you are deactivating', 'bestwebsoft' ); ?>:</p><ul>' + <?php echo json_encode( $reasons_list_items_html ); ?> + '</ul>' |
125 + ' <label class="bws-modal-anonymous-label">' |
125 + ' <label class="bws-modal-anonymous-label">' |
126 + ' <input type="checkbox" checked="checked" />' |
126 + ' <input type="checkbox" />' |
127 + ' <?php _e( 'Send website data and allow to contact me back', 'bestwebsoft' ); ?>' |
127 + ' <?php _e( 'Send website data and allow to contact me back', 'bestwebsoft' ); ?>' |
128 + ' </label>' |
128 + ' </label>' |
129 + ' </div>' |
129 + ' </div>' |
130 + ' </div>' |
130 + ' </div>' |
131 + ' <div class="bws-modal-footer">' |
131 + ' <div class="bws-modal-footer">' |
132 + ' <a href="#" class="button button-secondary bws-modal-button-close"><?php _e( 'Cancel', 'bestwebsoft' ); ?></a>' |
|
133 + ' <a href="#" class="button button-primary bws-modal-button-deactivate"></a>' |
132 + ' <a href="#" class="button button-primary bws-modal-button-deactivate"></a>' |
134 + ' <div class="clear"></div>' |
133 + ' <div class="clear"></div>' |
135 + ' </div>' |
134 + ' </div>' |
136 + ' </div>' |
135 + ' </div>' |
137 + '</div>', |
136 + '</div>', |
178 setTimeout( function() { |
177 setTimeout( function() { |
179 if ( ! BwsModalIsReasonSelected( 'OTHER' ) ) { |
178 if ( ! BwsModalIsReasonSelected( 'OTHER' ) ) { |
180 return; |
179 return; |
181 } |
180 } |
182 |
181 |
|
182 /** |
|
183 * |
|
184 * @todo Remove after 01.01.2020 |
|
185 * This code need to be removed after WordPress letter "[WordPress Plugin Directory] Notice: Captcha by BestWebSoft" from 04.09.2019 by kdo |
|
186 * |
|
187 */ |
183 /* If reason is empty, add the error-message class to the message container to change the message color to red. */ |
188 /* If reason is empty, add the error-message class to the message container to change the message color to red. */ |
184 if ( 0 === $userReason.val().trim().length ) { |
189 /*if ( 0 === $userReason.val().trim().length ) { |
185 $modal.find( '.message' ).addClass( 'error-message' ); |
190 $modal.find( '.message' ).addClass( 'error-message' ); |
186 BwsModalDisableDeactivateButton(); |
191 BwsModalDisableDeactivateButton(); |
187 } |
192 }*/ |
188 }, 150 ); |
193 }, 150 ); |
189 }); |
194 }); |
190 |
195 |
191 $modal.on( 'click', '.bws-modal-footer .button', function( evt ) { |
196 $modal.on( 'click', '.bws-modal-footer .button', function( evt ) { |
192 evt.preventDefault(); |
197 evt.preventDefault(); |
209 |
214 |
210 var $selected_reason = $radio.parents( 'li:first' ), |
215 var $selected_reason = $radio.parents( 'li:first' ), |
211 $input = $selected_reason.find( 'textarea, input[type="text"]' ), |
216 $input = $selected_reason.find( 'textarea, input[type="text"]' ), |
212 userReason = ( 0 !== $input.length ) ? $input.val().trim() : ''; |
217 userReason = ( 0 !== $input.length ) ? $input.val().trim() : ''; |
213 |
218 |
214 if ( BwsModalIsReasonSelected( 'OTHER' ) && '' === userReason ) { |
219 /** |
|
220 * |
|
221 * @todo Remove after 01.01.2020 |
|
222 * This code need to be removed after WordPress letter "[WordPress Plugin Directory] Notice: Captcha by BestWebSoft" from 04.09.2019 by kdo |
|
223 * |
|
224 */ |
|
225 /*if ( BwsModalIsReasonSelected( 'OTHER' ) && '' === userReason ) { |
215 return; |
226 return; |
216 } |
227 }*/ |
217 |
228 |
218 var is_anonymous = ( $anonymousFeedback.find( 'input' ).is( ':checked' ) ) ? 0 : 1; |
229 var is_anonymous = ( $anonymousFeedback.find( 'input' ).is( ':checked' ) ) ? 0 : 1; |
219 |
230 |
220 $.ajax({ |
231 $.ajax({ |
221 url : ajaxurl, |
232 url : ajaxurl, |
257 |
268 |
258 var _parent = $( this ).parents( 'li:first' ); |
269 var _parent = $( this ).parents( 'li:first' ); |
259 |
270 |
260 $modal.find( '.bws-modal-reason-input' ).remove(); |
271 $modal.find( '.bws-modal-reason-input' ).remove(); |
261 $modal.find( '.bws-modal-internal-message' ).hide(); |
272 $modal.find( '.bws-modal-internal-message' ).hide(); |
262 $modal.find( '.bws-modal-button-deactivate' ).text( '<?php _e( 'Submit & Deactivate', 'bestwebsoft' ); ?>' ); |
273 $modal.find( '.bws-modal-button-deactivate' ).text( '<?php _e( 'Submit and Deactivate', 'bestwebsoft' ); ?>' ); |
263 |
274 |
264 BwsModalEnableDeactivateButton(); |
275 BwsModalEnableDeactivateButton(); |
265 |
276 |
266 if ( _parent.hasClass( 'has-internal-message' ) ) { |
277 if ( _parent.hasClass( 'has-internal-message' ) ) { |
267 _parent.find( '.bws-modal-internal-message' ).show(); |
278 _parent.find( '.bws-modal-internal-message' ).show(); |
273 _parent.append( $( reasonInputHtml ) ); |
284 _parent.append( $( reasonInputHtml ) ); |
274 _parent.find( 'input, textarea' ).attr( 'placeholder', _parent.data( 'input-placeholder' ) ).focus(); |
285 _parent.find( 'input, textarea' ).attr( 'placeholder', _parent.data( 'input-placeholder' ) ).focus(); |
275 |
286 |
276 if ( BwsModalIsReasonSelected( 'OTHER' ) ) { |
287 if ( BwsModalIsReasonSelected( 'OTHER' ) ) { |
277 $modal.find( '.message' ).text( '<?php _e( 'Please tell us the reason so we can improve it.', 'bestwebsoft' ); ?>' ).show(); |
288 $modal.find( '.message' ).text( '<?php _e( 'Please tell us the reason so we can improve it.', 'bestwebsoft' ); ?>' ).show(); |
278 BwsModalDisableDeactivateButton(); |
289 /** |
|
290 * |
|
291 * @todo Remove after 01.01.2020 |
|
292 * This code need to be removed after WordPress letter "[WordPress Plugin Directory] Notice: Captcha by BestWebSoft" from 04.09.2019 by kdo |
|
293 * |
|
294 */ |
|
295 //BwsModalDisableDeactivateButton(); |
279 } |
296 } |
280 } |
297 } |
281 }); |
298 }); |
282 |
299 |
283 /* If the user has clicked outside the window, cancel it. */ |
300 /* If the user has clicked outside the window, cancel it. */ |
318 /* Remove all input fields ( textfield, textarea ).*/ |
335 /* Remove all input fields ( textfield, textarea ).*/ |
319 $modal.find( '.bws-modal-reason-input' ).remove(); |
336 $modal.find( '.bws-modal-reason-input' ).remove(); |
320 |
337 |
321 $modal.find( '.message' ).hide(); |
338 $modal.find( '.message' ).hide(); |
322 |
339 |
323 $anonymousFeedback.find( 'input' ).prop( 'checked', true ); |
340 /** |
|
341 * |
|
342 * @todo Remove after 01.01.2020 |
|
343 * This code need to be removed after WordPress letter "[WordPress Plugin Directory] Notice: Captcha by BestWebSoft" from 04.09.2019 by kdo |
|
344 * |
|
345 */ |
|
346 //$anonymousFeedback.find( 'input' ).prop( 'checked', true ); |
324 |
347 |
325 /* Hide, since by default there is no selected reason.*/ |
348 /* Hide, since by default there is no selected reason.*/ |
326 $anonymousFeedback.hide(); |
349 $anonymousFeedback.hide(); |
327 |
350 |
328 var $deactivateButton = $modal.find( '.bws-modal-button-deactivate' ); |
351 var $deactivateButton = $modal.find( '.bws-modal-button-deactivate' ); |
340 } |
363 } |
341 |
364 |
342 function BwsModalShowPanel() { |
365 function BwsModalShowPanel() { |
343 $modal.find( '.bws-modal-panel' ).addClass( 'active' ); |
366 $modal.find( '.bws-modal-panel' ).addClass( 'active' ); |
344 /* Update the deactivate button's text */ |
367 /* Update the deactivate button's text */ |
345 $modal.find( '.bws-modal-button-deactivate' ).text( '<?php _e( 'Deactivate', 'bestwebsoft' ); ?>' ); |
368 $modal.find( '.bws-modal-button-deactivate' ).text( '<?php _e( 'Skip and Deactivate', 'bestwebsoft' ); ?>' ); |
346 } |
369 } |
347 })(jQuery); |
370 })(jQuery); |
348 </script> |
371 </script> |
349 <?php } |
372 <?php } |
350 } |
373 } |