Using JS to Compress WordPress Plugins in cPanel

Downloading and uploading lots of small files is never fun. It's much more efficient to first zip the files then move the .zip archive. Recently I need to grab some plugins from a large multisite installation. I only wanted to grab relevant plugins so I came up with the following javascript to assist with the plugin selection.

First navigation to /wp-admin/plugins.php?plugin_status=active and run the following code within Chrome's DevTools. This will copy the plugin slugs to your clipboard to paste into a JS variable.

plugins = [];
jQuery('tbody#the-list tr.active').each(function() {
	plugins.push( jQuery(this).data('slug') );
});
copy(JSON.stringify(plugins));

Next open cPanel's file manager open to the /wp-content/plugins/ like this.

With Chrome DevTools open, type in plugins =  then paste the list of the plugins which was put there from the previous command. Then run following JS code which will automatically select those plugins within cPanel.

jQuery('tbody.yui-dt-data span.renameable').each(function() {
	plugin = jQuery(this).text();
	if ( plugins.includes(plugin) ) {
		jQuery(this).parents("tr.yui-dt-rec").addClass("yui-dt-selected");
    }
});

Now compress and download the customized zip file. Short and sweet JS automation at it's finest! You can see this in action with following demo. 

Video Thumbnail
Using JS to Compress WordPress Plugins in cPanel
https://anchor.host/?p=18505