waitCodevz(() => {

	// Post views count.
	document.querySelectorAll('.xtra-post-views').forEach(el => {
		const url = document.body.dataset.ajax || window.ajaxurl;

		const params = new URLSearchParams({
			action: 'codevz_ajax_post_views',
			id: 	el.getAttribute('data-id'),
			token: 	'codevz_plus_post_views_id'
		});

		setTimeout( function() {

			fetch(url, {
				method: 'POST',
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded',
				},
				body: params.toString()
			})
			.then(response => response.json())
			.then(data => {
				if (data.success && data.data) {
					el.querySelector('span').innerText = data.data;
				}
			})
			.catch(error => {});

		}, 2000 );

	});

});