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

function externalServiceClick(e) {
	var row = dom.closest(e.target, (el) => el.classList.contains('authorizable'));
	if (row === null) {
		alert('nada');
		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);
});