PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.9.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.9.0
2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 All 80 releases
ablocks / assets / build / blocks / progress-tracker / view.js

view.js in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.9.0, at assets/build/blocks/progress-tracker/view.js

1 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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=()=>{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)})})})();