PluginProbe
Filter Everything — WordPress & WooCommerce Filters / 1.9.7
Filter Everything — WordPress & WooCommerce Filters v1.9.7
1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 All 52 releases
filter-everything / assets / js / wpc-seo-rules-admin.min.js

wpc-seo-rules-admin.min.js in Filter Everything — WordPress & WooCommerce Filters 1.9.7, at assets/js/wpc-seo-rules-admin.min.js

4 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*!
2 * Filter Everything seo rules admin 1.9.7
3 */
4 function insertAtCaret(e,t,n){let s=e.val(),i=s.substring(0,n)+t+s.substring(n);return i=i.replace(/ +(?= )/g,""),e.val(i),!0}!function(e){"use strict";let t=!1;function n(n){let s=e("#publishing-action .spinner"),o={};return s.addClass("is-active"),o.validateData=function(e){for(var t={},n=e.find("select, textarea, input").serializeArray(),s=0;s<n.length;s++)i(t,n[s].name,n[s].value);return t}(n),wp.ajax.post("wpc-validate-seo-rules",o).always(function(){s.removeClass("is-active")}).done(function(e){t=!0,n.submit()}).fail(function(t){let n=[];void 0!==t.errors&&(e.each(t.errors,function(e,t){n.push(t.message)}),n.length<1&&n.push("Error: Set was not saved."),function(t){let n=e("form#post"),s="";e.each(t,function(e,t){s+="<p>"+t+"</p>"});let i='<div id="message" class="wpc-error notice notice-error is-dismissible flrt-notice">'+s+'<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>';void 0!==n&&(e("#message").length>0&&e("#message").remove(),n.before(i))}(n))}),!1}function s(e){e.fadeTo(100,0,function(){e.slideUp(100,function(){e.remove()})})}function i(e,t,n){var s=(t=t.replace("[]","[%%index%%]")).match(/([^\[\]])+/g);if(s)for(var i=s.length,a=e,c=0;c<i;c++){var l=String(s[c]);c==i-1?"%%index%%"===l?a.push(n):a[l]=n:("%%index%%"===s[c+1]?o(a[l])||(a[l]=[]):r(a[l])||(a[l]={}),a=a[l])}}function o(e){return Array.isArray(e)}function r(e){return"object"==typeof e}e.fn.getCursorPosition=function(){var e=this.get(0);if(e){if("selectionStart"in e)return e.selectionStart;if(document.selection){e.focus();var t=document.selection.createRange(),n=document.selection.createRange().text.length;return t.moveStart("character",-e.value.length),t.text.length-n}}},e.fn.createSeoVarsList=function(t){let n='<ul class="wpc-seo-vars-list">';return Object.keys(t).length>0?e.each(t,function(e,t){n+='<li data-seovar="{'+e+'}">'+t+"</li>"}):n+="<li>"+wpcSeoVars.noSeoVarsMsg+"</li>",n+="</ul>",e(this).replaceWith(n),!0},e(document).mouseup(function(t){let n=e(".wpc-vars-container");n.length>0&&(n.is(t.target)||0!==n.has(t.target).length||n.hide())}),e(document).ready(function(){e("form#post").on("submit",function(i){s(e(".wpc-field-notice")),s(e("#message")),t||(i.preventDefault(),n(e(this)))}),e(".wpc-seo-vars-list").createSeoVarsList(wpcSeoVars.seovars),e("body").on("click",".wpc-open-container",function(t){t.preventDefault();let n=e(this).data("field"),s=e("#wpc-vars-container-"+n);e("#wpc_seo_rules-"+n).focus(),s.toggle()}),e("body").on("focus keypress blur",".wpc-vars-insertable",function(t){let n=e(this).getCursorPosition();e(this).data("caret",n)}),e("body").on("click",".wpc-seo-vars-list li",function(){let t=e(this).data("seovar"),n=e(this).parents(".wpc-vars-container");if(void 0!==t){let s=e("#wpc_seo_rules-"+n.data("container")),i=s.data("caret");""===i&&(i=s.val().length),0===i?t+=" ":t=i===s.val().length?" "+t:" "+t+" ",insertAtCaret(s,t,i)}n.hide()}),e("body").on("change","#wpc_seo_rules-rule_post_type",function(){s(e(".wpc-field-notice"));let t=e(this).val(),n=e(".wpc-intersection-fields-wrapper").children(".spinner");n.addClass("is-active");let i={};i._wpnonce=e("#wpc_seo_rule_nonce").val(),i.postType=t,i.postId=e("#post_ID").val(),wp.ajax.post("wpc-get-indexed-filters",i).always(function(){n.removeClass("is-active")}).done(function(t){e("#wpc-intersections-table").replaceWith(t.html),e(".wpc-seo-vars-list").createSeoVarsList(t.seovars)}).fail(function(t){void 0!==t&&function(t,n){let s=e("#"+t),i='<div class="wpc-field-notice wpc-field-notice-error"><p>'+n+"</p></div>";void 0!==s&&s.before(i)}("wpc-intersection-fields-container",t.message)})})})}(jQuery);