add new alerts and fix dark mode again
This commit is contained in:
parent
0e06f70b3b
commit
113b755b68
|
|
@ -1,6 +1,6 @@
|
|||
function getDarkMode() {
|
||||
var currentTime = new Date().getHours();
|
||||
if (6 >= currentTime || currentTime > 18) {
|
||||
if (6 >= currentTime || currentTime > 16) {
|
||||
var li = document.createElement('link');
|
||||
var href = "https://archblox.com/css/appdark.css";
|
||||
var rel = 'stylesheet';
|
||||
|
|
|
|||
|
|
@ -10,24 +10,64 @@ console.log(" ");
|
|||
|
||||
// Detect if user is on an older domain that isn't recommended.
|
||||
|
||||
function addWarning() {
|
||||
function addUnsupportedWarning() {
|
||||
let alertsystemdiv = document.createElement("div");
|
||||
alertsystemdiv.innerHTML = "You are on an unsupported version of the site. Please go to <a href='https://archblox.com'>archblox.com</a> instead.";
|
||||
alertsystemdiv.setAttribute("class","alert warning visible");
|
||||
document.body.appendChild(alertsystemdiv);
|
||||
}
|
||||
|
||||
function addDatabaseBackupRestoreWarning() {
|
||||
function addDatabaseBackupWarning() {
|
||||
let alertsystemdiv = document.createElement("div");
|
||||
alertsystemdiv.innerHTML = "<div class='alert loading visible'>Thanks for playing! We'll be back as soon as I can get a new VPS. (Please don't change settings, message or post anything!)</div>";
|
||||
alertsystemdiv.innerHTML = "<div class='alert loading visible'>The database is currently being backed up. Please don't change any settings, send messages or update your status. They will not be saved. Invite creation and sign up has been temporarily disabled.</div>";
|
||||
alertsystemdiv.setAttribute("class","alert warning visible");
|
||||
document.body.appendChild(alertsystemdiv);
|
||||
}
|
||||
|
||||
function addDatabaseBackupCompleteNotification() {
|
||||
let alertsystemdiv = document.createElement("div");
|
||||
alertsystemdiv.innerHTML = "<div class='alert loading visible'>The database has finished being backed up. Invite creation and Sign Up has been re-enabled.</div>";
|
||||
alertsystemdiv.setAttribute("class","alert-system");
|
||||
document.body.appendChild(alertsystemdiv);
|
||||
}
|
||||
|
||||
if (window.document.location.hostname == "archblox.com" || window.document.location.hostname == "localhost" || window.document.location.hostname == "127.0.0.1" || window.document.location.hostname == "127.0.0.1:8000") {
|
||||
function addDatabaseRestoreWarning() {
|
||||
let alertsystemdiv = document.createElement("div");
|
||||
alertsystemdiv.innerHTML = "<div class='alert loading visible'>The database is currently being restored. Please don't change any settings, send messages or update your status. They will not be saved. Invite creation and sign up has been temporarily disabled.</div>";
|
||||
alertsystemdiv.setAttribute("class","alert warning visible");
|
||||
document.body.appendChild(alertsystemdiv);
|
||||
}
|
||||
|
||||
function addDatabaseRestoreCompleteNotification() {
|
||||
let alertsystemdiv = document.createElement("div");
|
||||
alertsystemdiv.innerHTML = "<div class='alert loading visible'>The database has finished being restored. Invite creation and Sign Up has been re-enabled.</div>";
|
||||
alertsystemdiv.setAttribute("class","alert-system");
|
||||
document.body.appendChild(alertsystemdiv);
|
||||
}
|
||||
|
||||
function addShutdownWarning(date) {
|
||||
let alertsystemdiv = document.createElement("div");
|
||||
alertsystemdiv.innerHTML = "<div class='alert loading visible'>Thanks for playing! ARCHBLOX's VPS will be shutting down on "+ date +". We'll be back eventually. For now, please don't change any settings, send messages or update your status. They will not be saved. Invite creation and sign up has been temporarily disabled.</div>";
|
||||
alertsystemdiv.setAttribute("class","alert warning visible");
|
||||
document.body.appendChild(alertsystemdiv);
|
||||
}
|
||||
|
||||
function addMaintenanceWarning(date,enddate) {
|
||||
let alertsystemdiv = document.createElement("div");
|
||||
alertsystemdiv.innerHTML = "<div class='alert loading visible'>ARCHBLOX will go under maintenance on " + date +". It will finish on "+ enddate +".</div>";
|
||||
alertsystemdiv.setAttribute("class","alert-system");
|
||||
document.body.appendChild(alertsystemdiv);
|
||||
}
|
||||
|
||||
if (window.document.location.hostname == "archblox.com" || window.document.location.hostname == "www.archblox.com" || window.document.location.hostname == "localhost" || window.document.location.hostname == "127.0.0.1" || window.document.location.hostname == "127.0.0.1:8000") {
|
||||
console.log("User is on " + window.document.location.hostname + ". Supported URL.");
|
||||
//addDatabaseBackupRestoreWarning(); -- only when the sever is backing up.
|
||||
//addDatabaseBackupWarning(); // when the database is backing up.
|
||||
//addDatabaseBackupCompleteNotification(); // when the database has completed a backup.
|
||||
//addDatabaseRestoreWarning(); // when the database is restoring from a backup.
|
||||
//addDatabaseRestoreCompleteNotification(); // when the database has completed a restore.
|
||||
//addShutdownWarning("26/11/2022 (DD/MM/YYYY)"); // when vps is about to expire and site is going into maintenance.
|
||||
//addMaintenanceWarning("06/03/2023 (DD/MM/YYYY)","an unknown date."); // when site is going into maintenance.
|
||||
} else {
|
||||
console.log("User is on " + window.document.location.hostname + ". Unsupported/legacy URL.");
|
||||
addWarning();
|
||||
addUnsupportedWarning();
|
||||
}
|
||||
Loading…
Reference in New Issue