| @@ -1 +1,2 @@ | ||
| 1 | -(()=>{"use strict";document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".ablocks-block--progress-tracker").forEach((t=>{!function(t,e=!1){const o=t?.querySelector(".ablocks-block-progress-bar"),r=t?.querySelector(".ablocks-block-progress-circle"),s=t?.getAttribute("data-layout"),n=t?.getAttribute("data-direction"),c=t?.getAttribute("data-progress-relative"),l=t?.getAttribute("data-progress-relative-selector"),i=t?.querySelector(".ablocks-block-progress__text"),a=r?.querySelector(".ablocks-block-progress-circle__svg-bar"),d=t=>{const r=Math.min(Math.max(Math.floor(t),0),100);"bar"===s?(t=>{o&&(o.style.width=`${t}%`),i&&e&&(i.textContent=`${Math.round(t)}%`)})(r):"circle"===s&&(t=>{if(i&&e&&(i.textContent=`${Math.round(t)}%`),a){const e=a.getAttribute("r"),o=2*Math.PI*e,r=o-t/100*o;"left"===n?a.style.strokeDashoffset=`-${r}`:"right"===n&&(a.style.strokeDashoffset=r)}})(r)},u=()=>{const t=window.scrollY,e=window.innerHeight,o=document.documentElement.scrollHeight;d(t/(o-e)*100)},g=()=>{const t=document.querySelector(l);if(!t)return;const e=t.getBoundingClientRect().top,o=t.offsetHeight,r=window.innerHeight;if(0!==o)if(e<r&&e+o>0){const t=Math.min(r-e,o),s=Math.max(0,Math.min(100,t/o*100));d(t>=o?100:s)}else d(0);else d(0)};"entire_page"===c?window.addEventListener("scroll",u):"selector"===c&&l&&window.addEventListener("scroll",g),u(),l&&g()}(t,!0)}))}))})(); | |
| 1 | +(()=>{"use strict";document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".ablocks-block--progress-tracker").forEach(t=>{!function(t,e=!1){const r=t?.querySelector(".ablocks-block-progress-bar"),o=t?.querySelector(".ablocks-block-progress-circle"),n=t?.getAttribute("data-layout"),c=t?.getAttribute("data-direction"),s=t?.getAttribute("data-progress-relative"),l=t?.getAttribute("data-progress-relative-selector"),a=t?.querySelector(".ablocks-block-progress__text"),i=o?.querySelector(".ablocks-block-progress-circle__svg-bar"),u=e?window:document.querySelector('[name="editor-canvas"]')?.contentWindow;if(!u)return;const d=t=>{const e=Math.min(Math.max(Math.floor(t),0),100);"bar"===n?(t=>{r&&(r.style.width=`${t}%`),a&&(a.textContent=`${Math.round(t)}%`)})(e):"circle"===n&&(t=>{if(a&&(a.textContent=`${Math.round(t)}%`),i){const e=parseFloat(i.getAttribute("r")||0);if(!e)return;const r=2*Math.PI*e,o=r-t/100*r;i.style.strokeDashoffset="left"===c?`-${o}`:o}})(e)},g=()=>{ | |
| 2 | +const t=u.scrollY||0,e=u.innerHeight||0,r=(u.document.documentElement.scrollHeight||0)-e;d(r>0?t/r*100:20)},b=()=>{if(!l)return;const e=t?.ownerDocument?.querySelector(l);if(!e)return;const r=e.getBoundingClientRect().top,o=e.offsetHeight,n=u.innerHeight;if(0!==o)if(r<n&&r+o>0){const t=Math.min(n-r,o),e=Math.max(0,Math.min(100,t/o*100));d(t>=o?100:e)}else d(0);else d(0)};"entire_page"===s?u.addEventListener("scroll",g):"selector"===s&&l&&u.addEventListener("scroll",b),g(),l&&b()}(t,!0)})})})(); | |