jQuery(function($){ var ajaxUrl = ajaxurl; $('#wio-restore-backup-btn').on('click', function() { if ( $('#wio-multisite-mode').length ) { $('#wio-multisite-mode').toggle(); $('#wio-multisite-confirm').attr('data-action', 'restore'); $('#wio-multisite-restore-progress').empty(); return false; } result = confirm( $(this).attr('data-confirm') ); if ( ! result ) { return false; } $(this).hide(); $('#wio-restore-backup-progress').show(); var ai_data = { 'total' : '?', 'action': 'wio_restore_backup', '_wpnonce': $('#wio-iph-nonce').val() }; send_post_data(ai_data); return false; }); $('#wio-clear-backup-btn').on('click', function() { $('#wio-restore-backup-msg').hide(); if ( $('#wio-multisite-mode').length ) { $('#wio-multisite-mode').toggle(); $('#wio-multisite-confirm').attr('data-action', 'clear'); $('#wio-multisite-restore-progress').empty(); return false; } result = confirm( $(this).attr('data-confirm') ); if ( ! result ) { return false; } var data = { 'action': 'wio_clear_backup', '_wpnonce': $('#wio-iph-nonce').val() }; $.post(ajaxUrl, data, function(response) { $('#wio-clear-backup-msg').show(); }); }); $('#wio-multisite-confirm').on('click', function() { var action = $(this).attr('data-action'); // если запущена очистка резервных копий if ( action == 'clear' ) { result = confirm( $('#wio-clear-backup-btn').attr('data-confirm') ); // берём сообщение из основной кнопки if ( ! result ) { return false; } var blogs = []; $('.wbcr_io_multisite_blogs:checked').each(function() { blogs.push( $(this).val() ); }); var data = { 'action': 'wio_clear_backup', '_wpnonce': $('#wio-iph-nonce').val(), 'blogs': blogs }; $.post(ajaxUrl, data, function(response) { $('#wio-clear-backup-msg').show(); $('#wio-multisite-mode').toggle(); }); return false; } // если запущено восстановление из резервных копий if ( action == 'restore' ) { result = confirm( $('#wio-restore-backup-btn').attr('data-confirm') ); // берём сообщение из основной кнопки if ( ! result ) { return false; } $('#wio-multisite-mode').toggle(); $('#wio-multisite-restore-progress').empty(); $('.wbcr_io_multisite_blogs:checked').each(function() { $('#wio-multisite-restore-progress').append('\ \