wp_back/wp-content/plugins/visual-portfolio/assets/admin/js/ask-review-notice.js

25 lines
556 B
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
import $ from 'jquery';
const { ajaxurl, VPAskReviewNotice } = window;
const $body = $('body');
$body.on('click', '.vpf-review-plugin-notice-dismiss', function (e) {
const $this = $(this);
const type = $this.attr('data-vpf-review-action');
// Don't prevent click on Yes link, as it is URL for rate.
if (type !== 'yes') {
e.preventDefault();
}
// Hide notice.
$this.closest('.notice').slideUp('slow');
// Save user answer in DB.
$.post(ajaxurl, {
action: 'vpf_dismiss_ask_review_notice',
type,
nonce: VPAskReviewNotice.nonce,
});
});