Градиент в профиль

Код:
<!-- Градиент в профиль -->
<script>
  const profileGradient = document.querySelectorAll('.profile_gradient');
  const viewProfile = document.querySelector('#pun-profile');

  if (profileGradient) {
    profileGradient.forEach(gradient => {
      const backgroundStyle = getComputedStyle(gradient).background;

      let postAuthorList;

      if (viewProfile) {
        const parent = gradient.parentNode.parentNode.parentNode.parentNode;
        postAuthorList = parent.querySelector('#profile-left');

        const icon = viewProfile.querySelector('#pa-fld2');
        const billet = viewProfile.querySelector('.billet');

        if (icon && billet) {
          billet.append(icon);
        }
      } else {
        postAuthorList = gradient.parentNode.parentNode;
      }

      if (postAuthorList) {
        postAuthorList.style.background = backgroundStyle;

        if (gradient.classList.contains('white')) {
          postAuthorList.classList.add('white');
        }
      }
    });
  }
</script>