1
|
|
|
/* |
2
|
|
|
* MikoPBX - free phone system for small business |
3
|
|
|
* Copyright (C) 2017-2023 Alexey Portnov and Nikolay Beketov |
4
|
|
|
* |
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
6
|
|
|
* it under the terms of the GNU General Public License as published by |
7
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
8
|
|
|
* (at your option) any later version. |
9
|
|
|
* |
10
|
|
|
* This program is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
|
|
|
* GNU General Public License for more details. |
14
|
|
|
* |
15
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
16
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
17
|
|
|
*/ |
18
|
|
|
const responsive = { |
19
|
|
|
$sidebar: $('#sidebar-menu'), |
20
|
|
|
$sidebarMenuButton: $('#sidebar-menu-button'), |
21
|
|
|
$hideOnMobileElements: $('.hide-on-mobile'), |
22
|
|
|
initialize() { |
23
|
|
|
responsive.$sidebar.sidebar('setting', 'transition', 'overlay'); |
24
|
|
|
responsive.$sidebar.sidebar('attach events', '#sidebar-menu-button'); |
25
|
|
|
window.addEventListener('resize', responsive.toggleSidebar); |
26
|
|
|
responsive.toggleSidebar(); |
27
|
|
|
}, |
28
|
|
|
toggleSidebar() |
29
|
|
|
{ |
30
|
|
|
if (window.innerWidth <= 768) { |
31
|
|
|
responsive.$sidebar.sidebar('hide'); |
32
|
|
|
responsive.$sidebarMenuButton.show(); |
33
|
|
|
responsive.$hideOnMobileElements.hide(); |
34
|
|
|
} else { |
35
|
|
|
responsive.$sidebar.sidebar('show'); |
36
|
|
|
responsive.$sidebarMenuButton.hide(); |
37
|
|
|
responsive.$hideOnMobileElements.show(); |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
// attach ready event |
43
|
|
|
$(document).ready(() => { |
44
|
|
|
responsive.initialize(); |
45
|
|
|
}); |
46
|
|
|
|