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); });