| @@ -1,31 +1,26 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * Moves any buttons added from the filter list in a WP_List_Table |
| 3 | 3 | * to be displayed next to the "Add New" button. |
| 4 | 4 | * |
| 5 | - * @package ConvertKit | |
| 6 | 5 | * @author ConvertKit |
| 7 | 6 | */ |
| 8 | 7 | |
| 9 | -jQuery( document ).ready( | |
| 10 | - function ( $ ) { | |
| 8 | +document.addEventListener('DOMContentLoaded', function () { | |
| 9 | + // Move any buttons from the filter list to display next to the Add New button. | |
| 10 | + document.querySelectorAll('ul.subsubsub span').forEach(function (span) { | |
| 11 | + // Ignore if not a ConvertKit Group Action. | |
| 12 | + if (!span.classList.contains('convertkit-action')) { | |
| 13 | + return; | |
| 14 | + } | |
| 11 | 15 | |
| 12 | - // Move any buttons from the filter list to display next to the Add New button. | |
| 13 | - $( 'ul.subsubsub a' ).each( | |
| 14 | - function () { | |
| 16 | + // Clone and move. | |
| 17 | + const clone = span.cloneNode(true); | |
| 18 | + clone.classList.remove('hidden'); | |
| 19 | + document | |
| 20 | + .querySelector('a.page-title-action') | |
| 21 | + .insertAdjacentElement('afterend', clone); | |
| 15 | 22 | |
| 16 | - // Ignore if not a ConvertKit Group Action. | |
| 17 | - if ( ! $( this ).hasClass( 'convertkit-action' ) ) { | |
| 18 | - return; | |
| 19 | - } | |
| 20 | - | |
| 21 | - // Move. | |
| 22 | - $( this ).clone().removeClass( 'hidden' ).insertAfter( 'a.page-title-action' ); | |
| 23 | - | |
| 24 | - // Remove original. | |
| 25 | - $( this ).parent().remove(); | |
| 26 | - | |
| 27 | - } | |
| 28 | - ); | |
| 29 | - | |
| 30 | - } | |
| 31 | -); | |
| 23 | + // Remove original. | |
| 24 | + span.parentElement.remove(); | |
| 25 | + }); | |
| 26 | +}); | |