2018-05-09 12:01:36 +05:30
|
|
|
import $ from 'jquery';
|
2019-09-04 21:01:54 +05:30
|
|
|
import LengthValidator from './length_validator';
|
2018-03-17 18:26:18 +05:30
|
|
|
import UsernameValidator from './username_validator';
|
2019-07-07 11:18:12 +05:30
|
|
|
import NoEmojiValidator from '../../../emoji/no_emoji_validator';
|
2018-03-17 18:26:18 +05:30
|
|
|
import SigninTabsMemoizer from './signin_tabs_memoizer';
|
|
|
|
import OAuthRememberMe from './oauth_remember_me';
|
2019-03-02 22:35:43 +05:30
|
|
|
import preserveUrlFragment from './preserve_url_fragment';
|
2019-12-26 22:10:19 +05:30
|
|
|
import Tracking from '~/tracking';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
new UsernameValidator(); // eslint-disable-line no-new
|
2019-09-30 21:07:59 +05:30
|
|
|
new LengthValidator(); // eslint-disable-line no-new
|
2018-03-17 18:26:18 +05:30
|
|
|
new SigninTabsMemoizer(); // eslint-disable-line no-new
|
2019-07-07 11:18:12 +05:30
|
|
|
new NoEmojiValidator(); // eslint-disable-line no-new
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
new OAuthRememberMe({
|
2018-03-17 18:26:18 +05:30
|
|
|
container: $('.omniauth-container'),
|
|
|
|
}).bindEvents();
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
// Save the URL fragment from the current window location. This will be present if the user was
|
|
|
|
// redirected to sign-in after attempting to access a protected URL that included a fragment.
|
|
|
|
preserveUrlFragment(window.location.hash);
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2019-12-26 22:10:19 +05:30
|
|
|
|
|
|
|
export default function trackData() {
|
|
|
|
if (gon.tracking_data) {
|
|
|
|
const tab = document.querySelector(".new-session-tabs a[href='#register-pane']");
|
|
|
|
const { category, action, ...data } = gon.tracking_data;
|
|
|
|
|
|
|
|
tab.addEventListener('click', () => {
|
|
|
|
Tracking.event(category, action, data);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
trackData();
|