Files
avatar-privacy/public/js/wpdiscuz/use-gravatar.js
2023-09-01 00:37:57 -07:00

32 lines
756 B
JavaScript

/**
* Compatibility functions for the wpDiscuz plugin.
*
* This file is part of Avatar Privacy.
*
* @file This file handles the use_gravatar checkbox for wpDiscuz.
* @author Peter Putzer <github@mundschenk.at>
* @license GPL-2.0-or-later
* @since 2.2.0
*/
/**
* Resets the use_gravatar checkbox after posting a new comment in wpDiscuz.
*/
jQuery(function ($) {
'use strict';
var $useGravatarCheckbox = $('#' + avatarPrivacy.checkbox);
function resetUseGravatar() {
var useGravatar =
Cookies.get(avatarPrivacy.cookie) !== undefined &&
'' !== Cookies.get(avatarPrivacy.cookie) ?
'checked' :
'';
$useGravatarCheckbox.prop('checked', useGravatar);
}
$(document).on('ajaxComplete', resetUseGravatar);
});