PluginProbe
Mark Posts / 1.2.1
Mark Posts v1.2.1
trunk 1.0.0 1.0.1 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.2.0 1.2.1 1.2.2 1.2.3 1.2.4 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 All 28 releases
mark-posts / admin / assets / js / admin-edit.js

admin-edit.js in Mark Posts 1.2.1, at admin/assets/js/admin-edit.js

64 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function($) {
2
3 // we create a copy of the WP inline edit post function
4 var $wp_inline_edit = inlineEditPost.edit;
5
6 // and then we overwrite the function with our own code
7 inlineEditPost.edit = function( id ) {
8
9 // "call" the original WP edit function
10 // we don't want to leave WordPress hanging
11 $wp_inline_edit.apply( this, arguments );
12
13 // now we take care of our business
14
15 // get the post ID
16 var $post_id = 0;
17 if ( typeof( id ) == 'object' )
18 $post_id = parseInt( this.getId( id ) );
19
20 if ( $post_id > 0 ) {
21
22 // define the edit row
23 var $edit_row = $( '#edit-' + $post_id );
24
25 // get the term
26 var $mark_posts_term_id = $( '#mark_posts_term_id-' + $post_id ).data('val');
27
28 // set the term
29 $edit_row.find( 'select[name="mark_posts_term_id"]' ).val( $mark_posts_term_id );
30
31 }
32
33 };
34
35 $( '#bulk_edit' ).live( 'click', function() {
36
37 // define the bulk edit row
38 var $bulk_row = $( '#bulk-edit' );
39
40 // get the selected post ids that are being edited
41 var $post_ids = new Array();
42 $bulk_row.find( '#bulk-titles' ).children().each( function() {
43 $post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
44 });
45
46 // get the custom fields
47 var $mark_posts_term_id = $bulk_row.find( 'select[name="mark_posts_term_id"]' ).val();
48
49 // mark_posts_save the data
50 $.ajax({
51 url: ajaxurl,
52 type: 'POST',
53 async: false,
54 cache: false,
55 data: {
56 action: 'mark_posts_save_bulk_edit',
57 post_ids: $post_ids,
58 mark_posts_term_id: $mark_posts_term_id
59 }
60 });
61
62 });
63
64 })(jQuery);