jQuery(document).ready(function($){$("#wp-simple-seo-bulk-actions").length>0&&$("form#posts-filter").before($("#wp-simple-seo-bulk-actions")),$("input#doaction, input#doaction2").on("click",function(e){if(0==wp_simple_seo_admin.bulk_actions.length)return!0;switch($(this).attr("id")){case"doaction":if(-1==wp_simple_seo_admin.bulk_actions.indexOf($("select[name=action]").val()))return!0;var t=$("select[name=action]").val().replace(new RegExp("-","g"),"_");break;case"doaction2":if(-1==wp_simple_seo_admin.bulk_actions.indexOf($("select[name=action2]").val()))return!0;var t=$("select[name=action2]").val().replace(new RegExp("-","g"),"_");break;default:return!0;break}e.preventDefault();var s=[];if($('input[name="post[]"]:checked').each(function(){s.push($(this).val())}),0==s.length)return void alert(wp_simple_seo_admin.messages.no_posts_selected);$("#wp-simple-seo-bulk-actions").fadeIn(),$("#wp-simple-seo-bulk-actions .progress-bar").wp_simple_seo_bulk_actions({action:t,post_ids:s,elements:{container:$("#wp-simple-seo-bulk-actions"),current:$("#wp-simple-seo-bulk-actions .progress-number .current"),total:$("#wp-simple-seo-bulk-actions .progress-number .total"),cancel:$("#wp-simple-seo-bulk-actions .cancel.button"),checkboxes:$('input#cb-select-all-1, input#cb-select-all-2, input[name="post[]"]'),selects:$("select[name=action], select[name=action2]")}})})}),function($){$.fn.wp_simple_seo_bulk_actions=function(e){var t=!1;$(e.elements.total).text(e.post_ids.length),$(this).synchronous_request({url:ajaxurl,number_requests:e.post_ids.length,offset:0,data:{action:e.action,post_ids:e.post_ids},onRequestSuccess:function(s,n){return console.log(s),$(e.elements.current).text(n+1),$("tr#post-"+e.post_ids[n]+" td."+e.action).html(s.data.output),1!=t||(this.onFinished(),!1)},onRequestError:function(s,n,o,i){return $(e.elements.current).text(i+1),$("tr#post-"+e.post_ids[i]+" td."+e.action).text("Error"),1!=t||(this.onFinished(),!1)},onFinished:function(){$(e.elements.current).text(wp_simple_seo_admin.messages.finished),$(e.elements.total).text(""),setTimeout(function(){$(e.elements.container).fadeOut("slow",function(){$(e.elements.current).text("0"),$(e.elements.total).text("0"),$(e.elements.cancel).text(wp_simple_seo_admin.messages.cancel)}),$(e.elements.checkboxes).prop("checked",!1),$(e.elements.selects).val("-1")},1e3)}}),$(e.elements.cancel).on("click",function(e){e.preventDefault(),t=!0,$(this).attr("disabled","disabled").text(wp_simple_seo_admin.messages.cancelling)})}}(jQuery);