]> iEval git - gruntmaster-page.git/blame - js/95-login.js
Use brotli in make_static.PL if available
[gruntmaster-page.git] / js / 95-login.js
CommitLineData
7093e9ba 1$(function(){
dee46c5b 2 const sidebar = q('#sidebar');
65d5cb3b 3 const login = document.createElement('div');
7093e9ba
MG
4 login.innerHTML = '<a role="button" id="login" class="show">Log in</a>';
5 sidebar.insertBefore(login, sidebar.firstChild);
8345760a 6 $('#login').on('click', e => {
65d5cb3b 7 const xhr = new XMLHttpRequest();
7093e9ba 8 xhr.open('GET', '/login');
8345760a 9 xhr.onload = () => {
8e3f7d1e 10 if(xhr.status != 200)
7093e9ba 11 return;
65d5cb3b 12 const username = xhr.responseText;
7093e9ba
MG
13 sessionStorage.setItem('login_username', username);
14 start_tracking(username);
15 login.innerHTML = 'Probably logged in as ' + username;
16 }
17 xhr.send();
18 return false;
462db4aa 19 });
7093e9ba 20
65d5cb3b 21 const username = sessionStorage.getItem('login_username');
7093e9ba
MG
22 if(username)
23 login.innerHTML = 'Probably logged in as ' + username;
24});
This page took 0.032788 seconds and 4 git commands to generate.