/** * Toggles * * Non-animation */ ;(function($, window, undefined) { "use strict"; $(document).ready(function() { // Chat Toggler $('a[data-toggle="chat"]').each(function(i, el) { $(el).on('click', function(ev) { ev.preventDefault(); public_vars.$body.toggleClass('chat-open'); if($.isFunction($.fn.perfectScrollbar)) { setTimeout(function() { public_vars.$chat.find('.chat_inner').perfectScrollbar('update'); $(window).trigger('xenon.resize'); }, 1); } }); }); // Settings Pane Toggler $('a[data-toggle="settings-pane"]').each(function(i, el) { $(el).on('click', function(ev) { ev.preventDefault(); var use_animation = attrDefault($(el), 'animate', false) && ! isxs(); var scroll = { top: $(document).scrollTop(), toTop: 0 }; if(public_vars.$body.hasClass('settings-pane-open')) { scroll.toTop = scroll.top; } TweenMax.to(scroll, (use_animation ? .1 : 0), {top: scroll.toTop, roundProps: ['top'], ease: scroll.toTop < 10 ? null : Sine.easeOut, onUpdate: function() { $(window).scrollTop( scroll.top ); }, onComplete: function() { if(use_animation) { // With Animation public_vars.$settingsPaneIn.addClass('with-animation'); // Opening if( ! public_vars.$settingsPane.is(':visible')) { public_vars.$body.addClass('settings-pane-open'); var height = public_vars.$settingsPane.outerHeight(true); public_vars.$settingsPane.css({ height: 0 }); TweenMax.to(public_vars.$settingsPane, .25, {css: {height: height}, ease: Circ.easeInOut, onComplete: function() { public_vars.$settingsPane.css({height: ''}); }}); public_vars.$settingsPaneIn.addClass('visible'); } // Closing else { public_vars.$settingsPaneIn.addClass('closing'); TweenMax.to(public_vars.$settingsPane, .25, {css: {height: 0}, delay: .15, ease: Power1.easeInOut, onComplete: function() { public_vars.$body.removeClass('settings-pane-open'); public_vars.$settingsPane.css({height: ''}); public_vars.$settingsPaneIn.removeClass('closing visible'); }}); } } else { // Without Animation public_vars.$body.toggleClass('settings-pane-open'); public_vars.$settingsPaneIn.removeClass('visible'); public_vars.$settingsPaneIn.removeClass('with-animation'); } } }); }); }); // Sidebar Toggle $('a[data-toggle="sidebar"]').each(function(i, el) { $(el).on('click', function(ev) { ev.preventDefault(); if(public_vars.$sidebarMenu.hasClass('collapsed')) { public_vars.$sidebarMenu.removeClass('collapsed'); ps_init(); } else { public_vars.$sidebarMenu.addClass('collapsed'); ps_destroy(); } $(window).trigger('xenon.resize'); }); }); // Mobile Menu Trigger $('a[data-toggle="mobile-menu"]').on('click', function(ev) { ev.preventDefault(); public_vars.$mainMenu.add(public_vars.$sidebarProfile).toggleClass('mobile-is-visible'); ps_destroy(); }); // Mobile Menu Trigger for Horizontal Menu $('a[data-toggle="mobile-menu-horizontal"]').on('click', function(ev) { ev.preventDefault(); public_vars.$horizontalMenu.toggleClass('mobile-is-visible'); }); // Mobile Menu Trigger for Sidebar & Horizontal Menu $('a[data-toggle="mobile-menu-both"]').on('click', function(ev) { ev.preventDefault(); public_vars.$mainMenu.toggleClass('mobile-is-visible both-menus-visible'); public_vars.$horizontalMenu.toggleClass('mobile-is-visible both-menus-visible'); }); // Mobile User Info Menu Trigger $('a[data-toggle="user-info-menu"]').on('click', function(ev) { ev.preventDefault(); public_vars.$userInfoMenu.toggleClass('mobile-is-visible'); }); // Mobile User Info Menu Trigger for Horizontal Menu $('a[data-toggle="user-info-menu-horizontal"]').on('click', function(ev) { ev.preventDefault(); public_vars.$userInfoMenuHor.find('.nav.nav-userinfo').toggleClass('mobile-is-visible'); }); // Panel Close $('body').on('click', '.panel a[data-toggle="remove"]', function(ev) { ev.preventDefault(); var $panel = $(this).closest('.panel'), $panel_parent = $panel.parent(); $panel.remove(); if($panel_parent.children().length == 0) { $panel_parent.remove(); } }); // Panel Reload $('body').on('click', '.panel a[data-toggle="reload"]', function(ev) { ev.preventDefault(); var $panel = $(this).closest('.panel'); // This is just a simulation, nothing is going to be reloaded $panel.append('