-
Notifications
You must be signed in to change notification settings - Fork 0
/
conf.js
49 lines (43 loc) · 1.74 KB
/
conf.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
48
49
GLOBALSTITCHAPP = "class-share-yvroi";
GLOBALDBNAME = "classshare";
GLOBALTOKENHOOK = "https://us-east-1.aws.webhooks.mongodb-stitch.com/api/client/v2.0/app/class-share-yvroi/service/hook/incoming_webhook/getCode?id=";
function logout() {
client.auth.isLoggedIn = false;
client.auth.logout().then(() => {
// So logout of Google explicitly by going to https://accounts.google.com/logout
// NOTE: this will log you out of all the Google accounts that you are signed into
// window.location.replace("https://accounts.google.com/logout");
window.location = "/index.html";
});
}
// https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
function makeRandomID(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
function getHashbang() {
var url = window.self.location.href;
var kvp = url.split("#!");
if(kvp.length > 1) {
return kvp[1];
} else {
return false;
}
}
Date.prototype.yyyymmdd = function() {
var mm = this.getMonth() + 1; // getMonth() is zero-based
var dd = this.getDate();
return [(mm>9 ? '' : '0') + mm,
(dd>9 ? '' : '0') + dd,
this.getFullYear().toString().substr(-2)
].join('/');
};
function cleanHTML(instr) {
// https://stackoverflow.com/questions/784586/convert-special-characters-to-html-in-javascript
return instr.replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
}