这是indexloc提供的服务,不要输入任何密码
Skip to content

Add manual subscription link button for webcal #2

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

Merged
merged 1 commit into from
Sep 16, 2023
Merged
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
53 changes: 50 additions & 3 deletions web/template/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,64 @@ <h1 class="title">UGRSICAL</h1>
{{- end }}
</p>
<hr/>
<a class="button" href="https://{{ .SubLink }}">日历订阅链接 (Webcal)</a>
<a class="button" href="https://{{ .SubLink }}" onclick="handleClick('Webcal')">日历订阅链接 (Webcal)</a>
<a class="button button-outline" href="https://{{ .Link }}">日历下载链接 (HTTPS)</a>
<p style="margin-top: 20px;opacity: 0;transition: all 0.5s" id="Webcalhelp" >
WebCal无响应? 试试手动
<a style="font-style: italic;text-decoration: underline;cursor: pointer" onclick="copyText('Webcal')">复制订阅链接</a>
到日历应用
</p>
<div style="display: none" id="Webcalinfo">webcal://{{.Link}}</div>
<p class="description" style="margin-top: 50px">或许您想尝试我们新提供的GPA和课程成绩展示功能。</p>
<p class="description">成绩订阅链接会根据您的系统定时更新。您可以在当前时间前一天的日程中看到展示按学期展示的成绩</p>
<a class="button" href="https://{{ .ScoreSubLink }}">成绩订阅链接 (Webcal)</a>

<a class="button" href="https://{{ .ScoreSubLink }}" onclick="handleClick('GPA')">成绩订阅链接 (Webcal)</a>
<p style="margin-top: 20px;opacity: 0;transition: all 0.5s" id="GPAhelp" >
WebCal无响应? 试试手动
<a style="font-style: italic;text-decoration: underline;cursor: pointer" onclick="copyText('GPA')">复制订阅链接</a>
到日历应用
</p>
<div style="display: none" id="GPAinfo">webcal://{{.ScoreSubLink}}</div>
</section>
<section class="container">
</section>
<h3></h3>
</header>
</main>
</body>
<script>
function handleClick(e){
setTimeout(()=>showHelp(e),3000) //show help 3000ms after click the WebCal Button
}
function showHelp(e){
switch (e){
case "Webcal":
let Webcalhelp = document.getElementById("Webcalhelp")
Webcalhelp.style.opacity="1"
break;
case "GPA":
let GPAhelp = document.getElementById("GPAhelp")
GPAhelp.style.opacity="1";
break;
return;
}
}
async function copyText(e){
let url =""
switch (e){
case "Webcal":
url = document.getElementById("Webcalinfo").innerText
break;
case "GPA":
url = document.getElementById("GPAinfo").innerText
//替换url中的subScore为score
url = url.replace("subScore","score")
break;
return;
}

await navigator.clipboard.writeText(url)
prompt("已复制 如复制失败可手动再复制!",url)
}

</script>
</html>