Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡️ 支持 检测后台静态文件加载状态 #96

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function themeConfig($form) {
</div>
</div>
</div>
<form class="mdui-typo" action="<?php echo $config->security->getIndex('/action/themes-edit?config') ?>" method="post" enctype="application/x-www-form-urlencoded" style="display: block!important">
<form id="cuckoo-form" class="mdui-typo" action="<?php echo $config->security->getIndex('/action/themes-edit?config') ?>" method="post" enctype="application/x-www-form-urlencoded" style="display: block!important">
<div id="basic">
<div class="setting-title">基础设置</div>
<div class="setting-content">
Expand Down
3 changes: 2 additions & 1 deletion includes/setting/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
</body>

<script src="<?php staticFiles('js/mdui.min.js') ?>"></script>
<script src="<?php staticFiles('js/setting.min.js') ?>"></script>
<script src="<?php staticFiles('js/setting.min.js') ?>"></script>
<script>const isRunUrl=function(url){return new Promise(function(resolve,reject){const ele=document.createElement('link');ele.href=url;ele.rel='stylesheet';document.head.appendChild(ele);ele.onload=function(){document.head.removeChild(ele);resolve()};ele.onerror=reject})};window.onload=()=>{isRunUrl("<?php staticFiles('css/cuckoo.min.css') ?>").then(null,function(){const form=document.getElementById("cuckoo-form");const elements=form.elements;const formData=[];for(let i=0;i<elements.length;i++){const element=elements[i];if(element.name){const item={name:element.name,value:element.value};if(item.name==="staticFiles"){item.value="local"}formData.push(item)}}$.ajax({method:'POST',url:form.action,data:formData,error:function(){console.log("错误")},success:function(){alert("检测到静态文件未正常加载, 已自动将静态文件源修改为本地, 点击确认后将刷新页面");setTimeout(function(){location.reload()},1000)}})})}</script>
Loading