main.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import $ from 'jquery';
  2. import GPM, { Instance as gpm } from './utils/gpm';
  3. import KeepAlive from './utils/keepalive';
  4. import Updates, { Instance as updates, Notifications, Feed } from './updates';
  5. import Dashboard from './dashboard';
  6. import Pages from './pages';
  7. import Forms from './forms';
  8. import Scrollbar, { Instance as contentScrollbar } from './utils/scrollbar';
  9. import './plugins';
  10. import './themes';
  11. import { Filter as MediaFilter, Instance as MediaFilterInstance} from './media';
  12. import toastr from './utils/toastr';
  13. import request from './utils/request';
  14. import './utils/2fa';
  15. // bootstrap jQuery extensions
  16. import './utils/bootstrap-transition';
  17. import './utils/bootstrap-collapse';
  18. // tabs memory
  19. import './utils/tabs-memory';
  20. // Main Sidebar
  21. import Sidebar, { Instance as sidebar } from './utils/sidebar';
  22. // starts the keep alive, auto runs every X seconds
  23. KeepAlive.start();
  24. // Sidebar auto-refresh
  25. global.setInterval(() => {
  26. contentScrollbar.update();
  27. sidebar.scroller.update();
  28. }, 150);
  29. // global event to catch sidebar_state changes
  30. $(global).on('sidebar_state._grav', () => {
  31. /* Should not be needed since Gemini Scrollbar v1.4.0
  32. * - Auto-update scrollbar on resize
  33. *
  34. * $('.admin-menu-wrapper').data('scrollbar').update();
  35. * $('#admin-main .content-wrapper').data('scrollbar').update();
  36. */
  37. Object.keys(Dashboard.Chart.Instances).forEach((chart) => {
  38. setTimeout(() => Dashboard.Chart.Instances[chart].chart.update(), 10);
  39. });
  40. });
  41. export default {
  42. GPM: {
  43. GPM,
  44. Instance: gpm
  45. },
  46. KeepAlive,
  47. Dashboard,
  48. Pages,
  49. Forms,
  50. Scrollbar: {
  51. Scrollbar,
  52. Instance: contentScrollbar
  53. },
  54. Updates: {
  55. Updates,
  56. Notifications,
  57. Feed,
  58. Instance: updates
  59. },
  60. Sidebar: {
  61. Sidebar,
  62. Instance: sidebar
  63. },
  64. MediaFilter: {
  65. MediaFilter,
  66. Instance: MediaFilterInstance
  67. },
  68. Utils: { request, toastr }
  69. };