window.onload = function () {
  setTimeout(() => {
    document
      .getElementById("expandedNotify")
      ?.addEventListener("change", function () {
        angular
          .element(this)
          .scope()
          .uplodExpendedImg(this.files, "expandedNotify");
      });
    document
      .getElementById("expandedNotify")
      ?.addEventListener("click", function () {
        $(this).val("");
      });
    document
      .getElementById("webpushfile")
      ?.addEventListener("change", function () {
        angular.element(this).scope().uploadWebPushIcon(this.files);
      });
    document
      .getElementById("webpushfile")
      ?.addEventListener("click", function () {
        $(this).val("");
      });
    document
      .getElementById("basicNotify")
      ?.addEventListener("change", function () {
        angular
          .element(this)
          .scope()
          .uploadNotificationImage(this.files, "basicNotify");
      });
    document
      .getElementById("basicNotify")
      ?.addEventListener("click", function () {
        $(this).val("");
      });

    document
      .getElementById("inAppImagefullScreen")
      ?.addEventListener("change", function () {
        console.log("inAppImagefullScreen");
        angular.element(this).scope().uploadInAppImageFile(this.files);
      });

    document
      .getElementById("inAppImageHeader")
      ?.addEventListener("change", function () {
        angular.element(this).scope().uploadInAppIconImg(this.files);
      });

      document
      .getElementById("inAppExpImageHeader")
      ?.addEventListener("change", function () {
        angular.element(this).scope().uploadExpendedInAppImageHeaderFooter(this.files);
      });

      document
      .getElementById("inAppExpImageFooter")
      ?.addEventListener("change", function () {
        angular.element(this).scope().uploadExpendedInAppImageHeaderFooter(this.files);
      });

    let miniImage = document.getElementById("inAppImageMini");
    if (miniImage) {
      miniImage.addEventListener("change", function () {
        angular.element(this).scope()?.uploadInAppMiniImg(this.files);
      });
    }

    document
      .getElementById("inAppImageFilefooter")
      ?.addEventListener("change", function () {
        angular.element(this).scope().uploadInAppIconImg(this.files);
      });

    document
      .getElementById("webpopfile")
      ?.addEventListener("change", function () {
        angular.element(this).scope().uploadWebPopUpIcon(this.files);
      });
    document
      .getElementById("webpopfile")
      ?.addEventListener("click", function () {
        $(this).val("");
      });
    document
      .getElementById("webpopfileb")
      ?.addEventListener("change", function () {
        angular.element(this).scope().uploadWebPopUpBannerIcon(this.files);
      });
    document
      .getElementById("webpopfileb")
      ?.addEventListener("click", function () {
        $(this).val("");
      });
    // for rgb header
    document
      .getElementById("web_pop_hc")
      ?.addEventListener("click", function () {
        let colorSelected = document.getElementById("web_pop_hc").value;
        document.getElementById("box-t").style.color = colorSelected;
        document.getElementById("banner-t").style.color = colorSelected;
      });
    // for rgb message
    document
      .getElementById("web_pop_dc")
      ?.addEventListener("click", function () {
        let colorSelected = document.getElementById("web_pop_dc").value;
        document.getElementById("box-m").style.color = colorSelected;
        document.getElementById("banner-m").style.color = colorSelected;
      });
    // for rgb background
    document
      .getElementById("web_pop_bg")
      ?.addEventListener("click", function () {
        let colorSelected = document.getElementById("web_pop_bg").value;
        document.getElementById("box").style.background = colorSelected;
        document.getElementById("banner").style.background = colorSelected;
      });
    // for border radius
    document
      .getElementById("web_pop_title")
      ?.addEventListener("click", function () {
        userWidth = document.getElementById("web_pop_title").value;
        document.getElementById("box").style.borderRadius = userWidth + "%";
        document.getElementById("banner").style.borderRadius = userWidth + "%";
      });
  }, 5000);
};
