File manager - Edit - /home/vblioqus/unfreezetiktok.com/wp-content/plugins/kadence-blocks/includes/assets/js/kb-show-more.min.js
Back
(function(){"use strict";window.kadenceShowMore={cache:{},extractVisibleText(a,b){if(!a)return"";if(!b||0>=b)return"";const c=a.hasAttribute("inert");c&&a.removeAttribute("inert");const d=a.getBoundingClientRect(),e=d.top+b,f=[],g=a=>{if("SCRIPT"===a.tagName||"STYLE"===a.tagName||"NOSCRIPT"===a.tagName)return;const c=window.getComputedStyle(a);if("none"===c.display||"hidden"===c.visibility)return;const h=a.getBoundingClientRect();if(h.top>=e)return;let i=!1,j="";for(const b of a.childNodes)if(3===b.nodeType){const a=b.textContent.trim();a&&(i=!0,j+=a+" ")}if(i&&j.trim()){const a=h.top-d.top,c=h.bottom-d.top;if(a<b){if(c>b){const c=(b-a)/h.height,d=j.trim().split(/\s+/),e=Math.max(1,Math.floor(d.length*c));j=d.slice(0,e).join(" ")}f.push({text:j.trim(),top:a})}}for(const b of a.children)g(b)};if(g(a),c&&a.setAttribute("inert",""),0===f.length)return"";f.sort((c,a)=>c.top-a.top);const h=new Set;let i="";for(const c of f){if(h.has(c.text))continue;let a=!1;for(const b of h)if(b.includes(c.text)||c.text.includes(b)){a=!0;break}a||(h.add(c.text),i+=(i?" ":"")+c.text)}return this.cleanupExcerpt(i)},cleanupExcerpt(a){if(!a)return"";let b=a.replace(/<[^>]*>/g,"");if(b=b.replace(/\s+/g," ").trim(),80<b.length){const a=b.lastIndexOf("."),c=b.lastIndexOf("!"),d=b.lastIndexOf("?"),e=Math.max(a,c,d);40<e&&(b=b.substring(0,e+1))}return b},buildScreenReaderText(a,b){const c=window.kbShowMore||{},d=c.contentCollapsed||"Content is collapsed.",e=c.contentContinues||"Content continues.",f=c.activateButton||"Activate the",g=c.buttonToReveal||"button to reveal the full content.",h=c.showMoreDefault||"Show More",i=b||h;return a&&""!==a.trim()?a+" ... "+e+" "+f+" "+i+" "+g:d+" "+f+" "+i+" "+g},getCurrentMaxHeight(a){const b=a.querySelector(".wp-block-kadence-column.kb-show-more-content");if(!b)return 250;const c=window.getComputedStyle(b),d=c.maxHeight;if("none"===d)return null;const e=d.match(/([\d.]+)(px|em|rem)/);if(!e)return 250;const f=parseFloat(e[1]),g=e[2];if("px"===g)return f;if("em"===g||"rem"===g){const a=parseFloat(window.getComputedStyle(b).fontSize);return f*a}return 250},getFocusableElements(a){if(!a)return[];const b=Array.from(a.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"], iframe, object, embed, area[href], audio[controls], video[controls], [role=\"button\"]:not([tabindex=\"-1\"]), [role=\"link\"]:not([tabindex=\"-1\"]), [role=\"menuitem\"]:not([tabindex=\"-1\"]), [role=\"menuitemcheckbox\"]:not([tabindex=\"-1\"]), [role=\"menuitemradio\"]:not([tabindex=\"-1\"]), [role=\"option\"]:not([tabindex=\"-1\"]), [role=\"switch\"]:not([tabindex=\"-1\"]), [role=\"tab\"]:not([tabindex=\"-1\"]), [role=\"textbox\"]:not([tabindex=\"-1\"])"));return b.filter(a=>{const b=window.getComputedStyle(a);if("none"===b.display||"hidden"===b.visibility||"0"===b.opacity)return!1;const c=a.getAttribute("tabindex");return"-1"!==c})},disableTabIndex(a){if(a){const b=this.getFocusableElements(a);b.forEach(a=>{document.activeElement===a&&a.blur();const b=a.getAttribute("tabindex");null===b?a.setAttribute("data-had-no-tabindex","true"):a.setAttribute("data-original-tabindex",b),a.setAttribute("tabindex","-1")})}},restoreTabIndex(a){if(a){const b=a.querySelectorAll("[data-original-tabindex], [data-had-no-tabindex]");b.forEach(a=>{const b=a.getAttribute("data-original-tabindex"),c=a.getAttribute("data-had-no-tabindex");null===b?"true"===c&&(a.removeAttribute("tabindex"),a.removeAttribute("data-had-no-tabindex")):(a.setAttribute("tabindex",b),a.removeAttribute("data-original-tabindex"))})}},updateAccessibility(a,b){const c=a.querySelector(".wp-block-kadence-column.kb-show-more-content");if(!c)return;const d=a.querySelector(".kb-show-more-sr-excerpt"),e=a.querySelector(".wp-block-kadence-advancedbtn.kb-show-more-buttons > .wp-block-kadence-singlebtn:nth-of-type(1)"),f=a.querySelector(".wp-block-kadence-advancedbtn.kb-show-more-buttons > .wp-block-kadence-singlebtn:nth-of-type(2)");let g="Show More";if(e){const a=e.querySelector(".kt-btn-inner-text");a&&a.textContent&&(g=a.textContent.trim())}if(b)c.removeAttribute("aria-hidden"),c.removeAttribute("inert"),this.restoreTabIndex(c),d&&(d.textContent="",d.setAttribute("aria-hidden","true")),e&&e.setAttribute("aria-expanded","true"),f&&f.setAttribute("aria-expanded","true");else{if(c.setAttribute("aria-hidden","true"),c.setAttribute("inert",""),this.disableTabIndex(c),d){const b=this.getCurrentMaxHeight(a);if(null!==b){c.removeAttribute("inert");const a=this.extractVisibleText(c,b);c.setAttribute("inert","");const e=this.buildScreenReaderText(a,g);d.textContent=e,d.removeAttribute("aria-hidden")}else d.textContent="",d.setAttribute("aria-hidden","true")}e&&e.setAttribute("aria-expanded","false"),f&&f.setAttribute("aria-expanded","false")}},isDefaultExpanded(a){if(a.classList.contains("kb-smc-open"))return!0;const b=a.querySelector(".wp-block-kadence-column.kb-show-more-content");if(!b)return!1;const c=window.getComputedStyle(b);return"none"===c.maxHeight},ensureExcerptElement(a){let b=a.querySelector(".kb-show-more-sr-excerpt");return b||(b=document.createElement("div"),b.className="kb-show-more-sr-excerpt",b.setAttribute("aria-live","polite"),b.setAttribute("aria-atomic","true"),a.firstChild?a.insertBefore(b,a.firstChild):a.appendChild(b)),b},initShowMore(){if(window.kadenceShowMore.cache=document.querySelectorAll(".wp-block-kadence-show-more, .kb-block-show-more-container"),!!window.kadenceShowMore.cache.length)for(let a=0;a<window.kadenceShowMore.cache.length;a++){const b=window.kadenceShowMore.cache[a];b.classList.contains("wp-block-kadence-show-more")||b.classList.add("wp-block-kadence-show-more"),window.kadenceShowMore.ensureExcerptElement(b);const c=b.querySelector(".wp-block-kadence-column.kb-show-more-content"),d=b.querySelector(".wp-block-kadence-advancedbtn.kb-show-more-buttons > .wp-block-kadence-singlebtn:nth-of-type(1)"),f=b.querySelector(".wp-block-kadence-advancedbtn.kb-show-more-buttons > .wp-block-kadence-singlebtn:nth-of-type(2)"),g="kb-show-more-"+a;c&&!c.id&&(c.id=g+"-content"),d&&!d.id&&(d.id=g+"-show-more",d.setAttribute("aria-controls",g+"-content")),f&&!f.id&&(f.id=g+"-show-less",f.setAttribute("aria-controls",g+"-content"));const h=()=>{const a=window.kadenceShowMore.isDefaultExpanded(b);window.kadenceShowMore.updateAccessibility(b,a)};window.requestAnimationFrame?window.requestAnimationFrame(()=>{setTimeout(h,50)}):setTimeout(h,100);let i;const j=()=>{clearTimeout(i),i=setTimeout(()=>{const a=window.kadenceShowMore.isDefaultExpanded(b);window.kadenceShowMore.updateAccessibility(b,a)},250)};if(window.addEventListener("resize",j),b.querySelector(".wp-block-kadence-advancedbtn.kb-show-more-buttons > .kt-btn-wrap:first-child a")&&(b.querySelector(".wp-block-kadence-advancedbtn.kb-show-more-buttons > .kt-btn-wrap:first-child a").addEventListener("click",function(a){return a.preventDefault(),b.classList.add("kb-smc-open"),window.kadenceShowMore.updateAccessibility(b,!0),!1}),b.querySelector(".wp-block-kadence-advancedbtn.kb-show-more-buttons > .kt-btn-wrap:last-child a").addEventListener("click",function(a){return a.preventDefault(),b.classList.remove("kb-smc-open"),window.kadenceShowMore.updateAccessibility(b,!1),!1})),d){const a=function(a){return a.preventDefault(),b.classList.add("kb-smc-open"),d.setAttribute("aria-hidden","true"),f&&f.removeAttribute("aria-hidden"),window.kadenceShowMore.updateAccessibility(b,!0),!1},c=function(a){return a.preventDefault(),b.classList.remove("kb-smc-open"),d.removeAttribute("aria-hidden"),f&&f.setAttribute("aria-hidden","true"),window.kadenceShowMore.updateAccessibility(b,!1),!1};d.addEventListener("click",a),f&&(f.addEventListener("click",c),f.setAttribute("aria-hidden","true"))}}},init(){window.kadenceShowMore.initShowMore()}},"loading"===document.readyState?document.addEventListener("DOMContentLoaded",window.kadenceShowMore.init):window.kadenceShowMore.init(),document.addEventListener("kadenceJSInitReload",function(){window.kadenceShowMore.init()}),document.addEventListener("kb-query-loaded",function(){window.kadenceShowMore.init()})})();
| ver. 1.4 |
Github
|
.
| PHP 8.2.30 | Generation time: 0.4 |
proxy
|
phpinfo
|
Settings