PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.3
Post Views Counter v1.3
1.7.13 1.7.12 1.7.11 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.2 1.3.2.1 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9
post-views-counter / js / admin-dashboard.js
post-views-counter / js Last commit date
admin-dashboard.js 6 years ago admin-post.js 6 years ago admin-quick-edit.js 6 years ago admin-settings.js 6 years ago admin-widgets.js 6 years ago chart.min.js 6 years ago frontend.js 6 years ago gutenberg.min.js 6 years ago
admin-dashboard.js
99 lines
1 ( function ( $ ) {
2
3 // set global options
4 // Chart.defaults.global.tooltips.titleMarginBottom = 0;
5 // Chart.defaults.global.tooltips.footerMarginTop = 4;
6
7 window.onload = function () {
8 updateChart( 'this_month' );
9 };
10
11 function updateChart( period ) {
12
13 var container = document.getElementById( 'pvc_dashboard_container' );
14
15 if ( $( container ).length > 0 ) {
16
17 $( container ).addClass( 'loading' ).append( '<span class="spinner is-active"></span>' );
18
19 $.ajax( {
20 url: pvcArgs.ajaxURL,
21 type: 'POST',
22 dataType: 'json',
23 data: ( {
24 action: 'pvc_dashboard_chart',
25 nonce: pvcArgs.nonce,
26 period: period
27 } ),
28 success: function ( args ) {
29 $( container ).removeClass( 'loading' );
30 $( container ).find( '.spinner' ).removeClass( 'is-active' );
31
32 var config = {
33 type: 'line',
34 data: args.data,
35 options: {
36 responsive: true,
37 legend: {
38 display: false,
39 position: 'bottom',
40 },
41 scales: {
42 xAxes: [ {
43 display: true,
44 scaleLabel: {
45 display: true,
46 labelString: args.text.xAxes,
47 fontSize: 14,
48 fontFamily: '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif'
49 }
50 } ],
51 yAxes: [ {
52 display: true,
53 scaleLabel: {
54 display: false,
55 labelString: args.text.yAxes
56 }
57 } ]
58 },
59 hover: {
60 mode: 'label'
61 },
62 tooltips: {
63 custom: function ( tooltip ) {
64 // console.log( tooltip );
65 },
66 callbacks: {
67 title: function ( tooltip ) {
68 return args.data.dates[tooltip[0].index];
69 }
70 }
71 }
72 }
73 };
74
75 $.each( config.data.datasets, function ( i, dataset ) {
76 dataset.fill = args.design.fill;
77 dataset.borderColor = args.design.borderColor;
78 dataset.backgroundColor = args.design.backgroundColor;
79 dataset.borderWidth = args.design.borderWidth;
80 dataset.borderDash = args.design.borderDash;
81 dataset.pointBorderColor = args.design.pointBorderColor;
82 dataset.pointBackgroundColor = args.design.pointBackgroundColor;
83 dataset.pointBorderWidth = args.design.pointBorderWidth;
84 } );
85
86 window.chartPVC = new Chart( document.getElementById( 'pvc_chart' ).getContext( '2d' ), config );
87 }
88 } );
89
90 }
91 }
92
93 function updateLegend() {
94 $legendContainer = $( '#legendContainer' );
95 $legendContainer.empty();
96 $legendContainer.append( window.chartPVC.generateLegend() );
97 }
98
99 } )( jQuery );