PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.3.9
Post Views Counter v1.3.9
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 / frontend.js
post-views-counter / js Last commit date
admin-dashboard.js 4 years ago admin-post.js 5 years ago admin-quick-edit.js 5 years ago admin-settings.js 4 years ago admin-widgets.js 5 years ago block-editor.min.js 4 years ago frontend.js 4 years ago gutenberg.min.js 6 years ago
frontend.js
51 lines
1 ( function( $ ) {
2
3 // ready event
4 $( function() {
5 // rest api request
6 if ( pvcArgsFrontend.mode === 'rest_api' ) {
7 var request = {
8 id: pvcArgsFrontend.postID
9 };
10
11 $.ajax( {
12 url: pvcArgsFrontend.requestURL + '?id=' + pvcArgsFrontend.postID,
13 type: 'post',
14 async: true,
15 cache: false,
16 data: request,
17 beforeSend: function( xhr ) {
18 xhr.setRequestHeader( 'X-WP-Nonce', pvcArgsFrontend.nonce );
19 }
20 } ).done( function( response ) {
21 // trigger pvcCheckPost event
22 $.event.trigger( {
23 type: 'pvcCheckPost',
24 detail: response
25 } );
26 } );
27 // admin ajax request
28 } else {
29 var request = {
30 action: 'pvc-check-post',
31 pvc_nonce: pvcArgsFrontend.nonce,
32 id: pvcArgsFrontend.postID
33 };
34
35 $.ajax( {
36 url: pvcArgsFrontend.requestURL,
37 type: 'post',
38 async: true,
39 cache: false,
40 data: request
41 } ).done( function( response ) {
42 // trigger pvcCheckPost event
43 $.event.trigger( {
44 type: 'pvcCheckPost',
45 detail: response
46 } );
47 } );
48 }
49 } );
50
51 } )( jQuery );