HEX
Server: Apache/2.4.62 (Debian)
System: Linux plxsite 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 21:40:26 UTC 2024 x86_64
User: root (0)
PHP: 8.1.30
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/post-views-counter/js/column-modal.js
;(function($, window, document){
!function($){if(void 0!==$){var a=null,o=null;if("undefined"!=typeof pvcColumnModal){var e=function(a,o){var e=$(".pvc-modal-chart-container");e.addClass("loading"),e.find(".spinner").addClass("is-active"),$.ajax({url:pvcColumnModal.ajaxURL,type:"POST",dataType:"json",data:{action:"pvc_column_chart",nonce:pvcColumnModal.nonce,post_id:a,period:o},success:function(a){a.success?t(a.data):n(a.data.message||pvcColumnModal.i18n.error)},error:function(){n(pvcColumnModal.i18n.error)},complete:function(){e.removeClass("loading"),e.find(".spinner").removeClass("is-active")}})},t=function(o){var e=document.getElementById("pvc-modal-chart");if(e){a&&(a.destroy(),a=null),$(".pvc-modal-error").remove(),$(e).show(),$(".pvc-modal-views-label").text(pvcColumnModal.i18n.summary),$(".pvc-modal-count").text(o.total_views.toLocaleString()),$(".pvc-modal-dates").html(o.dates_html);var t={type:"line",data:o.data,options:{maintainAspectRatio:!1,responsive:!0,plugins:{legend:{display:!1},tooltip:{callbacks:{title:function(a){return o.data.dates[a[0].dataIndex]},label:function(a){var o=a.parsed.y,e=1===o?pvcColumnModal.i18n.view:pvcColumnModal.i18n.views;return"".concat(o.toLocaleString()," ").concat(e)}}}},scales:{x:{display:!0,grid:{display:!1}},y:{display:!0,beginAtZero:!0,ticks:{precision:0},grid:{color:"rgba(0, 0, 0, 0.05)"}}}}};o.design&&t.data.datasets.forEach(function(a){Object.assign(a,o.design),a.tension=.4}),a=new Chart(e.getContext("2d"),t)}},n=function(o){a&&(a.destroy(),a=null),$(".pvc-modal-summary").text(""),$(".pvc-modal-dates").html("");var e=$(".pvc-modal-chart-container");e.removeClass("loading"),e.find(".spinner").removeClass("is-active"),$(".pvc-modal-error").remove(),e.before('<p class="pvc-modal-error">'.concat(o,"</p>")),e.find("canvas").hide()};$(function(){0!==$("#pvc-chart-modal").length&&"undefined"!=typeof MicroModal&&(MicroModal.init({disableScroll:!0,awaitCloseAnimation:!0}),1)&&($(document).on("click",".pvc-view-chart",function(t){t.preventDefault();var n=$(t.currentTarget),l=n.data("post-id"),i=n.data("post-title");l&&function(a,e){if(!a)return!1;o=a,$("#pvc-modal-title").text(e);var t=$(".pvc-modal-chart-container");return t.addClass("loading"),t.find(".spinner").addClass("is-active"),$(".pvc-modal-views-label").text(""),$(".pvc-modal-count").text(""),$(".pvc-modal-dates").html(""),!0}(l,i)&&"undefined"!=typeof MicroModal&&MicroModal.show("pvc-chart-modal",{onShow:function(){o&&e(o,"")},onClose:function(){a&&(a.destroy(),a=null),o=null,function(){$("#pvc-modal-title").text(""),$(".pvc-modal-views-label").text(""),$(".pvc-modal-count").text(""),$(".pvc-modal-dates").html("");var a=$(".pvc-modal-chart-container");a.removeClass("loading"),a.find(".spinner").removeClass("is-active"),$(".pvc-modal-error").remove()}()},disableScroll:!0,awaitCloseAnimation:!0})}),$(document).on("click",".pvc-modal-nav-prev, .pvc-modal-nav-next",function(a){a.preventDefault();var t=$(a.currentTarget);if(!t.hasClass("pvc-disabled")){var n=t.data("period");n&&o&&e(o,n)}}))})}}}(jQuery);

})(jQuery, window, document);