/*! Auto Load Next Post v1.6.0-beta.1 Thursday 5th September 2019 22:50:39 PM GMT+0200 */
!function(s,n){var a=!1,o=!0,e=s("form"),t=s(".need-help").data("tab"),i=s(".contextual-help-tabs"),l=s(".contextual-help-tabs-wrap"),r=s("#"+s("#screen-meta-links").find(".show-settings").attr("aria-controls")),u=n.is_rtl;u="rtl"==u,s("input, number, email, textarea, select, checkbox, radio").change(function(){a=!0}),s(".nav-tab-wrapper a").click(function(e){var t=s(this).attr("href");a&&"#"!==t&&(e.preventDefault(),s.confirm({icon:"dashicons dashicons-warning",title:n.i18n_warning,content:n.i18n_nav_warning,rtl:u,type:"red",buttons:{warning:{text:n.i18n_continue,keys:["y","enter"],btnClass:"btn-red",action:function(){location.href=t}},close:{keys:["n","esc"],action:function(){s.dialog({title:n.i18n_save,content:n.i18n_save_recommendation,type:"blue",draggable:!1,boxWidth:"500px",useBootstrap:!1})}}},draggable:!1,boxWidth:"500px",useBootstrap:!1}))}),e.on("input validate change","input, number, email, textarea, select, checkbox, radio",function(e){var t=s(this),n=t.hasClass("required"),a=t.hasClass("validate-email"),i=e.type;if("input"===i&&t.removeClass("validated"),"validate"===i||"change"===i){if(n&&("checkbox"!==t.attr("type")||t.is(":checked")?0==t.val().length&&(t.removeClass("validated").addClass("invalid invalid-required-field"),o=!1):(t.removeClass("validated").addClass("invalid invalid-required-field"),o=!1)),a)if(t.val())new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i).test(t.val())||(t.removeClass("validated").addClass("invalid invalid-email"),o=!1);o&&t.removeClass("invalid invalid-required-field invalid-email").addClass("validated")}}),s(".submit :input").click(function(e){o?a=!1:(e.preventDefault(),s.confirm({icon:"dashicons dashicons-warning",title:n.i18n_warning,content:"There are required settings that need your attention before saving.",rtl:u,type:"red",buttons:{close:{keys:["n","esc","enter"],action:function(){}}},draggable:!1,boxWidth:"500px",useBootstrap:!1}))}),s("a.reset-settings").click(function(e){var t=s(this).attr("href");e.preventDefault(),s.confirm({icon:"dashicons dashicons-warning",title:n.i18n_warning,content:n.i18n_reset_warning,rtl:u,type:"red",buttons:{warning:{text:n.i18n_continue,keys:["y","enter"],btnClass:"btn-red",action:function(){location.href=t}},close:{keys:["n","esc"],action:function(){}}},draggable:!1,boxWidth:"500px",useBootstrap:!1})}),s("#tab-panel-auto_load_next_post_wizard_tab a.button").click(function(e){var t=s(this).attr("href");e.preventDefault(),s.confirm({icon:"dashicons dashicons-warning",title:n.i18n_warning,content:n.i18n_setup_wizard_warning,rtl:u,type:"red",buttons:{warning:{text:n.i18n_continue,keys:["y","enter"],btnClass:"btn-red",action:function(){location.href=t}},close:{keys:["n","esc"],action:function(){}}},draggable:!1,boxWidth:"500px",useBootstrap:!1})}),s(".auto-load-next-post").on("click",".select_all",function(){return s(this).closest("td").find("select option").attr("selected","selected"),s(this).closest("td").find("select").trigger("change"),!1}),s(".auto-load-next-post").on("click",".select_none",function(){return s(this).closest("td").find("select option").removeAttr("selected"),s(this).closest("td").find("select").trigger("change"),!1}),s(".alnp-enhanced-select").select2({dir:n.is_rtl,minimumResultsForSearch:1/0,placeholder:function(){s(this).data("placeholder")}}),s(".alnp-enhanced-multiselect").select2({dir:n.is_rtl,multiple:!0,placeholder:function(){s(this).data("placeholder")}}),s(".trigger-help").click(function(e){e.preventDefault(),r.length&&(r.is(":visible")?(r.slideUp("fast",function(){r.parent().next().find("button").removeClass("screen-meta-active").attr("aria-expanded",!1),r.parent().hide()}),s(document).trigger("screen:options:close"),s(".need-help").removeClass("hide")):(r.parent().show(),t=t.replace("-","_"),0<i.find("#tab-link-auto_load_next_post_"+t+"_tab").length&&(i.find("li").removeClass("active"),l.find("div").removeClass("active"),i.find("#tab-link-auto_load_next_post_"+t+"_tab").addClass("active").show(),l.find("#tab-panel-auto_load_next_post_"+t+"_tab").addClass("active").show()),r.slideDown("fast",function(){r.focus(),r.parent().next().find("button").addClass("screen-meta-active").attr("aria-expanded",!0)}),s(document).trigger("screen:options:open"),s(".need-help").addClass("hide")))}),s(document).on("screen:options:open",function(){s(".need-help").addClass("hide")}),s(document).on("screen:options:close",function(){s(".need-help").removeClass("hide")})}(jQuery,alnp_settings_params);