PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.9.8
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.9.8
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / assets / js / library.js

library.js in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 1.9.8, at assets/js/library.js

52 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names
2
3 var bulkOpt;
4 /**
5 * Add a "Imagify'em all" in the select list.
6 */
7 bulkOpt = '<option value="imagify-bulk|optimize">' + imagifyLibrary.labels.bulkActionsOptimize + '</option>';
8
9 if ( $( '.button-imagify-optimize-missing-sizes' ).length ) {
10 // If we have items that have missing sizes.
11 bulkOpt += '<option value="imagify-bulk|optimize_missing_sizes">' + imagifyLibrary.labels.bulkActionsOptimizeMissingSizes + '</option>';
12 }
13
14 if ( imagifyLibrary.backupOption || $( '.attachment-has-backup' ).length ) {
15 // If the backup option is enabled, or if we have items that can be restored.
16 bulkOpt += '<option value="imagify-bulk|restore">' + imagifyLibrary.labels.bulkActionsRestore + '</option>';
17 }
18
19 $( '.bulkactions select[name="action"] option:last-child' ).before( bulkOpt );
20 $( '.bulkactions select[name="action2"] option:last-child' ).before( bulkOpt );
21 $( '#bulkaction option:last-child' ).after( bulkOpt );
22
23 /**
24 * Process optimization for all selected images.
25 */
26 $( '#doaction' )
27 .add( '#doaction2' )
28 .add( '#bulkaction + [name="showThickbox"]' )
29 .on( 'click', function( e ) {
30 var value = $( this ).prev( 'select' ).val().split( '|' ),
31 action, ids;
32
33 if ( 'imagify-bulk' !== value[0] ) {
34 return;
35 }
36
37 e.preventDefault();
38
39 action = value[1];
40 ids = $( 'input[name^="media"]:checked, input[name^="doaction"]:checked' ).map( function() {
41 return this.value;
42 } ).get();
43
44 ids.forEach( function( id, index ) {
45 setTimeout( function() {
46 $( 'table .imagify-data-actions-container[data-id="' + id + '"] .button-imagify-' + action ).first().trigger( 'click' );
47 }, index * 300 );
48 } );
49 } );
50
51 } )(jQuery, document, window);
52