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

index.js « index « jobs « projects « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f66c09cb1aceebcc57a5f4b837d9188c6c1ac512 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import Vue from 'vue';
import GlCountdown from '~/vue_shared/components/gl_countdown.vue';
import Tracking from '~/tracking';

document.addEventListener('DOMContentLoaded', () => {
  const remainingTimeElements = document.querySelectorAll('.js-remaining-time');
  remainingTimeElements.forEach(
    (el) =>
      new Vue({
        el,
        render(h) {
          return h(GlCountdown, {
            props: {
              endDateString: el.dateTime,
            },
          });
        },
      }),
  );

  const trackButtonClick = () => {
    if (gon.tracking_data) {
      const { category, action, ...data } = gon.tracking_data;
      Tracking.event(category, action, data);
    }
  };
  const buttons = document.querySelectorAll('.js-empty-state-button');
  buttons.forEach((button) => button.addEventListener('click', trackButtonClick));
});