Skip to content

Commit

Permalink
v9.1.1 移动端提示
Browse files Browse the repository at this point in the history
  • Loading branch information
NB-Group committed Dec 6, 2024
1 parent 3490f1c commit 1d47858
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 4 deletions.
51 changes: 51 additions & 0 deletions desktop.css
Original file line number Diff line number Diff line change
Expand Up @@ -2690,3 +2690,54 @@ github-red2026 */
padding-bottom: 5px;
padding: 20px;
}

body > .container {
display: none; /* 默认隐藏 */
flex-direction: column;
align-items: center;
gap: 20px;
text-align: center;
position: fixed;
z-index: 102;
height: 100%;
width: 100%;
background: var(--bg70);
justify-content: center;
align-items: center;
backdrop-filter: blur(50px) saturate(5);
-webkit-backdrop-filter: blur(80px) saturate(1.5);
}

body > .container > .image-container {
position: relative;
width: 10%;
height: 10%;
left: 6%;
}

body > .container > .image-container > .svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
}

.translucent {
opacity: 0.5;
}

.rotating {
animation-delay: 0.6s !important;
animation: rotate 1s cubic-bezier(0.77, 0.02, 0.16, 1.04);
transform-origin: 0% 100%;
animation-fill-mode: forwards;
}

@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(-90deg);
}
}
11 changes: 11 additions & 0 deletions desktop.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@
}, 100);
</script>
</div>
<div class="container" id="orientation-warning">
<div class="image-container">
<img src="icon/ls.svg" alt="半透明图标" class="svg translucent">
<img src="icon/ls.svg" alt="旋转图标" class="svg rotating">
</div>
<div>横屏以获得最佳体验</div>
</div>
<div id="loginback">
<div class="user"></div>
<div class="name">Administrator</div>
Expand Down Expand Up @@ -1833,6 +1840,10 @@ <h2 class="tit"><span></span>其它</h2>
<div class="cnt update">
<h1 class="tit"><span></span>更新记录</h1>
<div style="margin-left: 20px;">
<details><summary><span>v9.1.1</span> 移动端适配</summary><p>
&emsp;&emsp;-(更新来自@NB-Group)<br>
&emsp;&emsp;- 在移动端竖屏体验时将会提示“横屏以获得最佳体验”<br>
</details>
<details><summary><span>v9.1.0</span> 真正的在线新闻功能!</summary><p>
&emsp;&emsp;-(更新来自@lingbopro)<br>
&emsp;&emsp;- 现在在小组件面板里有真正从网络实时获取的新闻! <br>
Expand Down
29 changes: 25 additions & 4 deletions desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ page.addEventListener('mouseup', enableIframes);
page.addEventListener('touchend', enableIframes);
page.addEventListener('touchcancel', enableIframes);

page.addEventListener('click',(event)=>{
if($('#start-menu').hasClass('show')&&!$(event.target).closest('#start-menu').length){
hide_startmenu();
}
page.addEventListener('click',(event)=>{
if($('#start-menu').hasClass('show')&&!$(event.target).closest('#start-menu').length){
hide_startmenu();
}
});
//开始菜单收回


// 上古代码
document.querySelectorAll('list.focs').forEach(li => {
li.addEventListener('click', () => {
Expand Down Expand Up @@ -4316,6 +4317,7 @@ document.getElementsByTagName('body')[0].onload = () => {
});
updateVoiceBallStatus();
// loadlang();
checkOrientation();
};

let autoUpdate = true;
Expand Down Expand Up @@ -4435,3 +4437,22 @@ function setupGlobalKey(){
});
}
setupGlobalKey();


function isMobileDevice() {
return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
}

function checkOrientation() {
const container = document.getElementById('orientation-warning');
const isPortrait = window.matchMedia("(orientation: portrait)").matches;
if (isMobileDevice() && isPortrait) {
container.style.display = "flex"; // 显示提示
} else {
container.style.display = "none"; // 隐藏提示
}
}

// 监听屏幕方向变化
window.addEventListener("resize", checkOrientation);
window.addEventListener("orientationchange", checkOrientation);
1 change: 1 addition & 0 deletions icon/ls.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1d47858

Please sign in to comment.