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

150 lines
4.9 KiB
Text
Raw Permalink Normal View History

2023-06-19 14:21:58 +05:00
<!-- Core JS Files -->
<script src="https://cdn.jsdelivr.net/npm/jquery.skeleton.loader@1.2.0/dist/jquery.scheletrone.min.js"></script>
<script src="https://code.jquery.com/ui/1.13.1/jquery-ui.min.js"
2023-06-22 19:36:52 +05:00
integrity="sha256-eTyxS0rkjpLEo16uXTS0uVCS4815lc40K2iVpWDvdSY=" crossorigin="anonymous"></script>
2023-06-19 14:21:58 +05:00
<script>
2023-06-22 19:36:52 +05:00
function login(url) {
<% if (!req.session.user) { %>
const newWindow = window.open('/discord', 'Log in with discord', `directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width=500, height=800`);
newWindow.focus();
setInterval(() => {
if (newWindow.closed) window.location.href = `${url}?swal=logged`;
}, 500);
<% } else { %>
window.location.href = `${url}?swal=alreadyloggedin`;
<% } %>
}
$('.account').click(function (e) {
e.preventDefault();
login(e.currentTarget.href)
});
$('.theme').click(function () {
$('.theme').removeClass('active');
$(this).addClass('active');
const theme = $(this).attr('data-theme');
setCookie('selectedTheme', theme, 365);
location.reload();
});
const sidenav = document.getElementById('sidenav-main');
function hideSidenav() {
body.classList.remove(className);
setTimeout(function () {
sidenav.classList.remove('bg-white');
}, 100);
sidenav.classList.remove('bg-transparent');
}
function showSidenav() {
try {
body.classList.add(className);
sidenav.classList.add('bg-white');
sidenav.classList.remove('bg-transparent');
iconSidenav.classList.remove('d-none');
} catch (error) {
}
}
<% if (!themeConfig?.sidebar?.gestures?.disabled) { %>
document.addEventListener('touchstart', handleTouchStart, false);
document.addEventListener('touchmove', handleTouchMove, false);
document.addEventListener('touchend', handleTouchEnd, false);
const SWIPE_BLOCK_ELEMS = [
'swipBlock',
'handle',
'drag-ruble'
]
let xDown = null;
let yDown = null;
let xDiff = null;
let yDiff = null;
let timeDown = null;
const TIME_THRESHOLD = <%= themeConfig?.sidebar?.gestures?.gestureTimer || 200 %>;
const DIFF_THRESHOLD = <%= themeConfig?.sidebar?.gestures?.gestureSensitivity || 50 %>;
function handleTouchEnd() {
let timeDiff = Date.now() - timeDown;
if (Math.abs(xDiff) > Math.abs(yDiff)) {
if (Math.abs(xDiff) > DIFF_THRESHOLD && timeDiff < TIME_THRESHOLD) {
if (xDiff > 0) {
hideSidenav()
xDown = null;
yDown = null;
timeDown = null;
} else {
showSidenav()
xDown = null;
yDown = null;
timeDown = null;
}
}
}
xDown = null;
yDown = null;
timeDown = null;
}
function containsClassName(evntarget, classArr) {
for (var i = classArr.length - 1; i >= 0; i--) {
if (evntarget.classList.contains(classArr[i])) {
return true;
}
}
}
function handleTouchStart(evt) {
let touchStartTarget = evt.target;
if (containsClassName(touchStartTarget, SWIPE_BLOCK_ELEMS)) {
return;
}
timeDown = Date.now()
xDown = evt.touches[0].clientX;
yDown = evt.touches[0].clientY;
xDiff = 0;
yDiff = 0;
}
function handleTouchMove(evt) {
if (!xDown || !yDown) {
return;
}
var xUp = evt.touches[0].clientX;
var yUp = evt.touches[0].clientY;
xDiff = xDown - xUp;
yDiff = yDown - yUp;
}
<% } %>
<% if (req.displayLoggedInInfo == true) { %>
window.onload = function () {
2023-10-30 22:33:32 +05:00
Notiflix.Notify.success("<%= themeConfig?.notify?.success?.login || 'Successfully signed in.' %>", { timeout: 2000 })
2023-06-22 19:36:52 +05:00
};
<% } %>
2023-06-19 14:21:58 +05:00
</script>
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/plugins/chartjs.min.js"></script>
<script src="js/dashboard/themeselect.js"></script>
2023-10-30 22:33:32 +05:00
<script src="js/plugins/notiflix-aio-3.2.6.min.js"></script>
2023-06-19 14:21:58 +05:00
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/custom.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/sidebarmenu.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/perfect-scrollbar.jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/core/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/core/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/plugins/perfect-scrollbar.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/plugins/smooth-scrollbar.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Assistants-Center/DBD-Soft-UI/views/src/js/core/bootstrap.min.js"></script>
<script src="https://kit.fontawesome.com/5c57f03f9b.js" crossorigin="anonymous"></script>
<script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>