Welcome to mirror list, hosted at ThFree Co, Russian Federation.

logo.js « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c76e44a196dec9287947fad3aad9d00a2306cbe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
export default function initLogoAnimation() {
  window.addEventListener('beforeunload', () => {
    document.querySelector('.tanuki-logo')?.classList.add('animate');
  });
}

export function initPortraitLogoDetection() {
  const image = document.querySelector('.js-portrait-logo-detection');

  image?.addEventListener(
    'load',
    ({ currentTarget: img }) => {
      const isPortrait = img.height > img.width;
      if (isPortrait) {
        // Limit the width when the logo has portrait format
        img.classList.replace('gl-h-9', 'gl-w-10');
      }
      img.classList.remove('gl-visibility-hidden');
    },
    { once: true },
  );
}