dashboard-core/theme/dbd-soft-ui/views/partials/preloader.ejs

195 lines
7.7 KiB
Text
Raw Permalink Normal View History

2023-06-19 14:21:58 +05:00
<%
let currentPage = "Dashboard";
if (now) {
2023-06-22 19:36:52 +05:00
const pages = req?.locales?.partials?.navbar?.pages;
if (now === 'manage') currentPage = pages?.manage || "Manage Guilds";
if (now === 'settings') currentPage = pages?.settings || "Manage Guilds";
if (now === 'commands') currentPage = pages?.commands || "Commands";
if (now === 'pp') currentPage = pages?.pp || "Privacy Policy";
if (now === 'admin') currentPage = pages?.admin || "Admin Panel";
if (now === 'error') currentPage = pages?.error || "Error";
if (now === 'credits') currentPage = pages?.credits || "Credits";
if (now === 'debug') currentPage = pages?.debug || "Debug";
if (now === 'leaderboard') currentPage = pages?.leaderboard || "Leaderboard";
if (now === 'profile') currentPage = pages?.profile || "Profile";
if (now === 'maintenance') currentPage = pages?.maintenance || "Under Maintenance";
2023-06-19 14:21:58 +05:00
}
%>
<%- include('meta.ejs', {now: now}) %>
<!-- Page Information -->
<link rel="icon" type="image/png" href="<%= themeConfig.icons.favicon %>">
<title>
2023-06-22 19:36:52 +05:00
<%= themeConfig.websiteName %> - <%- currentPage %>
2023-06-19 14:21:58 +05:00
</title>
<!-- End of Page Information -->
<!-- Stylesheets -->
<% if(themeConfig.preloader.image) { %>
2023-06-22 19:36:52 +05:00
<link rel="prefetch" href="<%- themeConfig.preloader.image %>"/><% } %>
2023-06-19 14:21:58 +05:00
<link rel="preload" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="preload" href="https://fonts.googleapis.com/css?family=Alatsi" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="preload" href="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/css/nucleo-icons.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="preload" href="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/css/nucleo-svg.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="preload" href="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/css/soft-ui-dashboard.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-dark@4/dark.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<link rel="preload" href="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/css/jquery-ui.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript>
2023-06-22 19:36:52 +05:00
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alatsi">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/css/nucleo-icons.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/css/nucleo-svg.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/css/soft-ui-dashboard.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-dark@4/dark.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/css/jquery-ui.min.css">
2023-06-19 14:21:58 +05:00
</noscript>
<% // By default system theme is loaded, unless a user has changed it. Probably could be optimised further but :shrug:
if(req.cookies?.selectedTheme == "dark" || req.cookies?.selectedTheme == "auto" || !req.cookies?.selectedTheme) { %>
2023-06-22 19:36:52 +05:00
<link href="/css/darkMode.css" rel='stylesheet' <% if(req?.cookies?.selectedTheme == "auto" || !req.cookies?.selectedTheme) { %> media="(prefers-color-scheme: dark)"<% } %>>
<% if (themeConfig?.icons?.sidebar?.darkUrl) { %>
<style <% if(req?.cookies?.selectedTheme == "auto" || !req.cookies?.selectedTheme) { %> media="(prefers-color-scheme: dark)"<% } %>>
.navbar-brand-img {
content:url("<%= themeConfig.icons.sidebar.darkUrl %>") !important;
}
</style>
<% } %>
2023-06-19 14:21:58 +05:00
<% } %>
<!-- End of Stylesheets -->
<!-- Scripts -->
<script src="/js/jquery.min.js"></script>
<script src="./js/jquery-ui.js"></script>
<%- include('colorscheme.ejs') %>
<script>
2023-06-22 19:36:52 +05:00
$(document).ready(function () {
const params = new URLSearchParams(window.location.search);
const swal = params.get('swal');
const result = params.get('result');
if (swal) {
2023-10-30 22:33:32 +05:00
if (swal === "savedSuccess") Notiflix.Notify.success('<%= req?.locales?.partials?.notify?.success?.settingsSave || 'Successfully saved setttings!' %>');
if (swal === "savedError") Notiflix.Notify.error('<%= req?.locales?.partials?.notify?.errors?.settingsSave || 'Failed to save setttings!' %>');
2023-06-22 19:36:52 +05:00
2023-10-30 22:33:32 +05:00
<% if (req.session.user) { %>if (swal === "logged") Notiflix.Notify.success('<%= req?.locales?.partials?.notify?.success?.login || 'Successfully logged in!' %>'); <% } %>
<% if (!req.session.user) { %>if (swal === "loggedout") Notiflix.Notify.success('<%= req?.locales?.partials?.notify?.success?.logout || 'Successfully logged out!' %>'); <% } %>
2023-06-22 19:36:52 +05:00
params.delete('swal');
}
if (result) {
2023-10-30 22:33:32 +05:00
if (result === "true") Notiflix.Notify.success('Checked for updates!');
if (result === "false") Notiflix.Notify.error('Failed to check for updates!');
2023-06-22 19:36:52 +05:00
params.delete('result');
}
window.history.replaceState({}, document.title, `${window.location.pathname}${params.toString() ? "?" + params.toString() : ""}`);
});
var win = navigator.platform.indexOf('Win') > -1;
if (win && document.querySelector('#sidenav-scrollbar')) {
var options = {
damping: '0.5'
}
Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
}
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function deleteCookie(name) {
document.cookie = name + '=; Max-Age=0'
}
let prog_width = 0;
let disabled = false;
document.onreadystatechange = function (e) {
if (disabled) return;
if (document.readyState === "interactive") {
var all = document.getElementsByTagName("*");
for (var i = 0, max = all.length; i < max; i++) {
checkProgress(all[i]);
}
}
}
function checkProgress(ele) {
var all = document.getElementsByTagName("*");
var per_inc = 100 / all.length;
if (disabled) return;
prog_width = prog_width + per_inc;
$("#progress").width(`${Math.floor(prog_width)}%`);
if (prog_width >= 100 && !disabled) {
disabled = true;
$(".preloader").fadeOut("slow")
//() => { $(".preloader").remove() }
$("#scroll").css('overflow', 'auto');
} else {
checkProgress(ele);
}
}
<% if (req.session.user) { %>
let userID = '<%- req.session.user.id %>';
let userTag = '<%- req.session.user.tag %>';
<% } %>
var win = navigator.platform.indexOf('Win') > -1;
if (win && document.querySelector('#sidenav-scrollbar')) {
var options = {
damping: '0.5'
}
Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
}
function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
2023-06-19 14:21:58 +05:00
</script>
<!-- End of Scripts -->
<% if(now !== "maintenance" && now !== "error") { %>
2023-06-22 19:36:52 +05:00
<%- include('theme.ejs') %>
2023-06-19 14:21:58 +05:00
<% } %>