This repository has been archived by the owner on May 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathheader.html
90 lines (89 loc) · 3.29 KB
/
header.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<link rel="stylesheet" type="text/css" href="https://dusterthefirst.github.io/res/include/header.css">
<style>
a, #userid {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
}
.desktop li {
transition: 0.2s ease;
}
.mobile li {
transition: 0.2s ease;
}
</style>
<div class="desktop">
<ul>
<li><a draggable="false" href="/index.html">Home</a></li>
<li><a draggable="false" href="/rules.html">Server Rules</a></li>
<li><a draggable="false" href="/staffrules.html">Staff Rules</a></li>
<li><a draggable="false" href="/roles.html">Roles</a></li>
<li><a draggable="false" href="/feedback.html">Feedback</a></li>
<li style="float: right">
<div id="login">
<a draggable="false" href="https://discordapp.com/oauth2/authorize?response_type=token&client_id=307231810218360832&scope=identify&redirect_uri=https://grandayy.github.io/auth.html">Login</a>
</div>
<div id="logout" style="display: none">
<a draggable="false" onclick="logout()" style="display: inline-block;cursor: pointer;">Logout</a>
<span id="userid" style="font-size: 1.2em; margin-right: 10px;"></span>
</div>
</li>
</ul>
</div>
<div class="mobile">
<div id="menu">
<div id="drpbtn" onclick="openMenu()">☰</div>
<ul>
<li><a draggable="false" href="/index.html">Home</a></li>
<li><a draggable="false" href="/rules.html">Server Rules</a></li>
<li><a draggable="false" href="/staffrules.html">Staff Rules</a></li>
<li><a draggable="false" href="/roles.html">Roles</a></li>
<li><a draggable="false" href="/feedback.html">Feedback</a></li>
</ul>
</div>
</div>
<script>
console.log(document.cookie);
if (!getCookie('user')) {
// DO NOTHING
} else {
let user = JSON.parse(getCookie('user'));
document.getElementById('login').style.display = "none";
document.getElementById('logout').style.display = "inline-block";
document.getElementById('userid').innerHTML = `${user.username}<span style="font-size: .7em; color: grey">#${user.discriminator}</span>`
}
function logout() {
setCookie('user', null, -100000);
location.reload();
}
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return null;
}
function setCookie(cname, cvalue, exms) {
var d = new Date();
d.setTime(d.getTime() + exms);
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
</script>
<script>
function openMenu(){
$("#menu ul").toggleClass("open");
}
</script>