-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.js
47 lines (47 loc) · 1.6 KB
/
index.js
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
function logOut() {
setConfig({auth: null, user: null});
location = '/login.html';
}
async function inviteZhuowei() {
const response = await apiPost('add_zhuowei', {});
alert(JSON.stringify(response));
}
function joinChannel() {
const channelUrl = document.getElementById('channel-url').value;
if (channelUrl.indexOf('https://www.joinclubhouse.com/room/') != 0) {
alert(
'Invalid join link (should begin with https://www.joinclubhouse.com/room/)');
return;
}
const channelId =
channelUrl.substring('https://www.joinclubhouse.com/room/'.length);
location = '/channel.html?' + channelId;
}
async function loadHandler() {
if (location.search === '?bypass') {
setConfig({bypass: true});
}
if (location.search === '?nobypass') {
setConfig({bypass: false});
}
if (await doRedirect()) {
return;
}
if (!getConfig().user.success) {
document.getElementById('maybe-banned').style.display = '';
} else if (isWaitlisted()) {
document.getElementById('waitlist').style.display = '';
} else {
// TODO(zhuowei): nope still didn't work
// document.getElementById('personalappeal').style.display = '';
document.getElementById('join-channel').style.display = '';
document.getElementById('you-can-join').style.display = '';
}
if (getConfig().user.user_profile.username) {
document.getElementById('set-username').style.display = 'none';
document.getElementById('waitlist-username').style.display = 'none';
}
document.getElementById('yourprofile').href =
'/user.html?' + getConfig().user.user_profile.user_id;
}
window.onload = loadHandler;