admin-dashboard.js
5 months ago
admin-post.js
5 months ago
admin-quick-edit.js
5 months ago
admin-settings.js
5 months ago
admin-widgets.js
5 months ago
block-editor.js
5 months ago
column-modal.js
5 months ago
counter.js
5 months ago
dummy.js
5 months ago
frontend.js
5 months ago
integration-gutenberg.js
5 months ago
column-modal.js
2 lines
| 1 | !function($,a,o){!function($){if(void 0!==$){var a=null,e=null;if("undefined"!=typeof pvcColumnModal){var t=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?n(a.data):l(a.data.message||pvcColumnModal.i18n.error)},error:function(){l(pvcColumnModal.i18n.error)},complete:function(){e.removeClass("loading"),e.find(".spinner").removeClass("is-active")}})},n=function(e){var t=o.getElementById("pvc-modal-chart");if(t){a&&(a.destroy(),a=null),$(".pvc-modal-error").remove(),$(t).show(),$(".pvc-modal-views-label").text(pvcColumnModal.i18n.summary),$(".pvc-modal-count").text(e.total_views.toLocaleString()),$(".pvc-modal-dates").html(e.dates_html);var n={type:"line",data:e.data,options:{maintainAspectRatio:!1,responsive:!0,plugins:{legend:{display:!1},tooltip:{callbacks:{title:function(a){return e.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)"}}}}};e.design&&n.data.datasets.forEach(function(a){Object.assign(a,e.design),a.tension=.4}),a=new Chart(t.getContext("2d"),n)}},l=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)&&($(o).on("click",".pvc-view-chart",function(o){o.preventDefault();var n=$(o.currentTarget),l=n.data("post-id"),i=n.data("post-title");l&&function(a,o){if(!a)return!1;e=a,$("#pvc-modal-title").text(o);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(){e&&t(e,"")},onClose:function(){a&&(a.destroy(),a=null),e=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})}),$(o).on("click",".pvc-modal-nav-prev, .pvc-modal-nav-next",function(a){a.preventDefault();var o=$(a.currentTarget);if(!o.hasClass("pvc-disabled")){var n=o.data("period");n&&e&&t(e,n)}}))})}}}(jQuery)}(jQuery,window,document); |
| 2 |