| 1 |
/** |
| 2 |
* Moves any buttons added from the filter list in a WP_List_Table |
| 3 |
* to be displayed next to the "Add New" button. |
| 4 |
* |
| 5 |
* @author ConvertKit |
| 6 |
*/ |
| 7 |
|
| 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 |
} |
| 15 |
|
| 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); |
| 22 |
|
| 23 |
// Remove original. |
| 24 |
span.parentElement.remove(); |
| 25 |
}); |
| 26 |
}); |
| 27 |
|