PluginProbe ʕ •ᴥ•ʔ
Post Views Counter / 1.2.13
Post Views Counter v1.2.13
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-quick-edit.js
post-views-counter / js Last commit date
admin-dashboard.js 8 years ago admin-post.js 8 years ago admin-quick-edit.js 8 years ago admin-settings.js 8 years ago chart.min.js 8 years ago frontend.js 8 years ago
admin-quick-edit.js
57 lines
1 ( function ( $ ) {
2 // we create a copy of the WP inline edit post function
3 var $wp_inline_edit = inlineEditPost.edit;
4 // and then we overwrite the function with our own code
5 inlineEditPost.edit = function ( id ) {
6 // call the original WP edit function
7 // we don't want to leave WordPress hanging
8 $wp_inline_edit.apply( this, arguments );
9
10 // get the post ID
11 var $post_id = 0;
12
13 if ( typeof ( id ) == 'object' )
14 $post_id = parseInt( this.getId( id ) );
15
16 if ( $post_id > 0 ) {
17 // define the edit row
18 var $edit_row = $( '#edit-' + $post_id );
19 var $post_row = $( '#post-' + $post_id );
20
21 // get the data
22 var $post_views = $( '.column-post_views', $post_row ).text();
23
24 // populate the data
25 $( ':input[name="post_views"]', $edit_row ).val( $post_views );
26 }
27
28 return false;
29 };
30
31 $( document ).on( 'click', '#bulk_edit', function () {
32 // define the bulk edit row
33 var $bulk_row = $( '#bulk-edit' );
34
35 // get the selected post ids that are being edited
36 var $post_ids = new Array();
37 $bulk_row.find( '#bulk-titles' ).children().each( function () {
38 $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
39 } );
40
41 // get the data
42 var $post_views = $bulk_row.find( 'input[name="post_views"]' ).val();
43
44 // save the data
45 $.ajax( {
46 url: ajaxurl, // this is a variable that WordPress has already defined for us
47 type: 'post',
48 async: false,
49 cache: false,
50 data: {
51 action: 'save_bulk_post_views', // this is the name of our WP AJAX function that we'll set up next
52 post_ids: $post_ids, // and these are the 2 parameters we're passing to our function
53 post_views: $post_views,
54 }
55 } );
56 } );
57 } )( jQuery );