mirror of
https://github.com/ION606/selmer-bot-website.git
synced 2026-05-15 06:26:54 +00:00
Added the caledar function
This commit is contained in:
@@ -0,0 +1,72 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Selmer Bot Web Dashboard</title>
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.onload = () => {
|
||||||
|
var counter = document.getElementById('counter');
|
||||||
|
var countTime = 0;
|
||||||
|
|
||||||
|
const interval = setInterval(function() {
|
||||||
|
counter.innerText = countTime;
|
||||||
|
|
||||||
|
if (countTime >= 404) {
|
||||||
|
clearInterval(interval);
|
||||||
|
} else {
|
||||||
|
countTime += 4;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
h1 {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 30vh;
|
||||||
|
font-size: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/257418/andy-holmes-698828-unsplash.jpg);
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
min-height: 70vh;
|
||||||
|
min-width: 100vw;
|
||||||
|
font-family: "Roboto Mono", "Liberation Mono", Consolas, monospace;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
color: #79edf7;
|
||||||
|
background-color: #000000;
|
||||||
|
font-size: 19px;
|
||||||
|
border: 1px solid #2d63c8;
|
||||||
|
padding: 15px 50px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-top: 100px;
|
||||||
|
}
|
||||||
|
button:hover {
|
||||||
|
color: #2d63c8;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body class="text-center">
|
||||||
|
<h1 id="counter"></h1>
|
||||||
|
<h2>You look a little lost...</h2>
|
||||||
|
<h2>The page you're looking for can't be found!</h2>
|
||||||
|
<button onclick="window.location='index.html'">HOME</button>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+265
@@ -0,0 +1,265 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* SUBMIT BUTTON START */
|
||||||
|
.submitButton{
|
||||||
|
position: relative;
|
||||||
|
background-color: black;
|
||||||
|
border-radius: 4em;
|
||||||
|
font-size: 16px;
|
||||||
|
color: white;
|
||||||
|
padding: 0.8em 1.8em;
|
||||||
|
cursor:pointer;
|
||||||
|
user-select:none;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
transition-duration: 0.4s;
|
||||||
|
/* margin-left: 65px; */
|
||||||
|
margin-left: 30px;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
-webkit-transition-duration: 0.4s; /* Safari */
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:hover {
|
||||||
|
transition-duration: 0.1s;
|
||||||
|
background-color: #3A3A3A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 4em;
|
||||||
|
left: 0;
|
||||||
|
top:0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.5s;
|
||||||
|
box-shadow: 0 0 10px 40px white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:active:after {
|
||||||
|
box-shadow: 0 0 0 0 white;
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 4em;
|
||||||
|
left: 0;
|
||||||
|
top:0;
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:active {
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btnActive {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #ff1117;
|
||||||
|
font-size: 13px;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
border-radius: 9px;
|
||||||
|
padding: 10px 40px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-left: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnCanceled {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #7a7a7a;
|
||||||
|
font-size: 13px;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
border-radius: 9px;
|
||||||
|
padding: 10px 40px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-left: 40px;
|
||||||
|
}
|
||||||
|
/* SUBMIT BUTTON END */
|
||||||
|
|
||||||
|
|
||||||
|
.newEvtBtn {
|
||||||
|
margin-left: 40px;
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #0cdc01;
|
||||||
|
font-size: 16px;
|
||||||
|
border-radius: 4em;
|
||||||
|
padding: 0.8em 1.8em;
|
||||||
|
cursor: pointer
|
||||||
|
}
|
||||||
|
|
||||||
|
.newEvtBtn:hover {
|
||||||
|
color: #6e6e6e;
|
||||||
|
background-color: #14fe07;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: rgb(59, 58, 58);
|
||||||
|
}
|
||||||
|
|
||||||
|
.evtclass {
|
||||||
|
margin-bottom: 50px;
|
||||||
|
color: white;
|
||||||
|
line-height: 23px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.evtclass a {
|
||||||
|
color: rgb(0, 250, 237);
|
||||||
|
}
|
||||||
|
|
||||||
|
.evtclass a:active {
|
||||||
|
color: rgb(255, 0, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.onbeforeunload = function(){
|
||||||
|
window.close();
|
||||||
|
};
|
||||||
|
|
||||||
|
window.onload = () => {
|
||||||
|
if (!window.sessionStorage.getItem('evlist')) { return; }
|
||||||
|
|
||||||
|
const d = new Date();
|
||||||
|
document.title = `Editing ${d.getMonth()}/${sessionStorage.getItem('day')}/${d.getFullYear()}`;
|
||||||
|
|
||||||
|
window.sessionStorage.setItem('delObjKeys', JSON.stringify([]));
|
||||||
|
|
||||||
|
const evlist = JSON.parse(window.sessionStorage.getItem('evlist'));
|
||||||
|
|
||||||
|
var b = document.getElementById('main');
|
||||||
|
var div = document.createElement('div');
|
||||||
|
|
||||||
|
for (ind in evlist) {
|
||||||
|
for (i in evlist[ind]) {
|
||||||
|
if (i === 'time' || i === '_id' || i === 'amt') { continue; }
|
||||||
|
|
||||||
|
const ev = evlist[ind][i];
|
||||||
|
let p = document.createElement("p");
|
||||||
|
let link = document.createElement('a');
|
||||||
|
link.href = ev.link; //unnecessary?
|
||||||
|
link.innerText = ev.link;
|
||||||
|
link.onclick = function(event) { event.preventDefault(); window.open(ev.link, '_blank'); }
|
||||||
|
|
||||||
|
const timeFull = new Date(Number(evlist[ind].time) + (Number(ev.offset) + 1) * 60000);
|
||||||
|
var time = [timeFull.getHours().toString(), timeFull.getMinutes().toString()];
|
||||||
|
|
||||||
|
//Make sure it looks like 01:08 and not 1:8
|
||||||
|
if (time[0].length < 2) { time[0] = `0${time[0]}` }
|
||||||
|
if (time[1].length < 2) { time[1] = `0${time[1]}` }
|
||||||
|
|
||||||
|
p.innerText = `Name: ${ev.name}\nDescription: ${ev.description}\nTime: ${time[0]}:${time[1]}\nOffset: ${ev.offset}\nLocation: ${ev.location}\nLink: `;
|
||||||
|
p.appendChild(link);
|
||||||
|
// p.style = 'color: green; margin-bottom: 50px;';
|
||||||
|
p.className = 'evtclass';
|
||||||
|
|
||||||
|
//Add buttons
|
||||||
|
let b = document.createElement('button');
|
||||||
|
b.id = `${evlist[ind].time}|${i}|${ind}`;
|
||||||
|
b.className = 'btnActive';
|
||||||
|
b.innerText = "Cancel";
|
||||||
|
b.onclick = function() {
|
||||||
|
const id = this.id.split("|");
|
||||||
|
|
||||||
|
var sstor = JSON.parse(sessionStorage.getItem('evlist'));
|
||||||
|
var delObjKeys = JSON.parse(sessionStorage.getItem('delObjKeys'));
|
||||||
|
|
||||||
|
//The keys are the same as in the cloud, sort by time and remove by key
|
||||||
|
delObjKeys.push({time: id[0], eventInd: id[1]});
|
||||||
|
|
||||||
|
delete sstor[id[2]][id[1]];
|
||||||
|
sstor[id[2]].amt --; //Maybe useless (perhaps sstor is never used again)?
|
||||||
|
sessionStorage.setItem('evlist', JSON.stringify(sstor));
|
||||||
|
sessionStorage.setItem('delObjKeys', JSON.stringify(delObjKeys));
|
||||||
|
b.className = 'btnCanceled';
|
||||||
|
b.innerText = "Cancelled";
|
||||||
|
|
||||||
|
b.onclick = function() { alert("This event has already been cancelled!"); }
|
||||||
|
}
|
||||||
|
|
||||||
|
p.appendChild(document.createElement('br'));
|
||||||
|
p.appendChild(document.createElement('br'));
|
||||||
|
p.appendChild(b);
|
||||||
|
|
||||||
|
div.appendChild(p);
|
||||||
|
// div.appendChild(document.createElement('p').style = 'margin-top=100px;');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var newbtn = document.createElement('button');
|
||||||
|
newbtn.className = 'newEvtBtn';
|
||||||
|
newbtn.innerText = "Create New Event";
|
||||||
|
newbtn.onclick = function() {
|
||||||
|
// event.preventDefault();
|
||||||
|
const day = Number(sessionStorage.getItem('day'));
|
||||||
|
createCalEvent(day)
|
||||||
|
}
|
||||||
|
|
||||||
|
b.appendChild(div);
|
||||||
|
document.getElementById('btns').appendChild(newbtn);
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- DUPLICATE OF ANOTHER PAGE WILL NOT LINK -->
|
||||||
|
<script>
|
||||||
|
function sendData(event, inp) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
var serverSettings = JSON.parse(window.localStorage.getItem('serverInfo'));
|
||||||
|
window.opener.location.reload();
|
||||||
|
|
||||||
|
if (inp.inp == 'cal') {
|
||||||
|
const userId = JSON.parse(window.localStorage.getItem('Id'));
|
||||||
|
const delObjKeys = sessionStorage.getItem('delObjKeys');
|
||||||
|
|
||||||
|
//Send the data to the server
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('post', 'http://www.selmerbot.com/sendData/', true);
|
||||||
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
|
xhr.setRequestHeader(`reminders`, true);
|
||||||
|
xhr.setRequestHeader(`delObjKeys`, delObjKeys);
|
||||||
|
|
||||||
|
xhr.onloadend = (e) => {
|
||||||
|
console.log(e);
|
||||||
|
alert("Saved!");
|
||||||
|
window.close();
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createCalEvent(day) {
|
||||||
|
// event.preventDefault();
|
||||||
|
|
||||||
|
await new Promise((res, rej) => { res(window.open('http://www.selmerbot.com/newCalEvent.html','newCalPopWindow','loaction=no,width=400,height=350,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')); })
|
||||||
|
.then((w) => {
|
||||||
|
if (!w) { alert("Your browser has JavaScript Disabled!"); return w.close(); }
|
||||||
|
|
||||||
|
w.sessionStorage.setItem("day", day);
|
||||||
|
|
||||||
|
w.location.reload();
|
||||||
|
// w.document.write('<title>Editing ${(' + String(day) + ')}</title>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="main" style="margin-left: 20px;"></div>
|
||||||
|
<!-- NOTHING IN HERE -->
|
||||||
|
<div id="btns" style="margin-top: 75px;">
|
||||||
|
<input type="submit" value="Submit" class="submitButton" onclick="sendData(event, { 'inp': 'cal' })">
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+505
@@ -0,0 +1,505 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<span id="IMPORTS">
|
||||||
|
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico" type="image/x-icon">
|
||||||
|
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<script src="https://js.stripe.com/v3/"></script>
|
||||||
|
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Cinzel&family=Rajdhani:wght@300&family=Rouge+Script&family=Share+Tech+Mono&display=swap" rel="stylesheet">
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<title>Selmer Bot Web Dashboard</title>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
html { width:100%; height:100%; margin:0; padding:0; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
/* background-color: rgb(4, 4, 85); */
|
||||||
|
background-color: rgb(41, 42, 48);
|
||||||
|
width:100%; height:100%; margin:0; padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .dropdown a:hover { background-color: #ddd; } */
|
||||||
|
|
||||||
|
.show { display: block; }
|
||||||
|
|
||||||
|
.hide { display: none; }
|
||||||
|
|
||||||
|
.loadingscreen {
|
||||||
|
height: 90vh;
|
||||||
|
background-color: bisque;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar {
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
/* height: 50px;
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: double; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar .nav-item {
|
||||||
|
margin-right: 25px;
|
||||||
|
margin-left: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#right {
|
||||||
|
float: right;
|
||||||
|
margin-right: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
font-size: 20px;
|
||||||
|
height: 40px;
|
||||||
|
width: auto;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding: 3px;
|
||||||
|
border: 1px solid black;
|
||||||
|
clear: both;
|
||||||
|
align-content: center;
|
||||||
|
margin-right: 30px;
|
||||||
|
margin-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.statusdiv {
|
||||||
|
border-style: dashed;
|
||||||
|
border-color: rgb(247, 189, 0);
|
||||||
|
width: 140px;
|
||||||
|
height: 120px;
|
||||||
|
margin-top: 20px;
|
||||||
|
float: right;
|
||||||
|
margin-right: 50px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.saved {
|
||||||
|
background-color: rgb(11, 184, 11);
|
||||||
|
}
|
||||||
|
.saving {
|
||||||
|
background-color: orange;
|
||||||
|
}
|
||||||
|
.failed {
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.buttonsmainbar {
|
||||||
|
background-color: green;
|
||||||
|
width: 200px;
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnmain {
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
background-color: #42424b;
|
||||||
|
width: 11%;
|
||||||
|
position: fixed;
|
||||||
|
top: 75px;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
border: 0px;
|
||||||
|
border-right: 2px;
|
||||||
|
border-color: black;
|
||||||
|
border-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wc {
|
||||||
|
align-content: center;
|
||||||
|
align-self: center;
|
||||||
|
color: white;
|
||||||
|
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lg {
|
||||||
|
align-content: center;
|
||||||
|
align-self: center;
|
||||||
|
color: white;
|
||||||
|
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-select {
|
||||||
|
width: 200px;
|
||||||
|
background-color:rgb(187, 183, 183);
|
||||||
|
border-color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Buttons -->
|
||||||
|
<style>
|
||||||
|
.jumpButton {
|
||||||
|
/* color: #ffffff; */
|
||||||
|
font-size: 15px;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
width: 200px;
|
||||||
|
height: 40px;
|
||||||
|
cursor: pointer;
|
||||||
|
align-self: center;
|
||||||
|
background-color: rgb(2, 2, 192);
|
||||||
|
}
|
||||||
|
.jumpButton:hover {
|
||||||
|
color: #2d63c8;
|
||||||
|
/* background-color: #ffffff; */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SUBMIT BUTTON START */
|
||||||
|
.submitButton{
|
||||||
|
position: relative;
|
||||||
|
background-color: black;
|
||||||
|
border-radius: 4em;
|
||||||
|
font-size: 16px;
|
||||||
|
color: white;
|
||||||
|
padding: 0.8em 1.8em;
|
||||||
|
cursor:pointer;
|
||||||
|
user-select:none;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
transition-duration: 0.4s;
|
||||||
|
-webkit-transition-duration: 0.4s; /* Safari */
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:hover {
|
||||||
|
transition-duration: 0.1s;
|
||||||
|
background-color: #3A3A3A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 4em;
|
||||||
|
left: 0;
|
||||||
|
top:0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.5s;
|
||||||
|
box-shadow: 0 0 10px 40px white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:active:after {
|
||||||
|
box-shadow: 0 0 0 0 white;
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 4em;
|
||||||
|
left: 0;
|
||||||
|
top:0;
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:active {
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
/* SUBMIT BUTTON END */
|
||||||
|
|
||||||
|
.logoutbtn {
|
||||||
|
margin-top: 14px;
|
||||||
|
scale: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logoutbtn:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sevradio br {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnside {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #42424b;
|
||||||
|
font-size: 19px;
|
||||||
|
/* border: 2px solid #000000; */
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 50px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnside:hover {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #377aea;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.helpbtn {
|
||||||
|
margin-top: 30px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
font-size: 20px;
|
||||||
|
align-self: right;
|
||||||
|
padding: 0px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.calbtn {
|
||||||
|
width: 100px;
|
||||||
|
height: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.green {
|
||||||
|
background-color: rgb(6, 185, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
background-color: rgb(129, 129, 129);
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Calendar -->
|
||||||
|
<script>
|
||||||
|
async function openNewCalWindow(evjs, day) {
|
||||||
|
const ev = JSON.parse(evjs);
|
||||||
|
|
||||||
|
await new Promise((res, rej) => { res(window.open('http://www.selmerbot/calEvent.html','popUpWindow','loaction=no,width=600,height=300,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')); })
|
||||||
|
.then((w) => {
|
||||||
|
if (!w) { w.close(); return alert("Your browser has JavaScript Disabled!"); }
|
||||||
|
|
||||||
|
w.sessionStorage.setItem("evlist", evjs);
|
||||||
|
w.sessionStorage.setItem('day', day);
|
||||||
|
|
||||||
|
w.location.reload();
|
||||||
|
w.document.write('<title>Editing ${(new Date(Number(ev.time)))}</title>');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function createCalEvent(day) {
|
||||||
|
await new Promise((res, rej) => { res(window.open('http://www.selmerbot/newCalEvent.html','popUpWindow','loaction=no,width=400,height=350,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')); })
|
||||||
|
.then((w) => {
|
||||||
|
if (!w) { w.close(); return alert("Your browser has JavaScript Disabled!"); }
|
||||||
|
|
||||||
|
w.sessionStorage.setItem("day", day);
|
||||||
|
|
||||||
|
w.location.reload();
|
||||||
|
// w.document.write('<title>Editing ${(' + String(day) + ')}</title>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Month + 1 because the 0 will set the date back a month
|
||||||
|
function daysInMonth (d) {
|
||||||
|
return new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
function calSetup(calList) {
|
||||||
|
const d = new Date((new Date()).getFullYear(), (new Date()).getMonth());
|
||||||
|
|
||||||
|
const startDay = new Date(d.getFullYear(), d.getMonth(), 1).getDay() + 1;
|
||||||
|
var cal = document.getElementById('calbody');
|
||||||
|
var tr = document.createElement('tr');
|
||||||
|
var dayint = 1;
|
||||||
|
const ll = daysInMonth(d);
|
||||||
|
|
||||||
|
for (let i = 1; i <= 42; i ++) {
|
||||||
|
var td = document.createElement('td');
|
||||||
|
|
||||||
|
if (i >= startDay && dayint <= ll) {
|
||||||
|
let btn = document.createElement('button');
|
||||||
|
btn.innerText = dayint.toString();
|
||||||
|
btn.classList.add('calbtn');
|
||||||
|
|
||||||
|
|
||||||
|
if (calList.has(Number(dayint.toString()))) { btn.classList.add('green'); }
|
||||||
|
else { btn.classList.add('red'); }
|
||||||
|
|
||||||
|
btn.onclick = function(event) {
|
||||||
|
const timestamp = new Date(new Date().getFullYear(), new Date().getMonth(), Number(this.innerText));
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (calList.has(Number(this.innerText))) {
|
||||||
|
const ev = calList.get(Number(this.innerText));
|
||||||
|
|
||||||
|
openNewCalWindow(JSON.stringify(ev), Number(this.innerText));
|
||||||
|
} else {
|
||||||
|
// Check if the day has already passed
|
||||||
|
if (Number(this.innerText) >= (new Date()).getDate()) {
|
||||||
|
createCalEvent(Number(this.innerText));
|
||||||
|
} else {
|
||||||
|
alert("Please pick a future date!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
td.appendChild(btn);
|
||||||
|
dayint ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.appendChild(td);
|
||||||
|
|
||||||
|
if (i % 7 == 0) {
|
||||||
|
let tr2 = document.createElement('tr');
|
||||||
|
cal.appendChild(tr);
|
||||||
|
cal.appendChild(tr2);
|
||||||
|
|
||||||
|
tr2 = document.createElement('tr');
|
||||||
|
tr = document.createElement('tr');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cal.appendChild(tr);
|
||||||
|
|
||||||
|
if (window.innerWidth < 1020) {
|
||||||
|
//Calendar resize
|
||||||
|
const calSpacing = document.getElementById("spaceId");
|
||||||
|
calSpacing.cellSpacing = 1;
|
||||||
|
calSpacing.cellPadding = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.onload = () => {
|
||||||
|
var serverSettings = JSON.parse(window.localStorage.getItem('serverInfo'));
|
||||||
|
|
||||||
|
if (!serverSettings) {
|
||||||
|
alert("Please log in to continue");
|
||||||
|
if (window.location.href.indexOf('localhost') != -1) {
|
||||||
|
window.location = 'https://discord.com/api/oauth2/authorize?client_id=926551095352901632&redirect_uri=http%3A%2F%2Flocalhost%3A53134%2F&response_type=token&scope=identify%20guilds';
|
||||||
|
} else {
|
||||||
|
window.location = 'https://discord.com/api/oauth2/authorize?client_id=944046902415093760&redirect_uri=http%3A%2F%2Fwww.selmerbot.com%2F&response_type=token&scope=identify%20guilds';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get serverId
|
||||||
|
const id = window.localStorage.getItem('Id').toString();
|
||||||
|
|
||||||
|
var xhr2 = new XMLHttpRequest();
|
||||||
|
xhr2.open('get', 'http://www.selmerbot/getCal/', true);
|
||||||
|
xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
|
|
||||||
|
//Use the guild Id as the userId
|
||||||
|
xhr2.setRequestHeader('userId', id);
|
||||||
|
|
||||||
|
xhr2.onloadend = (e) => {
|
||||||
|
const calList = new Map();
|
||||||
|
|
||||||
|
const res = JSON.parse(xhr2.response);
|
||||||
|
const times = res[0];
|
||||||
|
|
||||||
|
times.forEach((time, ind) => {
|
||||||
|
|
||||||
|
const fullDate = new Date(Number(time));
|
||||||
|
const month = fullDate.getMonth();
|
||||||
|
const day = fullDate.getDate();
|
||||||
|
|
||||||
|
const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
||||||
|
document.getElementById('monthName').innerText = `Editing Reminders for the Month of ${monthNames[month]}`;
|
||||||
|
|
||||||
|
//Make sure it's the right month (old ones should be removed, this is just a catch)
|
||||||
|
if (month == (new Date()).getMonth()) {
|
||||||
|
if (calList.has(day)) {
|
||||||
|
var temp = calList.get(day);
|
||||||
|
temp.push(res[1][ind]);
|
||||||
|
calList.set(day, temp);
|
||||||
|
} else {
|
||||||
|
calList.set(day, [res[1][ind]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
calSetup(calList);
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr2.send();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-expand-sm navbar-fixed-top">
|
||||||
|
<div class="container-fluid mx-auto">
|
||||||
|
<a class="navbar-brand" href="index.html">
|
||||||
|
<img src="https://github.com/ION606/selmer-bot-website/blob/main/assets/Selmer-icon.png?raw=true" alt="Selmer Icon" style="width: 50px;">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- <li class="nav-item">
|
||||||
|
<a href="index.html" style="color: white" class="nav-link"><i class="fa-solid fa-house-chimney", alt="Home" style="scale: 2;"></i></a>
|
||||||
|
</li> -->
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="myGuilds.html" id="guildslink" class="nav-link"><i class="fa-solid fa-server" alt="Servers" style="scale: 2; color: rgb(11, 189, 189);"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="calendar.html" id="callink" class="nav-link"><i class="fa-solid fa-calendar" alt="Calendar" style="scale: 2; color: lightgrey;"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="https://github.com/ION606/selmerBot/wiki" target="_blank" class="nav-link"><i class="fa-solid fa-book" style="scale: 2; color: white;" alt="WIKI"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="premium.html" class="nav-link"><i class="fa-solid fa-crown" style="scale: 2; color: gold;" alt="PREMIUM"></i></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- <button type="button" class="btn btn-primary" data-bs-toggle="tooltip" title="Hooray!">Hover over me!</button> -->
|
||||||
|
<div class="container" style="font-family: 'Rajdhani', sans-serif; color: white;"><h1>Selmer Bot Web Dashboard</h1></div>
|
||||||
|
<span class="ms-auto" style="margin-right: 1%;">
|
||||||
|
<button onclick="logout()" id="logoutbtn" class="logoutbtn"><i class="fa-solid fa-arrow-right-from-bracket" alt="Log Out"></i></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="cal", class="wc" style="margin-top: 20px;">
|
||||||
|
<h1 id="monthName", style="text-align: center; margin-top: 50px; margin-bottom: 25px;"></h1>
|
||||||
|
<!-- <button class="helpbtn" onclick="alert('Use {sn} to insert the server name, {un} to insert the user name, and {ut} to insert the user tag\nExample: Welcome to {sn} Sir {un}#{ut}')"><img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwww.downloadclipart.net%2Flarge%2F45627-icon-with-question-mark-clipart.png&f=1&nofb=1" style="width: 50px; border-radius: 50%; border-style: solid;"></button> -->
|
||||||
|
<form>
|
||||||
|
<table id="spaceId" style="background-color: lightgrey;"
|
||||||
|
cellspacing="15" cellpadding="15" class="mx-auto">
|
||||||
|
|
||||||
|
<caption style="caption-side: top;"></caption>
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Sun</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Mon</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Tue</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Wed</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Thu</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Fri</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Sat</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody id="calbody" style="color: black;">
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+232
-7
@@ -211,7 +211,7 @@
|
|||||||
|
|
||||||
.logoutbtn {
|
.logoutbtn {
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
scale: 1.7;
|
scale: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logoutbtn:hover {
|
.logoutbtn:hover {
|
||||||
@@ -250,13 +250,141 @@
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.calbtn {
|
||||||
|
width: 100px;
|
||||||
|
height: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.green {
|
||||||
|
background-color: rgb(6, 185, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.red {
|
||||||
|
background-color: rgb(129, 129, 129);
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!-- Calendar -->
|
||||||
|
<script>
|
||||||
|
|
||||||
|
async function openNewCalWindow(evjs, day) {
|
||||||
|
const ev = JSON.parse(evjs);
|
||||||
|
|
||||||
|
await new Promise((res, rej) => { res(window.open('http://www.selmerbot.com/calEvent.html','popUpWindow','loaction=no,width=600,height=300,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')); })
|
||||||
|
.then((w) => {
|
||||||
|
if (!w) { w.close(); return alert("Your browser has JavaScript Disabled!"); }
|
||||||
|
|
||||||
|
w.sessionStorage.setItem("evlist", evjs);
|
||||||
|
w.sessionStorage.setItem('day', day);
|
||||||
|
|
||||||
|
w.location.reload();
|
||||||
|
w.document.write('<title>Editing ${(new Date(Number(ev.time)))}</title>');
|
||||||
|
})
|
||||||
|
|
||||||
|
// w.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async function createCalEvent(day) {
|
||||||
|
await new Promise((res, rej) => { res(window.open('http://www.selmerbot.com/newCalEvent.html','popUpWindow','loaction=no,width=400,height=350,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')); })
|
||||||
|
.then((w) => {
|
||||||
|
if (!w) { w.close(); return alert("Your browser has JavaScript Disabled!"); }
|
||||||
|
|
||||||
|
w.sessionStorage.setItem("day", day);
|
||||||
|
|
||||||
|
w.location.reload();
|
||||||
|
// w.document.write('<title>Editing ${(' + String(day) + ')}</title>');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//Month + 1 because the 0 will set the date back a month
|
||||||
|
function daysInMonth (d) {
|
||||||
|
return new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
function calSetup(calList) {
|
||||||
|
const d = new Date((new Date()).getFullYear(), (new Date()).getMonth());
|
||||||
|
|
||||||
|
const startDay = new Date(d.getFullYear(), d.getMonth(), 1).getDay() + 1;
|
||||||
|
var cal = document.getElementById('calbody');
|
||||||
|
var tr = document.createElement('tr');
|
||||||
|
var dayint = 1;
|
||||||
|
const ll = daysInMonth(d);
|
||||||
|
|
||||||
|
for (let i = 1; i <= 42; i ++) {
|
||||||
|
var td = document.createElement('td');
|
||||||
|
|
||||||
|
if (i >= startDay && dayint <= ll) {
|
||||||
|
let btn = document.createElement('button');
|
||||||
|
btn.innerText = dayint.toString();
|
||||||
|
btn.classList.add('calbtn');
|
||||||
|
|
||||||
|
|
||||||
|
if (calList.has(Number(dayint.toString()))) { btn.classList.add('green'); }
|
||||||
|
else { btn.classList.add('red'); }
|
||||||
|
|
||||||
|
btn.onclick = function(event) {
|
||||||
|
const timestamp = new Date(new Date().getFullYear(), new Date().getMonth(), Number(this.innerText));
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (calList.has(Number(this.innerText))) {
|
||||||
|
const ev = calList.get(Number(this.innerText));
|
||||||
|
|
||||||
|
openNewCalWindow(JSON.stringify(ev), Number(this.innerText));
|
||||||
|
} else {
|
||||||
|
// Check if the day has already passed
|
||||||
|
if (Number(this.innerText) >= (new Date()).getDate()) {
|
||||||
|
createCalEvent(Number(this.innerText));
|
||||||
|
} else {
|
||||||
|
alert("Please pick a future date!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
td.appendChild(btn);
|
||||||
|
dayint ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.appendChild(td);
|
||||||
|
|
||||||
|
if (i % 7 == 0) {
|
||||||
|
let tr2 = document.createElement('tr');
|
||||||
|
cal.appendChild(tr);
|
||||||
|
cal.appendChild(tr2);
|
||||||
|
|
||||||
|
tr2 = document.createElement('tr');
|
||||||
|
tr = document.createElement('tr');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cal.appendChild(tr);
|
||||||
|
|
||||||
|
if (window.innerWidth < 1020) {
|
||||||
|
//Calendar resize
|
||||||
|
const calSpacing = document.getElementById("spaceId");
|
||||||
|
calSpacing.cellSpacing = 1;
|
||||||
|
calSpacing.cellPadding = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
//Maybe pre-load the channels in the server into local storage for accessing when chosing the welcome/logging channels?
|
//Maybe pre-load the channels in the server into local storage for accessing when chosing the welcome/logging channels?
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
var serverSettings = JSON.parse(window.localStorage.getItem('serverInfo'));
|
var serverSettings = JSON.parse(window.localStorage.getItem('serverInfo'));
|
||||||
|
|
||||||
|
if (!serverSettings) {
|
||||||
|
alert("Please log in to continue");
|
||||||
|
if (window.location.href.indexOf('localhost') != -1) {
|
||||||
|
window.location = 'https://discord.com/api/oauth2/authorize?client_id=926551095352901632&redirect_uri=http%3A%2F%2Flocalhost%3A53134%2F&response_type=token&scope=identify%20guilds';
|
||||||
|
} else {
|
||||||
|
window.location = 'https://discord.com/api/oauth2/authorize?client_id=944046902415093760&redirect_uri=http%3A%2F%2Fwww.selmerbot.com%2F&response_type=token&scope=identify%20guilds';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Load the channels
|
//Load the channels
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('get', `http://www.selmerbot.com/getChannels/`, true);
|
xhr.open('get', `http://www.selmerbot.com/getChannels/`, true);
|
||||||
@@ -313,9 +441,48 @@
|
|||||||
|
|
||||||
// document.getElementById('ls').children[ls].checked = true; //Doesn't work
|
// document.getElementById('ls').children[ls].checked = true; //Doesn't work
|
||||||
}
|
}
|
||||||
|
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
|
||||||
|
//Get serverId instead of the userId
|
||||||
|
const id = serverSettings.Id;
|
||||||
|
|
||||||
|
var xhr2 = new XMLHttpRequest();
|
||||||
|
xhr2.open('get', 'http://www.selmerbot.com/getCal/', true);
|
||||||
|
xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
|
|
||||||
|
xhr2.setRequestHeader('userId', id);
|
||||||
|
|
||||||
|
xhr2.onloadend = (e) => {
|
||||||
|
const calList = new Map();
|
||||||
|
|
||||||
|
const res = JSON.parse(xhr2.response);
|
||||||
|
const times = res[0];
|
||||||
|
|
||||||
|
times.forEach((time, ind) => {
|
||||||
|
|
||||||
|
const fullDate = new Date(Number(time));
|
||||||
|
const month = fullDate.getMonth();
|
||||||
|
const day = fullDate.getDate();
|
||||||
|
|
||||||
|
const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
||||||
|
document.getElementById('monthName').innerText = `Editing Reminders for the Month of ${monthNames[month]}`;
|
||||||
|
|
||||||
|
//Make sure it's the right month (old ones should be removed, this is just a catch)
|
||||||
|
if (month == (new Date()).getMonth()) {
|
||||||
|
if (calList.has(day)) {
|
||||||
|
var temp = calList.get(day);
|
||||||
|
temp.push(res[1][ind]);
|
||||||
|
calList.set(day, temp);
|
||||||
|
} else {
|
||||||
|
calList.set(day, [res[1][ind]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
calSetup(calList);
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr2.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -412,14 +579,15 @@
|
|||||||
<img src="https://github.com/ION606/selmer-bot-website/blob/main/assets/Selmer-icon.png?raw=true" alt="Selmer Icon" style="width: 50px;">
|
<img src="https://github.com/ION606/selmer-bot-website/blob/main/assets/Selmer-icon.png?raw=true" alt="Selmer Icon" style="width: 50px;">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- <li class="nav-item">
|
|
||||||
<a href="index.html" style="color: white" class="nav-link"><i class="fa-solid fa-house-chimney", alt="Home" style="scale: 2;"></i></a>
|
|
||||||
</li> -->
|
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="myGuilds.html" id="guildslink" class="nav-link"><i class="fa-solid fa-server" alt="Servers" style="scale: 2; color: rgb(11, 189, 189);"></i></a>
|
<a href="myGuilds.html" id="guildslink" class="nav-link"><i class="fa-solid fa-server" alt="Servers" style="scale: 2; color: rgb(11, 189, 189);"></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="calendar.html" id="callink" class="nav-link"><i class="fa-solid fa-calendar" alt="Calendar" style="scale: 2; color: lightgrey;"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="https://github.com/ION606/selmerBot/wiki" target="_blank" class="nav-link"><i class="fa-solid fa-book" style="scale: 2; color: white;" alt="WIKI"></i></a>
|
<a href="https://github.com/ION606/selmerBot/wiki" target="_blank" class="nav-link"><i class="fa-solid fa-book" style="scale: 2; color: white;" alt="WIKI"></i></a>
|
||||||
</li>
|
</li>
|
||||||
@@ -432,8 +600,7 @@
|
|||||||
<!-- <button type="button" class="btn btn-primary" data-bs-toggle="tooltip" title="Hooray!">Hover over me!</button> -->
|
<!-- <button type="button" class="btn btn-primary" data-bs-toggle="tooltip" title="Hooray!">Hover over me!</button> -->
|
||||||
<div class="container" style="font-family: 'Rajdhani', sans-serif; color: white;"><h1>Selmer Bot Web Dashboard</h1></div>
|
<div class="container" style="font-family: 'Rajdhani', sans-serif; color: white;"><h1>Selmer Bot Web Dashboard</h1></div>
|
||||||
<span class="ms-auto" style="margin-right: 1%;">
|
<span class="ms-auto" style="margin-right: 1%;">
|
||||||
<button onclick="logout()" id="logoutbtn" class="logoutbtn" style="display: none;"><i class="fa-solid fa-arrow-right-from-bracket" alt="Log Out"></i></button>
|
<button onclick="logout()" id="logoutbtn" class="logoutbtn"><i class="fa-solid fa-arrow-right-from-bracket" alt="Log Out"></i></button>
|
||||||
<button onclick="window.location = getAPIRedirect()" id="loginbtn" class="loginbtn"><i class="fa-solid fa-arrow-right-from-bracket" alt="Log In"></i></button>
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -447,6 +614,7 @@
|
|||||||
<div id="buttons" class="buttonsmainbar">
|
<div id="buttons" class="buttonsmainbar">
|
||||||
<button onclick="divChange('welcome')" class="btnside">Welcome</button>
|
<button onclick="divChange('welcome')" class="btnside">Welcome</button>
|
||||||
<button onclick="divChange('log')" class="btnside">Logging</button>
|
<button onclick="divChange('log')" class="btnside">Logging</button>
|
||||||
|
<button onclick="divChange('cal')" class="btnside">Calendar</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -501,6 +669,63 @@
|
|||||||
<input type="submit" value="Submit", class="submitButton" onclick="sendData(event, { 'inp': 'logs' })">
|
<input type="submit" value="Submit", class="submitButton" onclick="sendData(event, { 'inp': 'logs' })">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="cal", class="hide wc" style="margin-top: 20px;">
|
||||||
|
<h1 id="monthName", style="text-align: center; margin-top: 50px; margin-bottom: 25px;"></h1>
|
||||||
|
<form>
|
||||||
|
<table id="spaceId" style="background-color: lightgrey;"
|
||||||
|
cellspacing="15" cellpadding="15" class="mx-auto">
|
||||||
|
|
||||||
|
<!-- The tr tag is used to enter
|
||||||
|
rows in the table -->
|
||||||
|
|
||||||
|
<!-- It is used to give the heading to the
|
||||||
|
table. We can give the heading to the
|
||||||
|
top and bottom of the table -->
|
||||||
|
|
||||||
|
<caption align="top">
|
||||||
|
<!-- Here we have used the attribute
|
||||||
|
that is style and we have colored
|
||||||
|
the sentence to make it better
|
||||||
|
depending on the web page-->
|
||||||
|
</caption>
|
||||||
|
|
||||||
|
<!-- Here th stands for the heading of the
|
||||||
|
table that comes in the first row-->
|
||||||
|
|
||||||
|
<!-- The text in this table header tag will
|
||||||
|
appear as bold and is center aligned-->
|
||||||
|
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<!-- Here we have applied inline style
|
||||||
|
to make it more attractive-->
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Sun</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Mon</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Tue</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Wed</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Thu</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Fri</th>
|
||||||
|
<th style="color: white; background: purple;">
|
||||||
|
Sat</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody id="calbody" style="color: black;">
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<!-- <input type="submit" value="Submit", class="submitButton" onclick="sendData(event, { 'inp': 'cal' })"> -->
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -302,6 +302,10 @@
|
|||||||
<a href="myGuilds.html" id="guildslink" class="nav-link"><i class="fa-solid fa-server" alt="Servers" style="scale: 2; color: rgb(11, 189, 189);"></i></a>
|
<a href="myGuilds.html" id="guildslink" class="nav-link"><i class="fa-solid fa-server" alt="Servers" style="scale: 2; color: rgb(11, 189, 189);"></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="calendar.html" id="callink" class="nav-link"><i class="fa-solid fa-calendar" alt="Calendar" style="scale: 2; color: lightgrey;"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="https://github.com/ION606/selmerBot/wiki" target="_blank" class="nav-link"><i class="fa-solid fa-book" style="scale: 2; color: white;" alt="WIKI"></i></a>
|
<a href="https://github.com/ION606/selmerBot/wiki" target="_blank" class="nav-link"><i class="fa-solid fa-book" style="scale: 2; color: white;" alt="WIKI"></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -117,6 +117,43 @@ app.get('/getChannels', async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.get('/getCal', async (req, res) => {
|
||||||
|
const userId = req.headers.userid;
|
||||||
|
|
||||||
|
connection.then((client) => {
|
||||||
|
var times;
|
||||||
|
|
||||||
|
const dbo = client.db('main').collection('reminderKeys');
|
||||||
|
dbo.findOne({ userId: userId }).then((doc) => {
|
||||||
|
if (!doc) { return res.send([[], []]); }
|
||||||
|
times = doc.times;
|
||||||
|
let tbo = client.db('main').collection('reminders');
|
||||||
|
|
||||||
|
tbo.find({ $where: function() { return (times.indexOf(this.time) != -1 && this.userId == userId); }}).toArray((err, docs) => {
|
||||||
|
//There's gotta be a better way
|
||||||
|
let newdoc = [];
|
||||||
|
for (let i = 0; i < docs.length; i ++) {
|
||||||
|
newdoc.push({});
|
||||||
|
for (let j in docs[i]) {
|
||||||
|
if (docs[i][j].userId == userId) {
|
||||||
|
newdoc[i][j] = docs[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newdoc[i]._id = docs[i]._id;
|
||||||
|
newdoc[i].time = docs[i].time;
|
||||||
|
newdoc[i].amt = docs[i].amt;
|
||||||
|
|
||||||
|
//If there's nothing on that date, skip
|
||||||
|
// if (newdoc[i].amt == 0) { console.log(newdoc[i]); }
|
||||||
|
}
|
||||||
|
|
||||||
|
res.send(JSON.stringify([times, newdoc]));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/dashboard.html', async (req, res) => {
|
app.get('/dashboard.html', async (req, res) => {
|
||||||
return res.sendFile('dashboard.html', { root: '.' });
|
return res.sendFile('dashboard.html', { root: '.' });
|
||||||
});
|
});
|
||||||
@@ -130,6 +167,18 @@ app.get('/index.html', async (req, res) => {
|
|||||||
return res.sendFile('index.html', { root: '.' });
|
return res.sendFile('index.html', { root: '.' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.get('/calEvent.html', async (req, res) => {
|
||||||
|
return res.sendFile('calEvent.html', { root: '.' });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/newCalEvent.html', async (req, res) => {
|
||||||
|
return res.sendFile('newCalEvent.html', { root: '.' });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get('/calendar.html', async (req, res) => {
|
||||||
|
return res.sendFile('calendar.html', { root: '.' });
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
//Stripe stuff
|
//Stripe stuff
|
||||||
app.get('/.well-known/apple-developer-merchantid-domain-association', async (req, res) => {
|
app.get('/.well-known/apple-developer-merchantid-domain-association', async (req, res) => {
|
||||||
@@ -139,6 +188,56 @@ app.get('/.well-known/apple-developer-merchantid-domain-association', async (req
|
|||||||
|
|
||||||
app.post('/sendData', async (req, res) => {
|
app.post('/sendData', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
if (req.headers.reminders) {
|
||||||
|
connection.then((client) => {
|
||||||
|
|
||||||
|
const delObjKeys = JSON.parse(req.headers.delobjkeys);
|
||||||
|
// const userId = req.headers.userid;
|
||||||
|
const dbo = client.db('main').collection('reminders');
|
||||||
|
const kbo = client.db('main').collection('reminderKeys');
|
||||||
|
|
||||||
|
//Update the Time object
|
||||||
|
for (var i in delObjKeys) {
|
||||||
|
var obj = delObjKeys[i];
|
||||||
|
|
||||||
|
dbo.findOne({ time: obj.time }).then((doc) => {
|
||||||
|
if (doc) {
|
||||||
|
// kbo.findOne({ 'userId': doc[obj.eventInd].userId }).then((doc) => {
|
||||||
|
// console.log(doc);
|
||||||
|
// }); return console.log(obj.time);
|
||||||
|
doc.amt --;
|
||||||
|
|
||||||
|
|
||||||
|
kbo.findOne({ 'userId': doc[obj.eventInd].userId }).then((kdoc) => {
|
||||||
|
if ((kdoc.times.length - 1) > 0) {
|
||||||
|
kbo.updateOne({ 'userId': doc[obj.eventInd].userId }, {$pull: { times: obj.time }});
|
||||||
|
} else {
|
||||||
|
kbo.deleteOne({ 'userId': doc[obj.eventInd].userId });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//If there's nothing left in the list, delete it
|
||||||
|
if (doc.amt > 0) {
|
||||||
|
delete doc[obj.eventInd];
|
||||||
|
// dbo.findOneAndUpdate({ time: obj.time }, newdoc);
|
||||||
|
dbo.findOneAndReplace({ time: obj.time }, doc);
|
||||||
|
} else {
|
||||||
|
dbo.deleteOne({ time: obj.time });
|
||||||
|
}
|
||||||
|
} // else { console.log("NONE", obj.time ); }
|
||||||
|
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log("ERR");
|
||||||
|
console.error(err)
|
||||||
|
res.sendStatus(500);
|
||||||
|
});
|
||||||
|
|
||||||
|
// kbo.findOneAndUpdate({ userId: userId }, { $pull: {}})
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
res.sendStatus(200);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
const pref = JSON.parse(req.headers.serversettings);
|
const pref = JSON.parse(req.headers.serversettings);
|
||||||
|
|
||||||
connection.then(async (client) => {
|
connection.then(async (client) => {
|
||||||
@@ -147,13 +246,84 @@ app.post('/sendData', async (req, res) => {
|
|||||||
await dbo.updateOne({ _id: 'WELCOME' }, {$set: { welcomechannel: pref.WELCOME.welcomechannel, welcomemessage: pref.WELCOME.welcomemessage }});
|
await dbo.updateOne({ _id: 'WELCOME' }, {$set: { welcomechannel: pref.WELCOME.welcomechannel, welcomemessage: pref.WELCOME.welcomemessage }});
|
||||||
await dbo.updateOne({ _id: 'LOG' }, {$set: { keepLogs: pref.LOG.keepLogs, logchannel: pref.LOG.logchannel, severity: pref.LOG.severity }});
|
await dbo.updateOne({ _id: 'LOG' }, {$set: { keepLogs: pref.LOG.keepLogs, logchannel: pref.LOG.logchannel, severity: pref.LOG.severity }});
|
||||||
}).then(() => { res.send("DONE"); })
|
}).then(() => { res.send("DONE"); })
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
res.send("FAILED");
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
res.send("FAILED");
|
res.send("FAILED");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//Reminder format = { time: 1212122, event: { guildId: "930148608400035860", userId: "12", name: "Some Generic Name", description: "Some description", offset: "15", link: "https://www.example.com" } }
|
||||||
|
app.post('/newCalEvent', async (req, res) => {
|
||||||
|
if (req.headers.newcalevent) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const obj = JSON.parse(req.headers.newcalevent);
|
||||||
|
// console.log(obj.time, typeof obj.time); return;
|
||||||
|
|
||||||
|
connection.then((client) => {
|
||||||
|
// Update the Key object first to check if the time is already there
|
||||||
|
const kbo = client.db('main').collection('reminderKeys');
|
||||||
|
kbo.findOne(({ 'userId': obj.event.userId })).then((doc) => {
|
||||||
|
|
||||||
|
if (doc) {
|
||||||
|
if (doc.times.indexOf(obj.time) == -1) {
|
||||||
|
kbo.updateOne({ 'userId': obj.event.userId }, { $push: { times: obj.time } })
|
||||||
|
.catch((err) => { console.error(err); res.sendStatus(500); });
|
||||||
|
} else {
|
||||||
|
return res.sendStatus(409);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
doc = { userId: obj.event.userId, times: [obj.time] }
|
||||||
|
kbo.insertOne(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Update the Time object
|
||||||
|
const dbo = client.db('main').collection('reminders');
|
||||||
|
dbo.findOne({ time: obj.time }).then((doc) => {
|
||||||
|
let n = 0;
|
||||||
|
if (doc) {
|
||||||
|
n = doc.amt;
|
||||||
|
doc.amt ++;
|
||||||
|
|
||||||
|
doc[`${n}`] = obj.event;
|
||||||
|
dbo.findOneAndReplace({ time: obj.time }, doc);
|
||||||
|
} else {
|
||||||
|
const d = new Date(Number(obj.time));
|
||||||
|
doc = { "0": obj.event, "time": obj.time, "month": d.getMonth(), "amt": 1 }; //Month used for clearing when the calendar month begins (maybe modify the garbage collection with an `else if (day == 1? clear last month)` )
|
||||||
|
dbo.insertOne(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
res.sendStatus(200);
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log("ERR");
|
||||||
|
console.error(err);
|
||||||
|
res.sendStatus(500);
|
||||||
|
});
|
||||||
|
}).catch((err) => {
|
||||||
|
console.log("ERR");
|
||||||
|
console.error(err);
|
||||||
|
res.sendStatus(500);
|
||||||
|
});
|
||||||
|
|
||||||
|
// //Make sure there hasn't been an error (header not yet sent);
|
||||||
|
// if (res.headersSent) { return console.log("ERROR"); }
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
return res.sendStatus(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.get('/', async ({ query }, response) => {
|
app.get('/', async ({ query }, response) => {
|
||||||
const { code } = query;
|
const { code } = query;
|
||||||
|
|
||||||
@@ -186,4 +356,9 @@ app.get('/', async ({ query }, response) => {
|
|||||||
return response.sendFile('index.html', { root: '.' });
|
return response.sendFile('index.html', { root: '.' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.get("*",(req,res) => {
|
||||||
|
res.sendFile("404.html", {root: '.'});
|
||||||
|
})
|
||||||
|
|
||||||
app.listen(port, () => console.log(`App listening on port ${port}`));
|
app.listen(port, () => console.log(`App listening on port ${port}`));
|
||||||
@@ -58,6 +58,15 @@
|
|||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
const guilds = JSON.parse(JSON.parse(window.localStorage.getItem('guilds')));
|
const guilds = JSON.parse(JSON.parse(window.localStorage.getItem('guilds')));
|
||||||
|
|
||||||
|
if (!guilds) {
|
||||||
|
alert("Please log in to continue");
|
||||||
|
if (window.location.href.indexOf('localhost') != -1) {
|
||||||
|
window.location = 'https://discord.com/api/oauth2/authorize?client_id=926551095352901632&redirect_uri=http%3A%2F%2Flocalhost%3A53134%2F&response_type=token&scope=identify%20guilds';
|
||||||
|
} else {
|
||||||
|
window.location = 'https://discord.com/api/oauth2/authorize?client_id=944046902415093760&redirect_uri=http%3A%2F%2Fwww.selmerbot.com%2F&response_type=token&scope=identify%20guilds';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var wrapper = document.getElementById('wrapper');
|
var wrapper = document.getElementById('wrapper');
|
||||||
|
|
||||||
var row = document.createElement("servers_row");
|
var row = document.createElement("servers_row");
|
||||||
|
|||||||
@@ -0,0 +1,238 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico" type="image/x-icon">
|
||||||
|
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Cinzel&family=Rajdhani:wght@300&family=Share+Tech+Mono&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* SUBMIT BUTTON START */
|
||||||
|
.submitButton{
|
||||||
|
position: relative;
|
||||||
|
background-color: black;
|
||||||
|
border-radius: 4em;
|
||||||
|
font-size: 16px;
|
||||||
|
color: white;
|
||||||
|
padding: 0.8em 1.8em;
|
||||||
|
cursor:pointer;
|
||||||
|
user-select:none;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
transition-duration: 0.4s;
|
||||||
|
/* margin-left: 65px; */
|
||||||
|
margin-left: 30px;
|
||||||
|
-webkit-transition-duration: 0.4s; /* Safari */
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:hover {
|
||||||
|
transition-duration: 0.1s;
|
||||||
|
background-color: #3A3A3A;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:after {
|
||||||
|
content: "";
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 4em;
|
||||||
|
left: 0;
|
||||||
|
top:0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.5s;
|
||||||
|
box-shadow: 0 0 10px 40px white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:active:after {
|
||||||
|
box-shadow: 0 0 0 0 white;
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 4em;
|
||||||
|
left: 0;
|
||||||
|
top:0;
|
||||||
|
opacity: 1;
|
||||||
|
transition: 0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submitButton:active {
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btnActive {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #ff1117;
|
||||||
|
font-size: 13px;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
border-radius: 9px;
|
||||||
|
padding: 10px 40px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-left: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btnCanceled {
|
||||||
|
color: #ffffff;
|
||||||
|
background-color: #7a7a7a;
|
||||||
|
font-size: 13px;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
border-radius: 9px;
|
||||||
|
padding: 10px 40px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-left: 40px;
|
||||||
|
}
|
||||||
|
/* SUBMIT BUTTON END */
|
||||||
|
|
||||||
|
.time input {
|
||||||
|
width: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inp input {
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: rgb(128, 128, 128);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.onload = () => {
|
||||||
|
const d = new Date();
|
||||||
|
document.title = `Editing ${d.getMonth()}/${sessionStorage.getItem('day')}/${d.getFullYear()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onbeforeunload = function() {
|
||||||
|
window.close();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function sendData(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const name = document.getElementById('ename').value;
|
||||||
|
const desc = document.getElementById('edesc').value;
|
||||||
|
const url = document.getElementById('elink').value;
|
||||||
|
const loc = document.getElementById('eloc').value;
|
||||||
|
|
||||||
|
//Time
|
||||||
|
var hour = Number(document.getElementById('ehr').value);
|
||||||
|
var minute = Number(document.getElementById('emin').value);
|
||||||
|
var offset = Number(document.getElementById('tofst').value);
|
||||||
|
var day = sessionStorage.getItem('day');
|
||||||
|
|
||||||
|
|
||||||
|
//Check if it's a valid name/desc
|
||||||
|
if (!name) {
|
||||||
|
return alert("Please enter a valid name!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check if it's a valid time
|
||||||
|
if (!(hour != undefined && minute != undefined && hour >= 0 && minute >= 0 && hour < 24 && minute < 60)) {
|
||||||
|
return alert("Please enter a valid time!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!offset || offset >= 60 || offset < 0) {
|
||||||
|
offset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Deal with the offset
|
||||||
|
//Convert the offset into ms timestamp and subtract
|
||||||
|
const offsetTS = offset * 60000;
|
||||||
|
|
||||||
|
const d = new Date(new Date().getFullYear(), new Date().getMonth(), day, hour, minute);
|
||||||
|
const serverSettings = JSON.parse(window.localStorage.getItem('serverInfo'));
|
||||||
|
const id = window.localStorage.getItem('Id');
|
||||||
|
|
||||||
|
//Reminder format = { time: 1212122, event: { guildId: "930148608400035860", userId: "12", name: "Some Generic Name", description: "Some description", offset: "15", link: "https://www.example.com" location: "Some location" } }
|
||||||
|
let obj = { time: String(d.getTime() - offsetTS), event: { guildId: serverSettings.Id, userId: id, name: name, description: desc, offset: offset, link: url, location: loc } }
|
||||||
|
|
||||||
|
//Send the data to the server
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('post', 'http://www.selmerbot.com/newCalEvent/', true);
|
||||||
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
|
xhr.setRequestHeader(`newCalEvent`, JSON.stringify(obj));
|
||||||
|
|
||||||
|
xhr.onloadend = (e) => {
|
||||||
|
console.log(xhr.response);
|
||||||
|
if (xhr.response == "OK") {
|
||||||
|
//make sure the opened window isn't a popup
|
||||||
|
if (window.opener.opener == null) { window.opener.location.reload(); }
|
||||||
|
|
||||||
|
alert("Saved!");
|
||||||
|
window.close();
|
||||||
|
} else if (xhr.response == "Internal Server Error") {
|
||||||
|
alert("Internal Server Error\nPlease try again!");
|
||||||
|
window.close();
|
||||||
|
} else if (xhr.response == "Conflict") {
|
||||||
|
alert("There's already an event at this time!");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
|
||||||
|
// alert(`${name}, ${desc}, ${url}, ${loc}, ${d}`);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
alert("An error has occured, please try again!");
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!--
|
||||||
|
Name:
|
||||||
|
Description:
|
||||||
|
Day: Hour: Minute: //Scroller?
|
||||||
|
Location:
|
||||||
|
Link:
|
||||||
|
-->
|
||||||
|
<div name="newCalEvent" style="margin-top: 20px; margin-left: 20px;">
|
||||||
|
<form class="inp">
|
||||||
|
<label for="ename">Event Name:</label>
|
||||||
|
<input type="text" id="ename" name="ename"><br><br>
|
||||||
|
|
||||||
|
<label for="edesc">Event Descriptions:</label>
|
||||||
|
<input type="text" id="edesc" name="edesc"><br><br>
|
||||||
|
|
||||||
|
<!-- Time Start -->
|
||||||
|
<div class="time">
|
||||||
|
<label for="ehr">Hour:</label> <input type="text" id="ehr" name="ehr">
|
||||||
|
<label for="emin">Minute:</label> <input type="text" id="emin" name="emin">
|
||||||
|
<label for="tofst">Offset (minutes):</label> <input type="text" id="tofst" name="tofst"><br><br>
|
||||||
|
</div>
|
||||||
|
<!-- Time End -->
|
||||||
|
|
||||||
|
<label for="elink">Event Link:</label>
|
||||||
|
<input type="text" id="elink" name="elink"><br><br>
|
||||||
|
|
||||||
|
<label for="eloc">Event Location:</label>
|
||||||
|
<input type="text" id="eloc" name="eloc"><br><br>
|
||||||
|
|
||||||
|
<input type="submit" value="Submit", class="submitButton" onclick="sendData(event)">
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<!-- <input type="time"> come back to this -->
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+27
-2
@@ -102,12 +102,20 @@
|
|||||||
scale: 1.2;
|
scale: 1.2;
|
||||||
border-radius: 10%;
|
border-radius: 10%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logoutbtn:hover {
|
.logoutbtn:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loginbtn {
|
||||||
|
margin-top: 14px;
|
||||||
|
scale: 1.2;
|
||||||
|
border-radius: 10%;
|
||||||
|
}
|
||||||
|
.loginbtn:hover {
|
||||||
|
color: #377aea;
|
||||||
|
}
|
||||||
|
|
||||||
.fivedollarbtn {
|
.fivedollarbtn {
|
||||||
color: #00f2f2;
|
color: #00f2f2;
|
||||||
font-size: 23px;
|
font-size: 23px;
|
||||||
@@ -147,6 +155,10 @@
|
|||||||
if (!window.localStorage.getItem('serverInfo')) {
|
if (!window.localStorage.getItem('serverInfo')) {
|
||||||
document.getElementById('guildslink').href = '';
|
document.getElementById('guildslink').href = '';
|
||||||
document.getElementById('guildslink').style = 'cursor: no-drop;';
|
document.getElementById('guildslink').style = 'cursor: no-drop;';
|
||||||
|
|
||||||
|
//The user is logged out
|
||||||
|
document.getElementById('loginbtn').style.display = 'block'
|
||||||
|
document.getElementById('logoutbtn').style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +167,15 @@
|
|||||||
window.location.href = 'index.html';
|
window.location.href = 'index.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get the redirect link <!-- NOTE: "response_type=token" ALWAYS!!! http://www.selmerbot.com/ -->
|
||||||
|
function getAPIRedirect() {
|
||||||
|
if (window.location.href.indexOf('localhost') != -1) {
|
||||||
|
return 'https://discord.com/api/oauth2/authorize?client_id=926551095352901632&redirect_uri=http%3A%2F%2Flocalhost%3A53134%2F&response_type=token&scope=identify%20guilds';
|
||||||
|
} else {
|
||||||
|
// return "https://discord.com/api/oauth2/authorize?client_id=944046902415093760&redirect_uri=https%3A%2F%2Fselmer-bot-website.herokuapp.com%2F&response_type=token&scope=identify%20guilds"
|
||||||
|
return 'https://discord.com/api/oauth2/authorize?client_id=944046902415093760&redirect_uri=http%3A%2F%2Fwww.selmerbot.com%2F&response_type=token&scope=identify%20guilds';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function pay(url, qrurl = null, qr = false) {
|
function pay(url, qrurl = null, qr = false) {
|
||||||
//$5 - https://buy.stripe.com/7sIfZW2Er0aZ1by000 - https://github.com/ION606/selmer-bot-website/blob/main/assets/stripe_payment5.png?raw=true
|
//$5 - https://buy.stripe.com/7sIfZW2Er0aZ1by000 - https://github.com/ION606/selmer-bot-website/blob/main/assets/stripe_payment5.png?raw=true
|
||||||
@@ -186,6 +207,10 @@
|
|||||||
<a href="myGuilds.html" id="guildslink" class="nav-link"><i class="fa-solid fa-server" alt="Servers" style="scale: 2; color: rgb(11, 189, 189);"></i></a>
|
<a href="myGuilds.html" id="guildslink" class="nav-link"><i class="fa-solid fa-server" alt="Servers" style="scale: 2; color: rgb(11, 189, 189);"></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="calendar.html" id="callink" class="nav-link"><i class="fa-solid fa-calendar" alt="Calendar" style="scale: 2; color: lightgrey;"></i></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="https://github.com/ION606/selmerBot/wiki" target="_blank" class="nav-link"><i class="fa-solid fa-book" style="scale: 2; color: white;" alt="WIKI"></i></a>
|
<a href="https://github.com/ION606/selmerBot/wiki" target="_blank" class="nav-link"><i class="fa-solid fa-book" style="scale: 2; color: white;" alt="WIKI"></i></a>
|
||||||
</li>
|
</li>
|
||||||
@@ -197,8 +222,8 @@
|
|||||||
|
|
||||||
<div class="container"><h1 style="font-family: 'Rajdhani', sans-serif; text-align: left;">Selmer Bot Web Dashboard</h1></div>
|
<div class="container"><h1 style="font-family: 'Rajdhani', sans-serif; text-align: left;">Selmer Bot Web Dashboard</h1></div>
|
||||||
<span class="ms-auto" style="margin-right: 1%;">
|
<span class="ms-auto" style="margin-right: 1%;">
|
||||||
<!-- <button id="login" class="loginbtn" onclick="window.location = getAPIRedirect()">Log Into Dashboard</button> -->
|
|
||||||
<button onclick="logout()" id="logoutbtn" class="logoutbtn"><i class="fa-solid fa-arrow-right-from-bracket" alt="Log Out"></i></button>
|
<button onclick="logout()" id="logoutbtn" class="logoutbtn"><i class="fa-solid fa-arrow-right-from-bracket" alt="Log Out"></i></button>
|
||||||
|
<button onclick="window.location = getAPIRedirect()" id="loginbtn" class="loginbtn" style="display: none;"><i class="fa-solid fa-arrow-right-from-bracket" alt="Log In"></i></button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
Reference in New Issue
Block a user