-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
51 lines (41 loc) · 1.32 KB
/
index.html
File metadata and controls
51 lines (41 loc) · 1.32 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Collective Intelligence</title>
<meta charset="utf8" />
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://unpkg.com/cross-fetch/dist/cross-fetch.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script src="./libraries/sc-sdk/sc2.js"></script>
<script src="assets/scripts/parser.js"></script>
<script src="assets/scripts/serverInteract.js"></script>
<script>
var api = SC2Initialize({
app: "ci-sc",
callbackURL: 'https://collective-intelligence.github.io/login.html',
scope: ['vote', 'comment']
});
function login() {
window.location = api.getLoginURL();
}
function logout() {
api.revokeToken((err, res) => {
Cookies.remove('access_token');
Cookies.remove('username');
document.location = "index.html";
});
}
function onLoad() {
if (Cookies.get("username") != undefined) {
$("#user").html(`Logged in as ${Cookies.get("username")}.`);
}
}
</script>
</head>
<body onload="onLoad();">
<button onclick="login()">Login</button> |
<button onclick="logout()">Sign out</button>
<br /><p id="user"></p>
</body>
</html>