Brak opisu

scripts-sidebar.html 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <script>
  2. $(document).ready(function() {
  3. $().ready(function() {
  4. $sidebar = $('.sidebar');
  5. $navbar = $('.navbar');
  6. $main_panel = $('.main-panel');
  7. $full_page = $('.full-page');
  8. $sidebar_responsive = $('body > .navbar-collapse');
  9. sidebar_mini_active = true;
  10. white_color = false;
  11. window_width = $(window).width();
  12. fixed_plugin_open = $('.sidebar .sidebar-wrapper .nav li.active a p').html();
  13. $('.fixed-plugin a').click(function(event) {
  14. if ($(this).hasClass('switch-trigger')) {
  15. if (event.stopPropagation) {
  16. event.stopPropagation();
  17. } else if (window.event) {
  18. window.event.cancelBubble = true;
  19. }
  20. }
  21. });
  22. $('.fixed-plugin .background-color span').click(function() {
  23. $(this).siblings().removeClass('active');
  24. $(this).addClass('active');
  25. var new_color = $(this).data('color');
  26. if ($sidebar.length != 0) {
  27. $sidebar.attr('data', new_color);
  28. }
  29. if ($main_panel.length != 0) {
  30. $main_panel.attr('data', new_color);
  31. }
  32. if ($full_page.length != 0) {
  33. $full_page.attr('filter-color', new_color);
  34. }
  35. if ($sidebar_responsive.length != 0) {
  36. $sidebar_responsive.attr('data', new_color);
  37. }
  38. });
  39. $('.switch-sidebar-mini input').on("switchChange.bootstrapSwitch", function() {
  40. var $btn = $(this);
  41. if (sidebar_mini_active == true) {
  42. $('body').removeClass('sidebar-mini');
  43. sidebar_mini_active = false;
  44. blackDashboard.showSidebarMessage('Sidebar mini deactivated...');
  45. } else {
  46. $('body').addClass('sidebar-mini');
  47. sidebar_mini_active = true;
  48. blackDashboard.showSidebarMessage('Sidebar mini activated...');
  49. }
  50. // we simulate the window Resize so the charts will get updated in realtime.
  51. var simulateWindowResize = setInterval(function() {
  52. window.dispatchEvent(new Event('resize'));
  53. }, 180);
  54. // we stop the simulation of Window Resize after the animations are completed
  55. setTimeout(function() {
  56. clearInterval(simulateWindowResize);
  57. }, 1000);
  58. });
  59. $('.switch-change-color input').on("switchChange.bootstrapSwitch", function() {
  60. var $btn = $(this);
  61. if (white_color == true) {
  62. $('body').addClass('change-background');
  63. setTimeout(function() {
  64. $('body').removeClass('change-background');
  65. $('body').removeClass('white-content');
  66. }, 900);
  67. white_color = false;
  68. } else {
  69. $('body').addClass('change-background');
  70. setTimeout(function() {
  71. $('body').removeClass('change-background');
  72. $('body').addClass('white-content');
  73. }, 900);
  74. white_color = true;
  75. }
  76. });
  77. $('.light-badge').click(function() {
  78. $('body').addClass('white-content');
  79. });
  80. $('.dark-badge').click(function() {
  81. $('body').removeClass('white-content');
  82. });
  83. });
  84. });
  85. </script>