PluginProbe
BeyondWords – AI audio for publishers / 4.0.0
BeyondWords – AI audio for publishers v4.0.0
7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.7.0 All 43 releases
speechkit / src / Component / Posts / BulkEdit / js / bulk-edit.js

bulk-edit.js in BeyondWords – AI audio for publishers 4.0.0, at src/Component/Posts/BulkEdit/js/bulk-edit.js

40 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global jQuery, inlineEditPost */
2
3 jQuery( document ).ready( function ( $ ) {
4 // it is a copy of the inline edit function
5 const wpInlineEditFunction = inlineEditPost.edit;
6 // we overwrite the it with our own
7 inlineEditPost.edit = function ( postId ) {
8 // let's merge arguments of the original function
9 wpInlineEditFunction.apply( this, arguments );
10 // get the post ID from the argument
11 let id = 0;
12 if ( typeof postId === 'object' ) {
13 // if it is object, get the ID number
14 id = parseInt( this.getId( postId ) );
15 }
16 //if post id exists
17 if ( id > 0 ) {
18 // add rows to variables
19 const specificPostEditRow = $( '#edit-' + id ),
20 specificPostRow = $( '#post-' + id ),
21 productPrice = $( '.column-price', specificPostRow )
22 .text()
23 .substring( 1 ); // remove $ sign
24 // add rows to variables
25 let featuredProduct = false; // let's say by default checkbox is unchecked
26 // check if the Featured Product column says Yes
27 if ( $( '.column-featured', specificPostRow ).text() === 'Yes' )
28 featuredProduct = true;
29 // populate the inputs with column data
30 $( ':input[name="price"]', specificPostEditRow ).val(
31 productPrice
32 );
33 $( ':input[name="featured"]', specificPostEditRow ).prop(
34 'checked',
35 featuredProduct
36 );
37 }
38 };
39 } );
40