diff options
Diffstat (limited to 'assets_src/js')
-rw-r--r-- | assets_src/js/user.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/assets_src/js/user.js b/assets_src/js/user.js new file mode 100644 index 0000000..c697780 --- /dev/null +++ b/assets_src/js/user.js | |||
@@ -0,0 +1,22 @@ | |||
1 | import * as dom from './lib/dom'; | ||
2 | |||
3 | function externalServiceClick(e) { | ||
4 | var row = dom.closest(e.target, (el) => el.classList.contains('authorizable')); | ||
5 | if (row === null) { | ||
6 | alert('nada'); | ||
7 | return; | ||
8 | } | ||
9 | var authType = row.getAttribute('data-auth-type'), | ||
10 | authUrl = row.getAttribute('data-auth-url'), | ||
11 | coupleUrl = row.getAttribute('data-couple-url'); | ||
12 | switch (authType) { | ||
13 | case 'copy-paste': | ||
14 | window.open(authUrl); | ||
15 | location.href = coupleUrl; | ||
16 | break; | ||
17 | } | ||
18 | } | ||
19 | |||
20 | dom.ready(() => { | ||
21 | document.getElementById('external-service-list').addEventListener('click', externalServiceClick, true); | ||
22 | }); | ||