Skip to content

Commit

Permalink
Fixed CloudShell page remove footer error
Browse files Browse the repository at this point in the history
  • Loading branch information
lixinyang123 committed Apr 4, 2024
1 parent 4fda16c commit 5bd0659
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 21 deletions.
24 changes: 12 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,35 @@
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a href="javascript:void(0)" onclick="navigation('home')" class="nav-link">主页</a>
<a href="javascript:void(0)" onclick="navigate('home')" class="nav-link">主页</a>
</li>

<li class="nav-item">
<a href="javascript:void(0)" onclick="navigation('intro')" class="nav-link">关于</a>
<a href="javascript:void(0)" onclick="navigate('intro')" class="nav-link">关于</a>
</li>

<li class="nav-item">
<a href="javascript:void(0)" onclick="navigation('conch')" class="nav-link">推荐</a>
<a href="javascript:void(0)" onclick="navigate('conch')" class="nav-link">推荐</a>
</li>

<li class="nav-item">
<a href="javascript:void(0)" onclick="navigation('mixstore')" class="nav-link">MixStore</a>
<a href="javascript:void(0)" onclick="navigate('mixstore')" class="nav-link">MixStore</a>
</li>

<li class="nav-item">
<a href="javascript:void(0)" onclick="navigation('cloudshell')" class="nav-link">CloudShell</a>
<a href="javascript:void(0)" onclick="navigate('cloudshell')" class="nav-link">CloudShell</a>
</li>

<li class="nav-item">
<a href="javascript:void(0)" onclick="navigation('kvstorage')" class="nav-link">KVStorage</a>
<a href="javascript:void(0)" onclick="navigate('kvstorage')" class="nav-link">KVStorage</a>
</li>

<li class="nav-item">
<a href="javascript:void(0)" onclick="navigation('corsproxy')" class="nav-link">CorsProxy</a>
<a href="javascript:void(0)" onclick="navigate('corsproxy')" class="nav-link">CorsProxy</a>
</li>

<li class="nav-item">
<a href="javascript:void(0)" onclick="navigation('proxyservice')" class="nav-link">ProxyService</a>
<a href="javascript:void(0)" onclick="navigate('proxyservice')" class="nav-link">ProxyService</a>
</li>
</ul>

Expand All @@ -80,7 +80,7 @@
</span>

<div class="dropdown-menu" data-toggle="collapse" data-target="#navbar" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="javascript:void(0)" onclick="navigation('favourites')">我的收藏</a>
<a class="dropdown-item" href="javascript:void(0)" onclick="navigate('favourites')">我的收藏</a>
<a class="dropdown-item" href="javascript:void(0)" onclick="logout()">注销</a>
</div>
</div>
Expand Down Expand Up @@ -136,9 +136,9 @@

<div class="col-md-3">
<p class="title">新增内容</p>
<p><a href="javascript:void(0)" onclick="navigation('kvstorage')">KVStorage</a></p>
<p><a href="javascript:void(0)" onclick="navigation('corsproxy')">CorsProxy</a></p>
<p><a href="javascript:void(0)" onclick="navigation('proxyservice')">ProxyService</a></p>
<p><a href="javascript:void(0)" onclick="navigate('kvstorage')">KVStorage</a></p>
<p><a href="javascript:void(0)" onclick="navigate('corsproxy')">CorsProxy</a></p>
<p><a href="javascript:void(0)" onclick="navigate('proxyservice')">ProxyService</a></p>
</div>

<div class="col-md-3">
Expand Down
2 changes: 1 addition & 1 deletion js/favourites.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var favourites = [];
async function showFavourites() {

if (!userInfo) {
navigation("home");
navigate("home");
return;
}

Expand Down
12 changes: 7 additions & 5 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ let client_id = "68fd42deb929a87fc8b9";
let redirect_uri = "https://oauth.conchbrain.club/redirect";
let userInfo = undefined;
let isDarkMode = false;
let onNavigated = undefined

function login() {
let href = `https://github.com/login/oauth/authorize?client_id=${client_id}&redirect_uri=${redirect_uri}`;
Expand Down Expand Up @@ -65,7 +66,7 @@ function guid() {
});
}

function navigation(name, isBack = false) {
function navigate(name, isBack = false) {

window.scrollTo(0, 0);
loadingState(true);
Expand All @@ -82,9 +83,10 @@ function navigation(name, isBack = false) {
loadingState(false);
}
else {
navigation("notfound");
navigate("notfound");
loadingState(false);
}
if (onNavigated) onNavigated(name, isBack)
});
}

Expand Down Expand Up @@ -194,7 +196,7 @@ async function init() {

//初始化导航
window.onpopstate = (e) => {
navigation(e.state.page, true);
navigate(e.state.page, true);
}

//获取当前用户
Expand All @@ -213,10 +215,10 @@ async function init() {
//导航到指定页面
if (href.includes("#")) {
let page = href.substring(href.indexOf("#") + 1);
navigation(page);
navigate(page);
}
else {
navigation("home");
navigate("home");
}

initPWA()
Expand Down
10 changes: 10 additions & 0 deletions view/cloudshell.html
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
<iframe id="cloudshell" src="https://cloudshell.conchbrain.club" style="width: 100%; height: calc(100vh - 58px);" frameborder="0"></iframe>

<script>
document.querySelector('footer').setAttribute('hidden', 'hidden')

onNavigated = (name, isBack) => {
if (name == 'cloudshell') return
console.log('leave')
document.querySelector('footer').removeAttribute('hidden')
}
</script>
2 changes: 1 addition & 1 deletion view/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h1 class="mb-3">海螺大脑俱乐部</h1>
</p>
<div id="opt" class="row mx-n2">
<div class="col-md px-2">
<a class="btn btn-outline-secondary" onclick="navigation('intro')">了解更多</a>
<a class="btn btn-outline-secondary" onclick="navigate('intro')">了解更多</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion view/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ <h1 class="mb-3">为什么不问问神奇的魔法海螺呢?</h1>
<p class="lead">
<i>"你为什么不问它点什么问它点什么问它点什么!!"---派大星</i>
</p>
<a class="btn btn-outline-light btn-lg w-100 mt-3" onclick="navigation('conch')"
<a class="btn btn-outline-light btn-lg w-100 mt-3" onclick="navigate('conch')"
href="javascript:void(0);">今日的海螺推荐</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion view/notfound.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h1>Ooops !</h1>
<p>这里什么也没有</p>
<p><i>"我们不是原始人,我们拥有高科技" ---派大星</i></p>
<br />
<button class="btn btn-outline-secondary" onclick="navigation('home')">返回主页</button>
<button class="btn btn-outline-secondary" onclick="navigate('home')">返回主页</button>
</div>

<div class="col-md-6">
Expand Down

0 comments on commit 5bd0659

Please sign in to comment.