|
@@ -219,27 +219,36 @@
|
|
|
}) : null;
|
|
}) : null;
|
|
|
// =============================================================
|
|
// =============================================================
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
// ======================= toggle theme =======================
|
|
// ======================= toggle theme =======================
|
|
|
|
|
+ {{ $enableDarkMode := ($.Param "enableDarkMode") }}
|
|
|
|
|
+ var enableDarkMode = JSON.parse({{ $enableDarkMode | jsonify }});
|
|
|
var root = document.getElementById('root');
|
|
var root = document.getElementById('root');
|
|
|
var toggleToLightBtn = document.getElementById('toggleToLight');
|
|
var toggleToLightBtn = document.getElementById('toggleToLight');
|
|
|
var toggleToDarkBtn = document.getElementById('toggleToDark');
|
|
var toggleToDarkBtn = document.getElementById('toggleToDark');
|
|
|
|
|
|
|
|
- toggleToDark.onclick = function(e) {
|
|
|
|
|
- root.className = 'theme__dark';
|
|
|
|
|
- localStorage.setItem('theme', 'dark');
|
|
|
|
|
- toggleToLightBtn.className = 'navbar__icons--icon';
|
|
|
|
|
- toggleToDarkBtn.className = 'hide';
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- toggleToLight.onclick = function (e) {
|
|
|
|
|
|
|
+ if (!enableDarkMode) {
|
|
|
root.className = 'theme__light';
|
|
root.className = 'theme__light';
|
|
|
localStorage.setItem('theme', 'light');
|
|
localStorage.setItem('theme', 'light');
|
|
|
- toggleToLightBtn.className = 'hide';
|
|
|
|
|
- toggleToDarkBtn.className = 'navbar__icons--icon';
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (toggleToDarkBtn) {
|
|
|
|
|
+ toggleToDarkBtn.onclick = function (e) {
|
|
|
|
|
+ root.className = 'theme__dark';
|
|
|
|
|
+ localStorage.setItem('theme', 'dark');
|
|
|
|
|
+ toggleToLightBtn.className = 'navbar__icons--icon';
|
|
|
|
|
+ toggleToDarkBtn.className = 'hide';
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (toggleToLightBtn) {
|
|
|
|
|
+ toggleToLightBtn.onclick = function (e) {
|
|
|
|
|
+ root.className = 'theme__light';
|
|
|
|
|
+ localStorage.setItem('theme', 'light');
|
|
|
|
|
+ toggleToLightBtn.className = 'hide';
|
|
|
|
|
+ toggleToDarkBtn.className = 'navbar__icons--icon';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// =================== section menu collapse ==================
|
|
// =================== section menu collapse ==================
|
|
|
document.querySelectorAll('.menu__list').forEach(function(elem) {
|
|
document.querySelectorAll('.menu__list').forEach(function(elem) {
|