You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
5.5 KiB
Smarty
149 lines
5.5 KiB
Smarty
</div>
|
|
</div>
|
|
|
|
<footer class="footer">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col fs-13 text-muted text-center">
|
|
© {$config["appName"]}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
{literal}
|
|
<script>
|
|
(function () {
|
|
var sidebarToggle = document.querySelector('.button-toggle-menu');
|
|
var sidebarBackdrop = document.querySelector('.admin-sidebar-backdrop');
|
|
var sidebarLinks = document.querySelectorAll('.app-sidebar-menu a');
|
|
var mobileSidebar = window.matchMedia('(max-width: 991.98px)');
|
|
var savedPageScroll = null;
|
|
var scrollHistoryKey = '__venixAdminSidebarScroll';
|
|
|
|
function rememberPageScroll(scroll) {
|
|
var state = window.history.state;
|
|
if (state !== null && (typeof state !== 'object' || Array.isArray(state))) return;
|
|
if (!scroll && (!state || !state[scrollHistoryKey])) return;
|
|
var nextState = Object.assign({}, state);
|
|
if (scroll) nextState[scrollHistoryKey] = scroll;
|
|
else delete nextState[scrollHistoryKey];
|
|
try {
|
|
window.history.replaceState(nextState, '');
|
|
} catch (error) {
|
|
// History may be unavailable; menu controls must still work.
|
|
}
|
|
}
|
|
|
|
function openSidebar() {
|
|
if (!mobileSidebar.matches || savedPageScroll !== null) return;
|
|
|
|
savedPageScroll = { x: window.scrollX, y: window.scrollY };
|
|
// Fixed-body locking reports scrollY=0; retain the original history position.
|
|
rememberPageScroll(savedPageScroll);
|
|
document.body.style.setProperty('--admin-sidebar-scroll-top', -savedPageScroll.y + 'px');
|
|
document.documentElement.classList.add('admin-sidebar-scroll-locked');
|
|
document.body.classList.add('admin-sidebar-open');
|
|
if (sidebarToggle) sidebarToggle.setAttribute('aria-expanded', 'true');
|
|
}
|
|
|
|
function closeSidebar() {
|
|
document.body.classList.remove('admin-sidebar-open');
|
|
document.body.style.removeProperty('--admin-sidebar-scroll-top');
|
|
if (savedPageScroll !== null) {
|
|
window.scrollTo(savedPageScroll.x, savedPageScroll.y);
|
|
savedPageScroll = null;
|
|
rememberPageScroll(null);
|
|
}
|
|
document.documentElement.classList.remove('admin-sidebar-scroll-locked');
|
|
if (sidebarToggle) sidebarToggle.setAttribute('aria-expanded', 'false');
|
|
}
|
|
|
|
function closeSidebarImmediately() {
|
|
document.body.classList.add('admin-sidebar-no-transition');
|
|
closeSidebar();
|
|
window.requestAnimationFrame(function () {
|
|
window.requestAnimationFrame(function () {
|
|
document.body.classList.remove('admin-sidebar-no-transition');
|
|
});
|
|
});
|
|
}
|
|
|
|
if (sidebarToggle) {
|
|
sidebarToggle.addEventListener('click', function () {
|
|
if (document.body.classList.contains('admin-sidebar-open')) {
|
|
closeSidebar();
|
|
} else {
|
|
openSidebar();
|
|
}
|
|
});
|
|
}
|
|
|
|
if (sidebarBackdrop) {
|
|
sidebarBackdrop.addEventListener('click', closeSidebar);
|
|
}
|
|
|
|
sidebarLinks.forEach(function (link) {
|
|
link.addEventListener('click', function (event) {
|
|
if (!mobileSidebar.matches
|
|
|| event.defaultPrevented
|
|
|| event.button !== 0
|
|
|| event.metaKey
|
|
|| event.ctrlKey
|
|
|| event.shiftKey
|
|
|| event.altKey
|
|
|| link.target === '_blank'
|
|
|| link.hasAttribute('download')) {
|
|
return;
|
|
}
|
|
|
|
var target = new URL(link.href, window.location.href);
|
|
var current = new URL(window.location.href);
|
|
if (target.protocol !== 'http:' && target.protocol !== 'https:') {
|
|
return;
|
|
}
|
|
if (target.origin === current.origin
|
|
&& target.pathname === current.pathname
|
|
&& target.search === current.search) {
|
|
if (target.hash === current.hash) {
|
|
event.preventDefault();
|
|
}
|
|
closeSidebar();
|
|
}
|
|
});
|
|
});
|
|
|
|
mobileSidebar.addEventListener('change', function (event) {
|
|
if (!event.matches) closeSidebarImmediately();
|
|
});
|
|
|
|
document.addEventListener('keydown', function (event) {
|
|
if (event.key === 'Escape' && savedPageScroll !== null) {
|
|
closeSidebar();
|
|
if (sidebarToggle) sidebarToggle.focus({ preventScroll: true });
|
|
}
|
|
});
|
|
|
|
window.addEventListener('pageshow', function (event) {
|
|
if (event.persisted) {
|
|
closeSidebarImmediately();
|
|
return;
|
|
}
|
|
var navigation = window.performance.getEntriesByType('navigation')[0];
|
|
var scroll = window.history.state && window.history.state[scrollHistoryKey];
|
|
if (!navigation || (navigation.type !== 'back_forward' && navigation.type !== 'reload')
|
|
|| !scroll || !Number.isFinite(scroll.x) || !Number.isFinite(scroll.y)) return;
|
|
// Run after the browser's native history restoration, which saved the locked position.
|
|
window.requestAnimationFrame(function () {
|
|
window.scrollTo({ left: scroll.x, top: scroll.y, behavior: 'instant' });
|
|
rememberPageScroll(null);
|
|
});
|
|
});
|
|
})();
|
|
</script>
|
|
{/literal}
|
|
{if isset($admin_extra_js)}{$admin_extra_js}{/if}
|
|
</body>
|
|
</html>
|