ViannyCruz commited on
Commit
58f23cd
·
verified ·
1 Parent(s): d53accb

Update web/js/config.js

Browse files
Files changed (1) hide show
  1. web/js/config.js +71 -93
web/js/config.js CHANGED
@@ -1,94 +1,72 @@
1
- "use strict";
2
-
3
- var base = {
4
- defaultFontFamily: "Overpass, sans-serif",
5
- primaryColor: "#1b68ff",
6
- secondaryColor: "#4f4f4f",
7
- successColor: "#3ad29f",
8
- warningColor: "#ffc107",
9
- infoColor: "#17a2b8",
10
- dangerColor: "#dc3545",
11
- darkColor: "#343a40",
12
- lightColor: "#f2f3f6"
13
- };
14
-
15
- var extend = {
16
- primaryColorLight: tinycolor(base.primaryColor).lighten(10).toString(),
17
- primaryColorLighter: tinycolor(base.primaryColor).lighten(30).toString(),
18
- primaryColorDark: tinycolor(base.primaryColor).darken(10).toString(),
19
- primaryColorDarker: tinycolor(base.primaryColor).darken(30).toString()
20
- };
21
-
22
- var chartColors = [base.primaryColor, base.successColor, "#6f42c1", extend.primaryColorLighter];
23
-
24
- var colors = {
25
- bodyColor: "#6c757d",
26
- headingColor: "#495057",
27
- borderColor: "#e9ecef",
28
- backgroundColor: "#f8f9fa",
29
- mutedColor: "#adb5bd",
30
- chartTheme: "light"
31
- };
32
-
33
- var darkColor = {
34
- bodyColor: "#adb5bd",
35
- headingColor: "#e9ecef",
36
- borderColor: "#212529",
37
- backgroundColor: "#495057",
38
- mutedColor: "#adb5bd",
39
- chartTheme: "dark"
40
- };
41
-
42
- var curentTheme = localStorage.getItem("mode");
43
- var dark = document.querySelector("#darkTheme");
44
- var light = document.querySelector("#lightTheme");
45
- var switcher = document.querySelector("#modeSwitcher");
46
-
47
- function modeSwitch() {
48
- var o = localStorage.getItem("mode");
49
- if (o) {
50
- if ("dark" == o) {
51
- if (dark) dark.disabled = true;
52
- if (light) light.disabled = false;
53
- localStorage.setItem("mode", "light");
54
- } else {
55
- if (dark) dark.disabled = false;
56
- if (light) light.disabled = true;
57
- localStorage.setItem("mode", "dark");
58
- }
59
- } else {
60
- if ($("body").hasClass("dark")) {
61
- if (dark) dark.disabled = false;
62
- if (light) light.disabled = true;
63
- localStorage.setItem("mode", "dark");
64
- } else {
65
- if (dark) dark.disabled = true;
66
- if (light) light.disabled = false;
67
- localStorage.setItem("mode", "light");
68
- }
69
- }
70
- }
71
-
72
- console.log(curentTheme);
73
-
74
- if (curentTheme) {
75
- if ("dark" == curentTheme) {
76
- if (dark) dark.disabled = false;
77
- if (light) light.disabled = true;
78
- colors = darkColor;
79
- } else if ("light" == curentTheme) {
80
- if (dark) dark.disabled = true;
81
- if (light) light.disabled = false;
82
- }
83
- // FIX: guard against switcher being null before accessing .dataset
84
- if (switcher) {
85
- switcher.dataset.mode = curentTheme;
86
- }
87
- } else {
88
- if ($("body").hasClass("dark")) {
89
- colors = darkColor;
90
- localStorage.setItem("mode", "dark");
91
- } else {
92
- localStorage.setItem("mode", "light");
93
- }
94
  }
 
1
+ "use strict";
2
+
3
+ var base = {
4
+ defaultFontFamily: "Overpass, sans-serif",
5
+ primaryColor: "#1b68ff",
6
+ secondaryColor: "#4f4f4f",
7
+ successColor: "#3ad29f",
8
+ warningColor: "#ffc107",
9
+ infoColor: "#17a2b8",
10
+ dangerColor: "#dc3545",
11
+ darkColor: "#343a40",
12
+ lightColor: "#f2f3f6"
13
+ };
14
+
15
+ var extend = {
16
+ primaryColorLight: tinycolor(base.primaryColor).lighten(10).toString(),
17
+ primaryColorLighter: tinycolor(base.primaryColor).lighten(30).toString(),
18
+ primaryColorDark: tinycolor(base.primaryColor).darken(10).toString(),
19
+ primaryColorDarker: tinycolor(base.primaryColor).darken(30).toString()
20
+ };
21
+
22
+ var chartColors = [base.primaryColor, base.successColor, "#6f42c1", extend.primaryColorLighter];
23
+
24
+ var colors = {
25
+ bodyColor: "#6c757d",
26
+ headingColor: "#495057",
27
+ borderColor: "#e9ecef",
28
+ backgroundColor: "#f8f9fa",
29
+ mutedColor: "#adb5bd",
30
+ chartTheme: "light"
31
+ };
32
+
33
+ var darkColor = {
34
+ bodyColor: "#adb5bd",
35
+ headingColor: "#e9ecef",
36
+ borderColor: "#212529",
37
+ backgroundColor: "#495057",
38
+ mutedColor: "#adb5bd",
39
+ chartTheme: "dark"
40
+ };
41
+
42
+ // Usar la misma clave que el resto del sistema
43
+ var curentTheme = localStorage.getItem("theme");
44
+ var dark = document.querySelector("#darkTheme");
45
+ var light = document.querySelector("#lightTheme");
46
+ var switcher = document.querySelector("#modeSwitcher");
47
+
48
+ function modeSwitch() {
49
+ var o = localStorage.getItem("theme");
50
+ if (o === "dark") {
51
+ if (dark) dark.disabled = true;
52
+ if (light) light.disabled = false;
53
+ localStorage.setItem("theme", "light");
54
+ } else {
55
+ if (dark) dark.disabled = false;
56
+ if (light) light.disabled = true;
57
+ localStorage.setItem("theme", "dark");
58
+ }
59
+ }
60
+
61
+ if (curentTheme === "dark") {
62
+ if (dark) dark.disabled = false;
63
+ if (light) light.disabled = true;
64
+ colors = darkColor;
65
+ } else {
66
+ if (dark) dark.disabled = true;
67
+ if (light) light.disabled = false;
68
+ }
69
+
70
+ if (switcher) {
71
+ switcher.dataset.mode = curentTheme || "light";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }