You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
11 KiB
JavaScript

!function(){"use strict";var t,a={n:function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,{a:e}),e},d:function(t,e){for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:function(t,a){return Object.prototype.hasOwnProperty.call(t,a)}},e=jQuery,n=a.n(e),i=lodash,r=wp.apiFetch,o=a.n(r);function s(t,a,e){return n().ajax({url:rankMath.ajaxurl,type:e||"POST",dataType:"json",data:n().extend(!0,{action:"rank_math_"+t,security:rankMath.security},a)})}function c(t,a,e,i){a=a||"error",i=i||!1;var r=n()('<div class="notice notice-'+a+' is-dismissible"><p>'+t+"</p></div>").hide();e.next(".notice").remove(),e.after(r),r.slideDown(),n()(document).trigger("wp-updates-notice-added"),i&&setTimeout((function(){r.fadeOut((function(){r.remove()}))}),i)}(t=n())((function(){window.rankMathOptions={init:function(){this.preview(),this.misc(),this.scCache(),rankMathAdmin.variableInserter(),this.searchEngine.init(),this.addressFormat(),this.siteMap(),this.robotsEvents(),this.proRedirect(),this.contentAI(),this.localSEO(),this.htmlSitemap()},searchEngine:{init:function(){t("#setting-panel-analytics").addClass("exclude"),this.form=t(".rank-math-search-options"),this.wrap=this.form.closest(".rank-math-wrap-settings"),this.input=this.form.find("input"),this.tabs=this.wrap.find(".rank-math-tabs"),this.panels=this.wrap.find(".rank-math-tab:not(.exclude)"),this.ids=["general","titles","sitemap"],this.indexes={},this.buildIndex(),this.events()},events:function(){var a=this,e=a.tabs.find(">.rank-math-tabs-navigation"),n=t('<div class="rank-math-search-dropdown"></div>');a.tabs.find(">.rank-math-tabs-content").prepend('<div class="rank-math-setting-search-empty hidden">No results found.</div>'),a.form.append(n),n.hide().empty();var r=(0,i.debounce)((function(t){a.wrap.addClass("searching"),a.searchIndexes(t,n)}),300);a.form.on("click",".clear-search",(function(t){t.preventDefault(),a.input.val(""),a.clearSearch(e)})),this.ids.forEach((function(t){n.append(a.indexes[t])})),a.input.on("input",(function(){if(""===a.input.val())return a.clearSearch(e,n),!1;r(a.input.val().toLowerCase())})),n.on("click",".cmb-row",(function(){var a=t(this),e=window.location.origin+window.location.pathname+"?page=rank-math-options-"+a.data("settings-id")+"#"+a.closest(".dropdown-tab").data("id");e===window.location.href?window.location.reload():window.location=e}));var o=t(".rank-math-search-options, .rank-math-search-options *, .rank-math-search-dropdown, .rank-math-search-dropdown *");t("body").on("click",(function(a){t(a.target).is(o)||n.hide()}))},searchIndexes:function(a,e){if(!(1>a.trim().length)){e.find(".dropdown-tab").each((function(){var a=t(this);"setting-panel-analytics"===a.attr("data-id")&&a.css("display","none")}));var n=e.find(".cmb-row"),i=0;n.hide().each((function(){var e=t(this);e.text().trim().toLowerCase().includes(a)&&(e.show(),++i)})),e.show(),e.toggleClass("empty",0===i)}},clearSearch:function(a,e){e=e||!1,this.wrap.removeClass("searching search-no-results"),t(">a.active",a).trigger("click"),e?e.hide():(t(".cmb-row").show(),t(".rank-math-cmb-dependency",".cmb-form, .rank-math-metabox-wrap").each((function(){rankMathAdmin.loopDependencies(t(this))})))},buildIndex:function(){var a=window.localStorage.getItem("rank-math-option-search-index"),e=void 0===a||a!==rankMath.version;this.ids.forEach((function(a){this.getIndex(a,e),this.indexes[a]=t(window.localStorage.getItem("rank-math-option-"+a+"-index"))}),this),e&&window.localStorage.setItem("rank-math-option-search-index",rankMath.version)},getIndex:function(a,e){e&&t("<div/>").load(rankMath.adminurl+"?page=rank-math-options-"+a,(function(e,n){if("error"!==n){var i=t(e).find(".rank-math-tabs-content");i.find(".rank-math-tab").each((function(){var a=t(this);a.removeClass().addClass("dropdown-tab"),a.attr("data-id",a.attr("id")),a.removeAttr("id"),a.find(".rank-math-notice").remove(),a.find(".rank-math-desc").remove(),a.find("input, select, textarea").remove()})),i.find(".rank-math-tab").removeClass().addClass("dropdown-tab").remov