54 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Cheetah
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Cheetah
		
	
	
	
	
	
| {{define "footer"}}
 | |
| <input type="hidden" id="csrf_token" value="{{.CsrfToken}}">
 | |
| <script src="/statics/component/layui/layui.js"></script>
 | |
| <script src="/statics/component/pear/pear.js"></script>
 | |
| <script src="/statics/component/pear/help.js"></script>
 | |
| <script src="/statics/js/function/public.js"></script>
 | |
| <script src="/statics/js/upload.js"></script>
 | |
| <script>
 | |
|     layui.use(['admin', 'jquery', 'popup', 'drawer'], function () {
 | |
|         var $ = layui.jquery;
 | |
|         var admin = layui.admin;
 | |
|         var popup = layui.popup;
 | |
| 
 | |
|         // 读取 localStorage 主题颜色值,初始化 iframe 主题
 | |
|         darkTheme();
 | |
|         themeColor();
 | |
| 
 | |
|         // iframe 页监听 localStorage [pear 框架主题颜色] 变化。发生变化,同步更新 iframe 显示效果
 | |
|         window.addEventListener('storage', function (event) {
 | |
|             if (event.key === 'dark') {
 | |
|                 darkTheme();
 | |
|             }
 | |
|             if (event.key === 'theme-color') {
 | |
|                 themeColor();
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         // 夜间模式切换
 | |
|         function darkTheme() {
 | |
|             var $pearAdmin = $(".pear-admin");  // 主体
 | |
|             var $layuiCard = $('.layui-card');  // 编辑页
 | |
| 
 | |
|             if (localStorage.getItem('dark') === 'true') {
 | |
|                 $pearAdmin.addClass("pear-admin-dark");
 | |
|                 $layuiCard.addClass('layui-card-dark');
 | |
|             } else {
 | |
|                 $pearAdmin.removeClass("pear-admin-dark");
 | |
|                 $layuiCard.removeClass('layui-card-dark');
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         // 主题颜色切换
 | |
|         function themeColor() {
 | |
|             const variableKey = "--global-primary-color";
 | |
|             const variableVal = localStorage.getItem("theme-color-color");
 | |
|             document.documentElement.style.setProperty(variableKey, variableVal);
 | |
|         }
 | |
|     })
 | |
| </script>
 | |
| {{block "js" .}}{{end}}
 | |
| </body>
 | |
| 
 | |
| </html>
 | |
| {{end}} |