console.log("Script Footer - v" + args_footer.current_version);


jQuery(document).ready(() => {
    if(location.pathname.substring(1).includes('wp-admin/export.php')) {
        // addNewExportFilter();
        // Prossimi rilasci
    }

    cambioStato();
});


function goToTop(){
    window.scrollTo(0, 0);
}


function addNewExportFilter() {
    let new_export = jQuery('<p><label><input type="radio" name="content" value="configurazioni_tema">Configurazioni Syrus Theme</label></p>');
    jQuery('#export-filters fieldset').first().append(new_export);
    jQuery('input[name^="content"]').each((i,el) => {
        jQuery(el).on('change',() => {
            cambioStato();
        });
    });
}

function cambioStato() {
    if(jQuery('input[name="content"]:checked').val() == "configurazioni_tema") {
        jQuery('#export-filters').attr('action',"/wp-admin/admin-post.php");
        jQuery('#export-filters').attr('method',"POST");
        jQuery('#export-filters').append(jQuery('<input type="hidden" name="action" value="export-impostazioni-tema"></input>'))
    }else {
        jQuery('#export-filters').removeAttr('action');
        jQuery('#export-filters').attr('method',"GET");
        jQuery('#export-filters input[name=action]').remove();
    }
}

