HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux sa-dev.otherchirps.net 5.15.0-139-generic #149-Ubuntu SMP Fri Apr 11 22:06:13 UTC 2025 x86_64
User: www-data (33)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wp-content/plugins/editorplus/assets/scripts/progressbar.js
class EditorPlusProgressBar {
  constructor(wrapper) {
    this.wrapper = wrapper;
    this.progressBar = this.wrapper.querySelector(".ep_pb");
    this.percentage = this.wrapper.querySelector(".ep_pb_percentage");
    this.progressBarPercentage = Number(this.wrapper.dataset.eppercentage);
    this.showPercentage = this.wrapper.dataset.epdpercentage;

    this.count = 0;
    this.initialize();
  }
  initialize() {
    this.observation();
  }
  updateCounter = () => {
    let isPercentageShow = this.showPercentage === "true" ? true : false;
    this.percentageCounter();
    if (isPercentageShow) {
      if (this.count < this.progressBarPercentage) {
        this.percentage.innerHTML = this.count + 1 + "%";
        requestAnimationFrame(this.updateCounter);
      } else {
        cancelAnimationFrame(this.updateCounter);
      }
    }
  };
  percentageCounter() {
    if (this.count < this.progressBarPercentage) {
      this.count++;
    }
  }
  setPercentage() {
    this.progressBar.style.width = this.progressBarPercentage + "%";
    this.progressBar.style.transition = "1.5s";
  }
  observation() {
    const progressBarAnimation = document.querySelectorAll(".ep_pb");
    progressBarAnimation.forEach((animationElem) => {
      animationElem.style.visibility = "hidden";

      const observer = new IntersectionObserver(
        (entries, observer) => {
          const [entry = null] = entries;
          if (
            entry &&
            entry.isIntersecting &&
            animationElem.isSameNode(this.progressBar)
          ) {
            animationElem.style.visibility = "visible";
            this.setPercentage();
            let counter = requestAnimationFrame(this.updateCounter);
            observer.disconnect();
          }
        },
        {
          rootMargin: "0px",
          threshold: 1.0,
        }
      );
      observer.observe(animationElem);
    });
  }
}
window.addEventListener("load", () => {
  const wrappers = document.querySelectorAll(".progress_bar_wrapper");
  wrappers.forEach((wrapper) => new EditorPlusProgressBar(wrapper));
});