| (function(win, doc, $) { |
= |
(function(win, doc, $) { |
| var themeSettings = win.themeSettings; |
<> |
|
| var layoutHelpers = win.layoutHelpers; |
|
|
| var attachMaterialRipple = win.attachMaterialRipple; |
|
const { themeSettings, layoutHelpers, attachMaterialRipple, detachMaterialRipple, SideNav } = win |
| var detachMaterialRipple = win.detachMaterialRipple; |
|
|
| |
|
let [ firstLoad, sidenavInstance ] = [ true, null ] |
| var firstLoad = true; |
|
|
| var sidenav = null; |
|
doc.addEventListener('turbolinks:before-render', e => { |
| |
|
if (!themeSettings || $('html')[0].hasAttribute('data-turbolinks-preview')) return |
| doc.addEventListener('turbolinks:render', function(e) { |
|
|
| |
= |
|
| if (themeSettings) { |
<> |
|
| $('.theme-settings-bootstrap-css').slice(1).remove(); |
|
$('.theme-settings-bootstrap-css').slice(1).remove() |
| $('.theme-settings-appwork-css').slice(1).remove(); |
|
$('.theme-settings-appwork-css').slice(1).remove() |
| $('.theme-settings-theme-css').slice(1).remove(); |
|
$('.theme-settings-theme-css').slice(1).remove() |
| $('.theme-settings-colors-css').slice(1).remove(); |
|
$('.theme-settings-colors-css').slice(1).remove() |
| } |
|
|
| |
= |
|
| |
|
|
| if (!firstLoad && themeSettings) { |
<> |
if (!firstLoad) { |
| $('.layout-wrapper', e.data.newBody).addClass('layout-sidenav-link-no-transition'); |
|
$('.layout-wrapper', e.data.newBody).addClass('layout-sidenav-link-no-transition') |
| themeSettings.updateNavbarBg(e.data.newBody); |
|
themeSettings.updateNavbarBg(e.data.newBody) |
| themeSettings.updateSidenavBg(e.data.newBody); |
|
themeSettings.updateSidenavBg(e.data.newBody) |
| |
|
themeSettings.updateFooterBg(e.data.newBody) |
| themeSettings._setup(e.data.newBody); |
|
themeSettings._setup(e.data.newBody) |
| setTimeout(function() { |
|
setTimeout(() => |
| $('.layout-wrapper', e.data.newBody).removeClass('layout-sidenav-link-no-transition'); |
|
$('.layout-wrapper', e.data.newBody).removeClass('layout-sidenav-link-no-transition') |
| }, 50); |
|
, 50) |
| } |
= |
} |
| }); |
<> |
}) |
| |
= |
|
| doc.addEventListener('turbolinks:load', function() { |
<> |
doc.addEventListener('turbolinks:load', () => { |
| if (layoutHelpers) { |
= |
if (layoutHelpers) { |
| layoutHelpers.init(); |
<> |
layoutHelpers.init() |
| |
= |
|
| |
|
|
| layoutHelpers.update(); |
<> |
layoutHelpers.update() |
| |
= |
|
| |
|
|
| layoutHelpers.setAutoUpdate(true); |
<> |
layoutHelpers.setAutoUpdate(true) |
| |
= |
|
| |
|
|
| if (layoutHelpers.isSmallScreen()) { |
|
if (layoutHelpers.isSmallScreen()) { |
| layoutHelpers.setCollapsed(true, true); |
<> |
layoutHelpers.setCollapsed(true, true) |
| } |
= |
} |
| } |
|
} |
| |
|
|
| |
|
|
| if (!firstLoad && attachMaterialRipple && doc.documentElement.classList.contains('material-style')) { |
<> |
if (!firstLoad && attachMaterialRipple && $('html').hasClass('material-style')) { |
| attachMaterialRipple(); |
|
attachMaterialRipple() |
| } |
= |
} |
| |
|
|
| |
|
|
| $('#layout-sidenav').each(function() { |
<> |
$('#layout-sidenav').each(function () { |
| sidenav = new win.SideNav(this, { |
|
sidenavInstance = new SideNav(this, { |
| orientation: $(this).hasClass('sidenav-horizontal') ? 'horizontal' : 'vertical' |
= |
orientation: $(this).hasClass('sidenav-horizontal') ? 'horizontal' : 'vertical' |
| }); |
<> |
}) |
| }); |
|
}) |
| |
= |
|
| |
|
|
| $('body').on('click', '.layout-sidenav-toggle', function(e) { |
<> |
$('body').on('click', '.layout-sidenav-toggle', e => { |
| e.preventDefault(); |
|
e.preventDefault() |
| layoutHelpers.toggleCollapsed(); |
|
layoutHelpers.toggleCollapsed() |
| }); |
|
}) |
| |
= |
|
| |
|
|
| if ($('html').attr('dir') === 'rtl') { |
|
if ($('html').attr('dir') === 'rtl') { |
| $('#layout-navbar .dropdown-menu').toggleClass('dropdown-menu-right'); |
<> |
$('#layout-navbar .dropdown-menu').toggleClass('dropdown-menu-right') |
| } |
= |
} |
| }); |
<> |
}) |
| |
= |
|
| doc.addEventListener('turbolinks:visit', function() { |
<> |
doc.addEventListener('turbolinks:visit', () => { |
| firstLoad = false; |
|
firstLoad = false |
| |
= |
|
| |
|
|
| if (layoutHelpers) { |
|
if (layoutHelpers) { |
| layoutHelpers.destroy(); |
<> |
layoutHelpers.destroy() |
| } |
= |
} |
| |
|
|
| |
|
|
| if (detachMaterialRipple) { |
|
if (detachMaterialRipple) { |
| detachMaterialRipple(); |
<> |
detachMaterialRipple() |
| } |
= |
} |
| |
|
|
| |
|
|
| if (sidenav) { |
<> |
if (sidenavInstance) { |
| sidenav.destroy(); |
|
sidenavInstance.destroy() |
| } |
= |
} |
| |
|
|
| |
|
|
| $('body').off('click', '.layout-sidenav-toggle'); |
<> |
$('body').off('click', '.layout-sidenav-toggle') |
| }); |
|
}) |
| })(window, document, jQuery); |
|
})(window, document, jQuery) |