1 | /*! |
||
2 | |||
3 | ========================================================= |
||
4 | * Paper Dashboard 2 - v2.0.0 |
||
5 | ========================================================= |
||
6 | |||
7 | * Product Page: https://www.creative-tim.com/product/paper-dashboard-2 |
||
8 | * Copyright 2018 Creative Tim (http://www.creative-tim.com) |
||
9 | |||
10 | * Designed by www.invisionapp.com Coded by www.creative-tim.com |
||
11 | |||
12 | ========================================================= |
||
13 | |||
14 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
||
15 | |||
16 | */ |
||
17 | |||
18 | (function() { |
||
19 | isWindows = navigator.platform.indexOf('Win') > -1 ? true : false; |
||
0 ignored issues
–
show
|
|||
20 | |||
21 | if (isWindows) { |
||
22 | // if we are on windows OS we activate the perfectScrollbar function |
||
23 | $('.sidebar .sidebar-wrapper, .main-panel').perfectScrollbar(); |
||
24 | |||
25 | $('html').addClass('perfect-scrollbar-on'); |
||
26 | } else { |
||
27 | $('html').addClass('perfect-scrollbar-off'); |
||
28 | } |
||
29 | })(); |
||
30 | |||
31 | transparent = true; |
||
0 ignored issues
–
show
|
|||
32 | transparentDemo = true; |
||
0 ignored issues
–
show
|
|||
33 | fixedTop = false; |
||
0 ignored issues
–
show
|
|||
34 | |||
35 | navbar_initialized = false; |
||
0 ignored issues
–
show
|
|||
36 | backgroundOrange = false; |
||
0 ignored issues
–
show
|
|||
37 | sidebar_mini_active = false; |
||
0 ignored issues
–
show
|
|||
38 | toggle_initialized = false; |
||
0 ignored issues
–
show
|
|||
39 | |||
40 | seq = 0, delays = 80, durations = 500; |
||
0 ignored issues
–
show
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.
The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression. This operator is most often used in Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator. This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements. var a,b,c;
a = 1, b = 1, c= 3;
could just as well be written as: var a,b,c;
a = 1;
b = 1;
c = 3;
To learn more about the sequence operator, please refer to the MDN. ![]() |
|||
41 | seq2 = 0, delays2 = 80, durations2 = 500; |
||
0 ignored issues
–
show
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.
The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression. This operator is most often used in Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator. This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements. var a,b,c;
a = 1, b = 1, c= 3;
could just as well be written as: var a,b,c;
a = 1;
b = 1;
c = 3;
To learn more about the sequence operator, please refer to the MDN. ![]() |
|||
42 | |||
43 | $(document).ready(function() { |
||
44 | |||
45 | if ($('.full-screen-map').length == 0 && $('.bd-docs').length == 0) { |
||
0 ignored issues
–
show
|
|||
46 | // On click navbar-collapse the menu will be white not transparent |
||
47 | $('.collapse').on('show.bs.collapse', function() { |
||
48 | $(this).closest('.navbar').removeClass('navbar-transparent').addClass('bg-white'); |
||
49 | }).on('hide.bs.collapse', function() { |
||
50 | $(this).closest('.navbar').addClass('navbar-transparent').removeClass('bg-white'); |
||
51 | }); |
||
52 | } |
||
53 | |||
54 | paperDashboard.initMinimizeSidebar(); |
||
0 ignored issues
–
show
The variable
paperDashboard seems to be never declared. If this is a global, consider adding a /** global: paperDashboard */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
55 | |||
56 | $navbar = $('.navbar[color-on-scroll]'); |
||
0 ignored issues
–
show
|
|||
57 | scroll_distance = $navbar.attr('color-on-scroll') || 500; |
||
0 ignored issues
–
show
|
|||
58 | |||
59 | // Check if we have the class "navbar-color-on-scroll" then add the function to remove the class "navbar-transparent" so it will transform to a plain color. |
||
60 | if ($('.navbar[color-on-scroll]').length != 0) { |
||
0 ignored issues
–
show
|
|||
61 | paperDashboard.checkScrollForTransparentNavbar(); |
||
62 | $(window).on('scroll', paperDashboard.checkScrollForTransparentNavbar) |
||
63 | } |
||
64 | |||
65 | $('.form-control').on("focus", function() { |
||
66 | $(this).parent('.input-group').addClass("input-group-focus"); |
||
67 | }).on("blur", function() { |
||
68 | $(this).parent(".input-group").removeClass("input-group-focus"); |
||
69 | }); |
||
70 | |||
71 | // Activate bootstrapSwitch |
||
72 | $('.bootstrap-switch').each(function() { |
||
73 | $this = $(this); |
||
0 ignored issues
–
show
|
|||
74 | data_on_label = $this.data('on-label') || ''; |
||
0 ignored issues
–
show
|
|||
75 | data_off_label = $this.data('off-label') || ''; |
||
0 ignored issues
–
show
|
|||
76 | |||
77 | $this.bootstrapSwitch({ |
||
78 | onText: data_on_label, |
||
79 | offText: data_off_label |
||
80 | }); |
||
81 | }); |
||
82 | }); |
||
83 | |||
84 | $(document).on('click', '.navbar-toggle', function() { |
||
85 | $toggle = $(this); |
||
0 ignored issues
–
show
|
|||
86 | |||
87 | if (paperDashboard.misc.navbar_menu_visible == 1) { |
||
0 ignored issues
–
show
The variable
paperDashboard seems to be never declared. If this is a global, consider adding a /** global: paperDashboard */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
88 | $('html').removeClass('nav-open'); |
||
89 | paperDashboard.misc.navbar_menu_visible = 0; |
||
90 | setTimeout(function() { |
||
91 | $toggle.removeClass('toggled'); |
||
92 | $('#bodyClick').remove(); |
||
93 | }, 550); |
||
94 | |||
95 | } else { |
||
96 | setTimeout(function() { |
||
97 | $toggle.addClass('toggled'); |
||
98 | }, 580); |
||
99 | |||
100 | div = '<div id="bodyClick"></div>'; |
||
0 ignored issues
–
show
|
|||
101 | $(div).appendTo('body').click(function() { |
||
102 | $('html').removeClass('nav-open'); |
||
103 | paperDashboard.misc.navbar_menu_visible = 0; |
||
0 ignored issues
–
show
The variable
paperDashboard seems to be never declared. If this is a global, consider adding a /** global: paperDashboard */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
104 | setTimeout(function() { |
||
105 | $toggle.removeClass('toggled'); |
||
106 | $('#bodyClick').remove(); |
||
107 | }, 550); |
||
108 | }); |
||
109 | |||
110 | $('html').addClass('nav-open'); |
||
111 | paperDashboard.misc.navbar_menu_visible = 1; |
||
112 | } |
||
113 | }); |
||
114 | |||
115 | $(window).resize(function() { |
||
116 | // reset the seq for charts drawing animations |
||
117 | seq = seq2 = 0; |
||
0 ignored issues
–
show
|
|||
118 | |||
119 | if ($('.full-screen-map').length == 0 && $('.bd-docs').length == 0) { |
||
0 ignored issues
–
show
|
|||
120 | $navbar = $('.navbar'); |
||
0 ignored issues
–
show
|
|||
121 | isExpanded = $('.navbar').find('[data-toggle="collapse"]').attr("aria-expanded"); |
||
0 ignored issues
–
show
|
|||
122 | if ($navbar.hasClass('bg-white') && $(window).width() > 991) { |
||
123 | $navbar.removeClass('bg-white').addClass('navbar-transparent'); |
||
124 | } else if ($navbar.hasClass('navbar-transparent') && $(window).width() < 991 && isExpanded != "false") { |
||
125 | $navbar.addClass('bg-white').removeClass('navbar-transparent'); |
||
126 | } |
||
127 | } |
||
128 | }); |
||
129 | |||
130 | paperDashboard = { |
||
0 ignored issues
–
show
|
|||
131 | misc: { |
||
132 | navbar_menu_visible: 0 |
||
133 | }, |
||
134 | |||
135 | initMinimizeSidebar: function() { |
||
136 | if ($('.sidebar-mini').length != 0) { |
||
0 ignored issues
–
show
|
|||
137 | sidebar_mini_active = true; |
||
0 ignored issues
–
show
|
|||
138 | } |
||
139 | |||
140 | $('#minimizeSidebar').click(function() { |
||
141 | var $btn = $(this); |
||
0 ignored issues
–
show
|
|||
142 | |||
143 | if (sidebar_mini_active == true) { |
||
0 ignored issues
–
show
|
|||
144 | $('body').addClass('sidebar-mini'); |
||
145 | sidebar_mini_active = true; |
||
0 ignored issues
–
show
|
|||
146 | paperDashboard.showSidebarMessage('Sidebar mini activated...'); |
||
0 ignored issues
–
show
The variable
paperDashboard seems to be never declared. If this is a global, consider adding a /** global: paperDashboard */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
147 | } else { |
||
148 | $('body').removeClass('sidebar-mini'); |
||
149 | sidebar_mini_active = false; |
||
150 | paperDashboard.showSidebarMessage('Sidebar mini deactivated...'); |
||
151 | } |
||
152 | |||
153 | // we simulate the window Resize so the charts will get updated in realtime. |
||
154 | var simulateWindowResize = setInterval(function() { |
||
155 | window.dispatchEvent(new Event('resize')); |
||
0 ignored issues
–
show
The variable
Event seems to be never declared. If this is a global, consider adding a /** global: Event */ comment.
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed. To learn more about declaring variables in Javascript, see the MDN. ![]() |
|||
156 | }, 180); |
||
157 | |||
158 | // we stop the simulation of Window Resize after the animations are completed |
||
159 | setTimeout(function() { |
||
160 | clearInterval(simulateWindowResize); |
||
161 | }, 1000); |
||
162 | }); |
||
163 | }, |
||
164 | |||
165 | showSidebarMessage: function(message) { |
||
166 | try { |
||
167 | $.notify({ |
||
168 | icon: "now-ui-icons ui-1_bell-53", |
||
169 | message: message |
||
170 | }, { |
||
171 | type: 'info', |
||
172 | timer: 4000, |
||
173 | placement: { |
||
174 | from: 'top', |
||
175 | align: 'right' |
||
176 | } |
||
177 | }); |
||
178 | } catch (e) { |
||
179 | console.log('Notify library is missing, please make sure you have the notifications library added.'); |
||
0 ignored issues
–
show
|
|||
180 | } |
||
181 | |||
182 | } |
||
183 | |||
184 | }; |
||
185 | |||
186 | function hexToRGB(hex, alpha) { |
||
187 | var r = parseInt(hex.slice(1, 3), 16), |
||
188 | g = parseInt(hex.slice(3, 5), 16), |
||
189 | b = parseInt(hex.slice(5, 7), 16); |
||
190 | |||
191 | if (alpha) { |
||
192 | return "rgba(" + r + ", " + g + ", " + b + ", " + alpha + ")"; |
||
193 | } else { |
||
0 ignored issues
–
show
|
|||
194 | return "rgb(" + r + ", " + g + ", " + b + ")"; |
||
195 | } |
||
196 | } |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.