aboutsummaryrefslogtreecommitdiff
path: root/assets_src/js/user.js
blob: fb3ab7c1026ba0787c4be32649d958cd1dc21235 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import * as dom from './lib/dom';

function externalServiceClick(e) {
	var row = dom.closest(e.target, (el) => el.classList.contains('authorizable'));
	if (row === null) {
		return;
	}
	var authType  = row.getAttribute('data-auth-type'),
	    authUrl   = row.getAttribute('data-auth-url'),
	    coupleUrl = row.getAttribute('data-couple-url');
	switch (authType) {
	case 'copy-paste':
		window.open(authUrl);
		location.href = coupleUrl;
		break;
	}
}

dom.ready(() => {
	document.getElementById('external-service-list').addEventListener('click', externalServiceClick, true);
});