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
8.7 KiB
JavaScript
1 line
8.7 KiB
JavaScript
7 months ago
|
!function(){"use strict";var t={n:function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=jQuery,n=t.n(e),r=lodash,i=function(t){var e=function(t){var e=(0,r.find)(rankMath.acf.headlines,(function(e,n){return t.key===n}));return e&&(e=parseInt(e,10)),(e<1||e>6)&&(e=!1),e}(t);return t.content=e?"<h"+e+">"+t.content+"</h"+e+">":"<p>"+t.content+"</p>",t},a=function(t){var e=t.$el.find("textarea")[0],n=e.id,r=e.value;return function(t){return"undefined"!=typeof tinyMCE&&void 0!==tinyMCE.editors&&0!==tinyMCE.editors.length&&null!==tinyMCE.get(t)&&!tinyMCE.get(t).isHidden()}(n)&&(r=tinyMCE.get(n)&&tinyMCE.get(n).getContent()||""),r};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,c(r.key),r)}}function c(t){var e=function(t,e){if("object"!==o(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===o(e)?e:String(e)}var l=new(function(){function t(){var e,n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=this,r={},(n=c(n="cache"))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r}var e,n,i;return e=t,(n=[{key:"refresh",value:function(t){var e=this,n=this.getUncached(t);0!==n.length&&window.wp.ajax.post("query-attachments",{query:{post__in:n}}).done((function(t){(0,r.each)(t,(function(t){e.setCache(t.id,t),window.RankMathACFAnalysis.refresh()}))}))}},{key:"get",value:function(t){var e=this.getCache(t);if(!e)return!1;var n=window.wp.media.attachment(t);return n.has("alt")&&(e.alt=n.get("alt")),n.has("title")&&(e.title=n.get("title")),e}},{key:"getAttachmentContent",value:function(t){var e="";if(l.get(t,"attachment")){var n=l.get(t,"attachment");e+='<img src="'+n.url+'" alt="'+n.alt+'" title="'+n.title+'">'}return e}},{key:"setCache",value:function(t,e){this.cache[t]=e}},{key:"getCache",value:function(t){return t in this.cache&&this.cache[t]}},{key:"getUncached",value:function(t){var e=this;return(t=(0,r.uniq)(t)).filter((function(t){return!1===e.get(t)}))}}])&&u(e.prototype,n),i&&u(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}());function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(i=r.key,a=void 0,a=function(t,e){if("object"!==f(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!==f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===f(a)?a:String(a)),r)}var i,a}var p={text:function(t){return t=(0,r.map)(t,(function(t){return"text"!==t.type?t:(t.content=t.$el.find("input[type=text][id^=acf]").val(),t=i(t))}))},textarea:function(t){return t=(0,r.map)(t,(function(t){return"textarea"!==t.type||(t.content="<p>"+t.$el.find("textarea[id^=acf]").val()+"</p>"),t}))},email:function(t){return t=(0,r.map)(t,(function(t){return"email"!==t.type||(t.content=t.$el.find("input[type=email][id^=acf]").val()),t}))},url:function(t){return t=(0,r.map)(t,(function(t){if("url"!==t.type)return t;var e=t.$el.find("input[type=
|