/*! * Studiou WC Mail Queue — admin script * * Copyright (C) 2026 QUADARAX. All rights reserved. * Author: Dalibor Votruba * License: GPL-2.0-or-later */ ( function ( $ ) { 'use strict'; console.log( 'STUDIOU WC MAIL: Admin script loaded v1.0.0' ); function safeInit( name, fn ) { try { fn(); } catch ( e ) { console.error( 'STUDIOU WC MAIL: init failed for ' + name, e ); } } $( function () { safeInit( 'checkAll', function () { $( '#studiou-wcmq-check-all' ).on( 'change', function () { $( '.studiou-wcmq-queue-form input[name="rows[]"]' ).prop( 'checked', this.checked ); } ); } ); safeInit( 'bulkConfirm', function () { $( '.studiou-wcmq-queue-form' ).on( 'submit', function ( e ) { var action = $( this ).find( 'select[name="wcmq_action"]' ).val(); var checked = $( this ).find( 'input[name="rows[]"]:checked' ).length; if ( ! action || ! checked ) { e.preventDefault(); return; } if ( 'delete' === action && ! window.confirm( studiouWcmq.confirmDelete ) ) { e.preventDefault(); return; } // Retry re-delivers mail. It is destructive in the way that matters. if ( 'retry' === action && ! window.confirm( studiouWcmq.confirmRetry ) ) { e.preventDefault(); } } ); } ); safeInit( 'clearLogConfirm', function () { $( '.studiou-wcmq-clear-log-form' ).on( 'submit', function ( e ) { if ( ! window.confirm( studiouWcmq.confirmClearLog ) ) { e.preventDefault(); } } ); } ); } ); }( jQuery ) );