]>
Commit | Line | Data |
---|---|---|
462db4aa MG |
1 | (function(){ |
2 | 'use strict'; | |
3 | ||
4 | $( document ).ready(function(){ | |
2d5a49fc | 5 | $('#login').detach().prependTo($('#sidebar')); |
462db4aa MG |
6 | |
7 | document.cookie = "cookietest=1"; | |
8 | var cookie = document.cookie.indexOf("cookietest=") != -1; | |
9 | document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT"; | |
10 | ||
11 | if(!cookie) return; | |
12 | var username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*\=\s*([^;]*).*$)|^.*$/, "$1"); | |
13 | if(username) { | |
14 | sessionStorage.setItem('login_username', username); | |
15 | document.cookie = "username=; expires=Thu, 01-Jan-1970 00:00:01 GMT"; | |
16 | start_tracking(username); | |
17 | } | |
18 | username = sessionStorage.getItem('login_username'); | |
19 | if(username) | |
627ed44e | 20 | $('#login').html('Probably logged in as ' + username); |
462db4aa MG |
21 | }); |
22 | })(); |