AlkantarClanX12
Current Path : /home/thanudqk/siampokernew.org/wp-content/plugins/wp-optimize/js/ |
Current File : //home/thanudqk/siampokernew.org/wp-content/plugins/wp-optimize/js/wpoadmin-3-1-4.min.js |
jQuery(document).ready(function(t){WP_Optimize=WP_Optimize(),"undefined"!=typeof WP_Optimize_Cache&&(WP_Optimize_Cache=WP_Optimize_Cache()),"undefined"!=typeof wp_optimize.minify&&(WP_Optimize_Minify=wp_optimize.minify.init())}),function(t){var e=[];t.fn.form_errors=function(){return this},t.fn.form_errors.add=function(t,i){!1===this.has_error(t)&&e.push({type:t,message:i})},t.fn.form_errors.remove=function(t){var i=this.has_error(t);i!==!1&&e.splice(i,1)},t.fn.form_errors.has_error=function(i){var o=!1;return t.each(e,function(t,e){console.log(t,e),i==e.type&&(o=t)}.bind(this)),o},t.fn.form_errors.has_errors=function(){return e.length>0}}(jQuery);var WP_Optimize=function(){function t(){if(D("#enable-schedule").length){var t=D("#enable-schedule").is(":checked");t?D("#wp-optimize-auto-options").css("opacity","1"):D("#wp-optimize-auto-options").css("opacity","0.5")}}function e(t,e,i){e="undefined"==typeof e?"#wp-optimize-wrap":e,i="undefined"==typeof i?15:i,D(t).hide().prependTo(e).slideDown("fast").delay(1e3*i).slideUp("fast",function(){D(this).remove()})}function i(t,i){var o={type:t,enable:i?1:0};D("#"+t+"_spinner").show(),T("enable_or_disable_feature",o,function(i){if(D("#"+t+"_spinner").hide(),i&&i.hasOwnProperty("output"))for(var o=0,n=i.output.length;o<n;o++){var a='<div class="updated"><p>'+i.output[o]+"</p></div>";e(a,"#"+t+"_notice")}})}function o(t){t?D("#wp-optimize-wrap").addClass("wpo-mobile-menu-opened"):D("#wp-optimize-wrap").removeClass("wpo-mobile-menu-opened")}function n(){if(!S){var t=D(".wpo-page[data-whichpage=WP-Optimize]"),e=t.find(".wpo_shade");e.removeClass("hidden"),T("get_database_tabs",{},function(e){S=!0,e.hasOwnProperty("optimizations")&&t.find(".wp-optimize-optimizations-table-placeholder").replaceWith(e.optimizations),w(e),D(document).trigger("wpo_database_tabs_loaded")}).always(function(){e.addClass("hidden")})}}function a(t){var e="",t="undefined"==typeof t?"string":t,i=D("#wp-optimize-database-settings form input[name!='action'], #wp-optimize-database-settings form select, #wp-optimize-database-settings form textarea, #wp-optimize-general-settings form input[name!='action'], #wp-optimize-general-settings form textarea, #wp-optimize-general-settings form select, #wp-optimize-nav-tab-contents-optimize input[type='checkbox'], .wp-optimize-nav-tab-contents input[name^='enable-auto-backup-']");return"object"==t?e=i.serializeJSON({useIntKeysAsArrayIndex:!0}):(e=i.serialize(),D.each(D('#wp-optimize-database-settings form input[type=checkbox], #wp-optimize-general-settings form input[type=checkbox], .wp-optimize-nav-tab-contents input[name^="enable-auto-backup-"]').filter(function(t){return 0==D(this).prop("checked")}),function(t,i){var o="0";e+="&"+D(i).attr("name")+"="+o})),e}function s(){T("optimizations_done",{},function(){})}function p(){if(!q.get_lock())return void(W>0&&console.log("WP-Optimize: process_queue(): queue is currently locked - exiting"));W>0&&console.log("WP-Optimize: process_queue(): got queue lock");var t=q.peek();return"object"==typeof t?(data=t,t=t.optimization_id):data={},"undefined"==typeof t?(W>0&&console.log("WP-Optimize: process_queue(): queue is apparently empty - exiting"),q.unlock(),void s()):(W>0&&console.log("WP-Optimize: process_queue(): processing item: "+t),q.dequeue(),D(document).trigger(["do_optimization_",t,"_start"].join("")),void T("do_optimization",{optimization_id:t,data:data},function(e){if(D("#optimization_spinner_"+t).hide(),D("#optimization_checkbox_"+t).show(),D(".optimization_button_"+t).prop("disabled",!1),D(document).trigger(["do_optimization_",t,"_done"].join(""),e),e){for(var i="",o=0,n=e.errors.length;o<n;o++)i+='<span class="error">'+e.errors[o]+"</span><br>";for(var o=0,n=e.messages.length;o<n;o++)i+=e.errors[o]+"<br>";for(var o=0,n=e.result.output.length;o<n;o++)i+=e.result.output[o]+"<br>";if(D("#optimization_info_"+t).html(i),e.hasOwnProperty("status_box_contents")&&D("#wp_optimize_status_box").css("opacity","1").find(".inside").html(e.status_box_contents),e.hasOwnProperty("table_list")&&D("#wpoptimize_table_list tbody").html(D(e.table_list).find("tbody").html()),e.hasOwnProperty("total_size")&&D("#optimize_current_db_size").html(e.total_size),"optimizetables"==t&&data.optimization_table&&(q.is_empty()?(D("#optimization_spinner_"+t).hide(),D("#optimization_checkbox_"+t).show(),D(".optimization_button_"+t).prop("disabled",!1),D("#optimization_info_"+t).html(wpoptimize.optimization_complete)):(D("#optimization_checkbox_"+t).hide(),D("#optimization_spinner_"+t).show(),D(".optimization_button_"+t).prop("disabled",!0))),e.result.meta&&e.result.meta.hasOwnProperty("awaiting_mod")){var a=e.result.meta.awaiting_mod;a>0?D("#adminmenu .awaiting-mod .pending-count").remove(a):D("#adminmenu .awaiting-mod").remove()}}setTimeout(function(){q.unlock(),p()},10)}))}function r(t){var e=D("#wp-optimize-nav-tab-contents-optimize .wp-optimize-settings-"+t);e||console.log("do_optimization: row corresponding to this optimization ("+t+") not found");var i={},o=0;if(D('input[type="checkbox"]',D("#optimization_info_"+t)).each(function(){var t=D(this);t.is(":checked")&&(i[t.attr("name")]=t.val(),o++)}),1!=D(".optimization_button_"+t).prop("disabled")){if(D("#optimization_checkbox_"+t).hide(),D("#optimization_spinner_"+t).show(),D(".optimization_button_"+t).prop("disabled",!0),D("#optimization_info_"+t).html("..."),"optimizetables"==t){var n=D("#wpoptimize_table_list #the-list tr");D(n).each(function(e){var i=(D(this).find("td"),D(this).data("type")),o=D(this).data("tablename"),n=D(this).data("optimizable");if(""!=o&&(1==parseInt(n)||F)){var a={optimization_id:t,optimization_table:o,optimization_table_type:i,optimization_force:F};q.enqueue(a)}})}else if(o>0){data={optimization_id:t};for(var a in i)i.hasOwnProperty(a)&&(data[a]=i[a]);q.enqueue(data)}else q.enqueue(t);p()}}function l(t){D("#wpo_settings_sites_list").length?T("save_site_settings",{"wpo-sites":c()},function(){t&&t()}):t&&t()}function c(){var t=[];return D('#wpo_settings_sites_list input[type="checkbox"]').each(function(){var e=D(this);e.is(":checked")&&t.push(e.attr("value"))}),t}function _(){var t=!1;D("#enable-auto-backup").is(":checked")&&(t=!0),u(),1==t?d(h):h()}function d(t,e){"undefined"==typeof e&&(e="");var i=e?0:1;"function"==typeof updraft_backupnow_inpage_go?updraft_backupnow_inpage_go(function(){D("#updraft-backupnow-inpage-modal").dialog("close"),t&&t()},e,"autobackup",0,i,0,wpoptimize.automatic_backup_before_optimizations):t&&t()}function u(){var t=a("object");t.auto_backup=D("#enable-auto-backup").is(":checked"),T("save_auto_backup_option",t)}function m(t,e,i,o){t.on("click",function(){return e.hasClass("wpo_always_visible")||e.toggleClass("wpo_hidden"),!1}),f(i,o)}function f(t,e){t.on("change",function(){t.is(":checked")?e.prop("checked",!0):e.prop("checked",!1),g(t,e)}),e.on("change",function(){g(t,e)}),g(t,e)}function g(t,e){var i=0,o=0;if(e.each(function(){D(this).is(":checked")&&o++,i++}),t.next().is("label")&&t.next().data("label")){var n=t.next(),a=n.data("label");i==o?n.text(a):n.text(a.replace("all",[o," of ",i].join("")))}i==o?t.prop("checked",!0):t.prop("checked",!1)}function h(){$optimizations=D("#optimizations_list .optimization_checkbox:checked"),$optimizations.sort(function(t,e){return t=D(t).closest(".wp-optimize-settings").data("optimization_run_sort_order"),e=D(e).closest(".wp-optimize-settings").data("optimization_run_sort_order"),t>e?1:t<e?-1:0});var t={};$optimizations.each(function(e){var i=D(this).closest(".wp-optimize-settings").data("optimization_id");return i?(t[i]={active:1},void r(i)):void console.log("Optimization ID corresponding to pressed button not found")}),T("save_manual_run_optimization_options",t)}function w(t){if(t.hasOwnProperty("table_list")){var e=!0,i=function(t){D("#wpoptimize_table_list tbody").css("opacity","1")};D("#wpoptimize_table_list tbody").remove(),D("#wpoptimize_table_list thead").after(t.table_list),D("#wpoptimize_table_list").trigger("updateAll",[e,i])}t.hasOwnProperty("total_size")&&D("#optimize_current_db_size").html(t.total_size),t.hasOwnProperty("show_innodb_force_optimize")&&D(".innodb_force_optimize--container").toggleClass("hidden",!t.show_innodb_force_optimize),P(),z(A)}function b(t){var e=t.next(),i=e.next(),o=t.data("table"),n=t.data("type"),a={optimization_id:"optimizetables",optimization_table:o,optimization_table_type:n};t.hide(),A&&(a.optimization_force=!0),e.removeClass("visibility-hidden"),T("do_optimization",{optimization_id:"optimizetables",data:a},function(o){if(o.result.meta.tableinfo){var n=t.closest("tr"),a=o.result.meta,s=a.tableinfo;v(n,s),D("#wpoptimize_table_list > tbody:last th:eq(6)").html(['<span style="color:',a.overhead>0?"#0000FF":"#004600",'">',a.overhead_formatted,"</span>"].join(""))}t.prop("disabled",!1),e.addClass("visibility-hidden"),i.show().removeClass("visibility-hidden").delay(2500).fadeOut("fast",function(){t.show()})})}function v(t,e){D("td:eq(2)",t).text(e.rows),D("td:eq(3)",t).text(e.data_size),D("td:eq(4)",t).text(e.index_size),D("td:eq(5)",t).text(e.type),e.is_optimizable?D("td:eq(6)",t).html(['<span style="color:',e.overhead>0?"#0000FF":"#004600",'">',e.overhead,"</span>"].join("")):D("td:eq(6)",t).html('<span color="#0000FF">-</span>')}function z(t){D(".run-single-table-optimization").each(function(){var e=D(this);e.data("disabled")&&(t?e.prop("disabled",!1):e.prop("disabled",!0))})}function y(t){var e,i,o;if(t)for(e in t)t.hasOwnProperty(e)&&(i=["#wp-optimize-settings-",t[e].dom_id].join(""),o=t[e].info?t[e].info.join("<br>"):"",D(i+" .wp-optimize-settings-optimization-info").html(o))}function k(){var t=["",c().join("_")].join("");H.hasOwnProperty(t)?y(H[t]):T("get_optimizations_info",{"wpo-sites":c()},function(e){e&&(H[t]=e,y(e))})}function x(t){var e=D("#wpo_import_spinner"),i=D("#wpo_import_success_message"),o=D("#wpo_import_error_message");e.show(),T("import_settings",{settings:t},function(t){e.hide(),t&&t.errors&&t.errors.length?(o.text(t.errors.join("<br>")),o.slideDown()):t&&t.messages&&t.messages.length&&(i.text(t.messages.join("<br>")),i.slideDown(),setTimeout(function(){window.location.reload()},500)),D("#wpo_import_settings_btn").prop("disabled",!1)})}function O(t,e){var i=document.body.appendChild(document.createElement("a")),o=new Date,n=o.getFullYear(),a=o.getMonth()<10?["0",o.getMonth()].join(""):o.getMonth(),s=o.getDay()<10?["0",o.getDay()].join(""):o.getDay();e=e?e:["wpo-settings-",n,"-",a,"-",s,".json"].join(""),i.setAttribute("download",e),i.setAttribute("style","display:none;"),i.setAttribute("href","data:text/json;charset=UTF-8,"+encodeURIComponent(JSON.stringify(t))),i.click()}function C(){var t=V.next(),e=t.next(),i=V.data("table"),o={optimization_id:"orphanedtables",optimization_table:i};t.removeClass("visibility-hidden"),T("do_optimization",{optimization_id:"orphanedtables",data:o},function(t){if(t.result.meta.success){var o=V.closest("tr");e.show().removeClass("visibility-hidden"),setTimeout(function(){o.fadeOut("slow",function(){o.remove(),P()})},500)}else{var n=wpoptimize.table_was_not_deleted.replace("%s",i);t.result.meta.message&&(n+="("+t.result.meta.message+")"),alert(n)}}).always(function(){V.prop("disabled",!1),t.addClass("visibility-hidden")})}function P(){var t=D("#wpoptimize_table_list"),e=!0;D("tr",t).each(function(){var t=D(this);if(D("button",t).length>0)return e=!1,!1}),D("tr",t).each(function(){var t=D(this);e?D("td:last, th:last",t).hide():D("td:last, th:last",t).show()})}function j(t,e){var i=t.val(),o=t.data("validate");if(!o&&e)return""!=D.trim(i);if(o&&!e&&""==D.trim(i))return!0;var n=!0;switch(o){case"email":for(var a=/\S+@\S+\.\S+/,s=i.split(","),p="",r=0;r<s.length;r++)p=D.trim(s[r]),""!=p&&a.test(p)||(n=!1);break;case"url":var a=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i;n=a.test(i)}return n}var D=jQuery,W=0,q=new Updraft_Queue,T=wp_optimize.send_command,F=!1,A=!1;f(D("#select_all_optimizations"),D("#optimizations_list .optimization_checkbox")),t(),D("#enable-schedule").change(function(){t()}),D.tablesorter.addParser({id:"sizes",is:function(t){return!1},format:function(t,e,i){var o=D(i).data("raw_value");return o||(o=0),parseInt(o)},type:"numeric"}),D(document).on("wpo_database_tabs_loaded",function(){var t=D("#wpoptimize_table_list_filter"),e=D("#wpoptimize_table_list"),i=D("#wpoptimize_table_list tbody:last"),o=D("#wpoptimize_table_list_tables_not_found");e.tablesorter({theme:"default",widgets:["zebra","rows","filter"],cssInfoBlock:"tablesorter-no-sort",headers:{2:{sorter:"digit"},3:{sorter:"sizes"},4:{sorter:"sizes"},7:{sorter:!1}},widgetOptions:{filter_external:t,filter_defaultFilter:{2:"~{query}"}}}),e.on("filterEnd",function(){var n=D.trim(t.val());""==n?i.show():i.hide(),0==D("#the-list tr:visible",e).length?o.show():o.hide()});var n=D("#innodb_force_optimize"),a=n.closest("tr"),s=D("#innodb_force_optimize_single");n.on("change",function(){D('button, input[type="checkbox"]',a).each(function(){F=n.is(":checked");var t=D(this);t.data("disabled")&&(F?t.prop("disabled",!1):t.prop("disabled",!0))})}),s.on("change",function(){A=D(this).is(":checked"),z(A)}),A=s.is(":checked"),F=n.is(":checked"),z(A)}),D("#wp-optimize-disable-enable-trackbacks-enable").click(function(){i("trackbacks",!0)}),D("#wp-optimize-disable-enable-trackbacks-disable").click(function(){i("trackbacks",!1)}),D("#wp-optimize-disable-enable-comments-enable").click(function(){i("comments",!0)}),D("#wp-optimize-disable-enable-comments-disable").click(function(){i("comments",!1)}),D(".wpo-pages-menu").on("click","a",function(t){t.preventDefault(),D(this).is(".active")||(D(".wpo-pages-menu a.active").removeClass("active"),D(".wpo-page.active").removeClass("active"),D(this).addClass("active"),D('.wpo-page[data-whichpage="'+D(this).data("menuslug")+'"]').addClass("active"),window.scroll(0,0),D("#wp-optimize-wrap").trigger("page-change",{page:D(this).data("menuslug")})),D("#wp-optimize-nav-page-menu").trigger("click")}),D("#wp-optimize-wrap").on("page-change",function(t,e){"WP-Optimize"==e.page&&D("#wp-optimize-nav-tab-WP-Optimize-optimize").is(".nav-tab-active")&&D("#wp-optimize-nav-tab-WP-Optimize-optimize").trigger("click");var i=D(".wpo-page[data-whichpage="+e.page+"]").find(".nav-tab-wrapper .nav-tab-active");D("#wp-optimize-wrap").trigger("tab-change",{page:e.page,tab:i.data("tab")}),D("#wp-optimize-wrap").trigger("tab-change/"+e.page+"/"+i.data("tab"),{content:D("#"+i.attr("id")+"-contents")})}),setTimeout(function(){D("#wp-optimize-wrap").trigger("page-change",{page:D(".wpo-pages-menu a.active").data("menuslug")})},500),D(".nav-tab-wrapper .nav-tab").click(function(t){t.preventDefault();var e=D(this).attr("id"),i=D(this).closest(".nav-tab-wrapper");if(e){if(o(!1),D(this).is('[role="toggle-menu"]'))return void o(!0);i.find(".nav-tab:not(#wp-optimize-nav-tab-"+e+")").removeClass("nav-tab-active"),D(this).addClass("nav-tab-active"),D(this).closest(".wpo-page").find(".wp-optimize-nav-tab-contents").hide(),D("#"+e+"-contents").show(),D("#wp-optimize-wrap").trigger("tab-change",{page:D(this).data("page"),tab:D(this).data("tab")}),D("#wp-optimize-wrap").trigger("tab-change/"+D(this).data("page")+"/"+D(this).data("tab"),{content:D("#"+e+"-contents")})}}),D("#wp-optimize-nav-page-menu").on("click",function(t){t.preventDefault(),D(this).toggleClass("opened")}),D("#wp-optimize-wrap").on("click",".js--wpo-goto",function(t){t.preventDefault();var e=D(this).data("page"),i=D(this).data("tab");e&&D('.wpo-pages-menu a[data-menuslug="'+e+'"]').trigger("click"),i&&D('.wpo-page.active .nav-tab-wrapper a[data-tab="'+i+'"]').trigger("click")});var S=!1;D("#wp-optimize-wrap").on("tab-change/WP-Optimize/tables",function(t){n()}),D("#wp-optimize-wrap").on("tab-change/WP-Optimize/optimize",function(t,e){n()}),D("#wp-optimize-wrap").on("tab-change/wpo_settings/settings",function(t,e){e.content.find(".innodb_force_optimize--container").length&&n()}),D("#wp-optimize-nav-tab-WP-Optimize-optimize-contents").on("click","button.wp-optimize-settings-optimization-run-button",function(){var t=D(this).closest(".wp-optimize-settings").data("optimization_id");return t?void(1!=D(".optimization_button_"+t).prop("disabled")&&(D(".optimization_button_"+t).prop("disabled",!0),l(function(){D(".optimization_button_"+t).prop("disabled",!1),r(t)}))):void console.log("Optimization ID corresponding to pressed button not found")}),D("#wp-optimize-nav-tab-WP-Optimize-optimize-contents").on("click","#wp-optimize",function(t){var e=D(this);t.preventDefault(),e.prop("disabled",!0),l(function(){e.prop("disabled",!1),_()})});var I=D("#wpo_settings_sites_list"),$=I.find("ul").first(),U=D('input[type="checkbox"]',$),Q=I.find("#wpo_all_sites"),M=D("#wpo_sitelist_show_moreoptions"),N=D("#wpo_sitelist_moreoptions"),E=D("#wpo_settings_sites_list_cron"),J=E.find("ul").first(),R=D('input[type="checkbox"]',J),Y=E.find("#wpo_all_sites_cron"),B=D("#wpo_sitelist_show_moreoptions_cron"),K=D("#wpo_sitelist_moreoptions_cron");m(M,N,Q,U);var G=0;D([Q,U]).each(function(){D(this).on("change",function(){G++,setTimeout(function(){G--,0==G&&k()},1e3)})}),m(B,K,Y,R),D("#wp_optimize_table_list_refresh").click(function(t){t.preventDefault();var e=D(this).closest(".wpo-tab-postbox").find(".wpo_shade");e.removeClass("hidden"),D("#wpoptimize_table_list tbody").css("opacity","0.5"),T("get_table_list",{refresh_plugin_json:!0},w).always(function(){e.addClass("hidden")})}),D("#database_settings_form, #settings_form").on("click",".wpo-save-settings",function(t){t.preventDefault();var i=D(this).closest("form"),o=i.find(".wpo-saving-settings"),n=a();i.trigger("wpo-saving-form-data"),i.form_errors.has_errors()||(o.show(),D("#optimizations_list").length&&D("#optimizations_list .optimization_checkbox:checked").each(function(){var t=D(this).closest(".wp-optimize-settings").data("optimization_id");t&&(n+="&optimization-options["+t+"][active]=1")}),T("save_settings",n,function(t){if(i.closest("form").find(".save-done").show().delay(5e3).fadeOut(),t&&t.hasOwnProperty("save_results")&&t.save_results&&t.save_results.hasOwnProperty("errors")){for(var o=0,n=t.save_results.errors.length;o<n;o++){var a='<div class="error">'+t.errors[o]+"</div>";e(a,"#wp-optimize-settings-save-results")}console.log(t.save_results.messages)}t&&t.hasOwnProperty("status_box_contents")&&D(t.status_box_contents).each(function(t,e){D(e).is("#wp_optimize_status_box")&&D("#wp_optimize_status_box").replaceWith(D(e))}),t&&t.hasOwnProperty("optimizations_table")&&D("#optimizations_list").replaceWith(t.optimizations_table),t.save_results.refresh&&location.reload()}).always(function(){o.hide()}))}),D("#settings_form").on("click",".wpo-wipe-settings",function(){var t=D(this).parent().find(".wpo_spinner");t.show(),T("wipe_settings",{},function(){t.next().removeClass("display-none").delay(5e3).fadeOut(),alert(wpoptimize.settings_have_been_deleted_successfully),location.replace(wpoptimize.settings_page_url)}).always(function(){t.hide()})}),D("#wp-optimize-wrap").on("click","#wp_optimize_status_box_refresh",function(t){t.preventDefault(),D("#wp_optimize_status_box").css("opacity","0.5"),T("get_status_box_contents",null,function(t){D("#wp_optimize_status_box").css("opacity","1"),D(t).each(function(t,e){D(e).is("#wp_optimize_status_box")&&D("#wp_optimize_status_box").replaceWith(D(e))})})});var H={};D("#wpo_import_settings_btn").on("click",function(t){var e=D("#wpo_import_settings_file"),i=e.val(),o=e[0].files[0],n=new FileReader;return D("#wpo_import_settings_btn").prop("disabled",!0),/\.json$/.test(i)?(n.onload=function(){x(this.result)},n.readAsText(o),!1):(t.preventDefault(),D("#wpo_import_settings_btn").prop("disabled",!1),D("#wpo_import_error_message").text(wpoptimize.please_select_settings_file).slideDown(),!1)}),D("#wpo_import_settings_file").on("change",function(){D("#wpo_import_error_message").slideUp()}),D("#wpo_export_settings_btn").on("click",function(t){return O(a("object")),!1});var L=function(t,e,i){return T("get_optimization_info",{optimization_id:e,data:i},function(i){var o=i&&i.result&&i.result.meta?i.result.meta:{},n=i&&i.result&&i.result.output?i.result.output.join("<br>"):"...";D(document).trigger(["optimization_get_info_",e].join(""),n),t.html(n),o.finished?D(document).trigger(["optimization_get_info_",e,"_done"].join(""),i):setTimeout(function(){L(t,e,o)},1)})};D(document).ready(function(){D(".wp-optimize-optimization-info-ajax").each(function(){var t=D(this),e=t.parent(),i=t.data("id");D(document).trigger(["optimization_get_info_",i,"_start"].join("")),L(e,i,{support_ajax_get_info:!0})})}),D("#wpoptimize_table_list").on("click",".run-single-table-optimization",function(){var t=D("#enable-auto-backup-1"),e=D(this);t.is(":checked")?d(function(){b(e)}):b(e)}),D("#wpoptimize_table_list").on("click",".run-single-table-repair",function(){var t=D(this),e=t.next(),i=e.next(),o=t.data("table"),n={optimization_id:"repairtables",optimization_table:o};e.removeClass("visibility-hidden"),T("do_optimization",{optimization_id:"repairtables",data:n},function(n){if(n.result.meta.success){var a=t.closest("tr"),s=n.result.meta.tableinfo;t.prop("disabled",!1),e.addClass("visibility-hidden"),i.show().removeClass("visibility-hidden"),v(a,s),setTimeout(function(){var e=t.closest("td"),i=t.closest(".wpo_button_wrap");i.fadeOut("fast",function(){i.closest(".wpo_button_wrap").remove(),s.is_type_supported&&D(".wpo_button_wrap",e).removeClass("wpo_hidden")}),P()},1e3)}else t.prop("disabled",!1),e.addClass("visibility-hidden"),alert(wpoptimize.table_was_not_repaired.replace("%s",o))})});var V;return D("#wpoptimize_table_list").on("click",".run-single-table-delete",function(){V=D(this);var t=D("#enable-auto-backup-1");wp_optimize.modal.open({className:"wpo-confirm",events:{"click .wpo-modal--bg":"close","click .delete-table":"deleteTable","change #confirm_deletion_without_backup":"changeConfirm","change #confirm_table_deletion":"changeConfirm"},content:function(){var e=wp.template("wpo-table-delete"),i=V.closest("tr").find(".table-plugins").html();return e({no_backup:!t.is(":checked"),plugins_list:i,table_name:V.data("table")})},changeConfirm:function(){var t=!0,e=this.$("#confirm_deletion_without_backup"),i=this.$("#confirm_table_deletion");e.length&&!e.is(":checked")&&(t=!1),i.is(":checked")||(t=!1),this.$(".delete-table").prop("disabled",!t)},deleteTable:function(){t.is(":checked")?d(C):C(),this.close()}})}),P(),D("#wp-optimize-general-settings").on("wpo-saving-form-data",function(){var t=!0,e=D(this);D(".wpo_logger_addition_option, .wpo_logger_type").each(function(){j(D(this),!0)?D(this).removeClass("wpo_error_field"):(t=!1,D(this).addClass("wpo_error_field"))}),t?(e.form_errors.remove("missing-fields"),D("#wp-optimize-logger-settings .save_settings_reminder").slideUp()):(e.form_errors.add("missing-fields",""),D("#wp-optimize-settings-save-results").show().addClass("wpo_alert_notice").text(wpoptimize.fill_all_settings_fields).delay(5e3).fadeOut(3e3,function(){D(this).removeClass("wpo_alert_notice")}))}),setTimeout(function(){T("check_overdue_crons",null,function(t){t&&t.hasOwnProperty("m")&&D("#wpo_settings_warnings").append(t.m)})},11e3),D(".wpo-introduction-notice .notice-dismiss, .wpo-introduction-notice .close").on("click",function(t){D(".wpo-introduction-notice").remove(),T("dismiss_install_or_update_notice",null,function(t){t&&t.hasOwnProperty("error")&&console.log("There was an error dismissing the install or update notice (dismiss_install_or_update_notice)",t)})}),{send_command:T,optimization_get_info:L,take_a_backup_with_updraftplus:d,save_auto_backup_options:u}};jQuery(document).ready(function(t){function e(e){var i=["#",e.data("additional")].join("");e.is(":checked")?t(i).show():t(i).hide()}function i(){var e=t("#wp-optimize-logger-settings .save_settings_reminder");e.is(":visible")||e.slideDown("normal")}function o(){t(".wpo_logger_type").each(function(){n(t(this))})}function n(e){var i,o,n=a();for(i in n)o=n[i],wpoptimize.loggers_classes_info[o].allow_multiple?t('option[value="'+o+'"]',e).show():t('option[value="'+o+'"]',e).hide()}function a(){var e=[];return t(".wpo_logging_row, .wpo_logger_type").each(function(){var i=t(this).is("select")?t(this).val():t(this).data("id");i&&e.push(i)}),e}function s(){var t,e=['<option value="">Select destination</option>'];for(t in wpoptimize.loggers_classes_info)wpoptimize.loggers_classes_info.hasOwnProperty(t)&&wpoptimize.loggers_classes_info[t].available&&e.push(['<option value="',t,'">',wpoptimize.loggers_classes_info[t].description,"</option>"].join(""));return['<div class="wpo_add_logger_form">','<select class="wpo_logger_type" name="wpo-logger-type[]">',e.join(""),"<select>",'<a href="#" class="wpo_delete_logger dashicons dashicons-no-alt"></a>','<div class="wpo_additional_logger_options"></div>',"</div>"].join("")}function p(e){if(!wpoptimize.loggers_classes_info[e].options)return"";var i,o=wpoptimize.loggers_classes_info[e].options,n=[],a="",s="";for(i in o)o.hasOwnProperty(i)&&(t.isArray(o[i])?(a=t.trim(o[i][0]),s=t.trim(o[i][1])):(a=t.trim(o[i]),s=""),n.push(['<input class="wpo_logger_addition_option" type="text" name="wpo-logger-options[',i,'][]" value="" ','placeholder="',a,'" ',""!==s?'data-validate="'+s+'"':"","/>"].join("")));return n.push('<input type="hidden" name="wpo-logger-options[active][]" value="1" />'),n.join("")}t(".wp-optimize-logging-settings").each(function(){var i=t(this);e(i),i.on("change",function(){e(i)})});var r=t("#wpo_add_logger_link");r.on("click",function(e){e.preventDefault(),t("#wp-optimize-logger-settings .save_settings_reminder").after(s()),n(t(".wpo_logger_type").first())}),t("#wp-optimize-general-settings").on("change",".wpo_logger_type",function(){var e=t(this),o=e.val(),n=e.parent().find(".wpo_additional_logger_options");n.html(p(o)),e.val()&&i()}),t(".wpo_logging_actions_row .dashicons-edit").on("click",function(){var e=t(this),i=e.closest(".wpo_logging_row");return t(".wpo_additional_logger_options",i).removeClass("wpo_hidden"),t(".wpo_logging_options_row",i).text(""),t(".wpo_logging_status_row",i).text(""),e.hide(),!1}),t("#wp-optimize-logger-settings").on("change",".wpo_logger_addition_option",function(){i()}),t(".wpo_logger_active_checkbox").on("change",function(){var e=t(this),i=e.closest("label").find('input[type="hidden"]');i.val(e.is(":checked")?"1":"0")}),t("#wp-optimize-general-settings").on("click",".wpo_delete_logger",function(){if(!confirm(wpoptimize.are_you_sure_you_want_to_remove_logging_destination))return!1;var e=t(this);return e.closest(".wpo_logging_row, .wpo_add_logger_form").remove(),o(),0==t("#wp-optimize-logging-options .wpo_logging_row").length&&t("#wp-optimize-logging-options").hide(),i(),!1});var l=!1;t(window).on("scroll",function(e){window.requestAnimationFrame(function(){var e=t(".wpo-main-header").length?t(".wpo-main-header")[0].offsetTop:0;window.pageYOffset>e-20!=l&&(l=!l,t("body").toggleClass("is-scrolled",l))})}),t(".wpo-info__trigger").on("click",function(e){e.preventDefault();var i=t(this).closest(".wpo-info");i.toggleClass("opened")}),t(".wpo-video-preview a").on("click",function(e){var i=t(this).data("embed");if(i){e.preventDefault();var o=t('<iframe width="356" height="200" allowfullscreen webkitallowfullscreen mozallowfullscreen>').attr("src",i);o.insertAfter(t(this)),t(this).remove(),o.focus()}})});