From 99d6cef368a59dadbd0ff9f22d9df9b1c535e169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=8C=E8=A6=8B=20=E7=81=AF=E8=8A=B1?= <172008506+satomitouka@users.noreply.github.com> Date: Tue, 28 Jan 2025 11:21:56 +0800 Subject: [PATCH] Update index.html --- pages/index.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pages/index.html b/pages/index.html index bffeb0a..554c293 100644 --- a/pages/index.html +++ b/pages/index.html @@ -369,17 +369,17 @@ let formattedLink = ""; if (githubLink.startsWith("https://github.com/") || githubLink.startsWith("http://github.com/")) { - formattedLink = "https://" + currentHost + "/github.com" + githubLink.substring(githubLink.indexOf("/", 8)); + formattedLink = window.location.protocol + "//" + currentHost + "/github.com" + githubLink.substring(githubLink.indexOf("/", 8)); } else if (githubLink.startsWith("github.com/")) { - formattedLink = "https://" + currentHost + "/" + githubLink; + formattedLink = window.location.protocol + "//" + currentHost + "/" + githubLink; } else if (githubLink.startsWith("https://raw.githubusercontent.com/") || githubLink.startsWith("http://raw.githubusercontent.com/")) { - formattedLink = "https://" + currentHost + githubLink.substring(githubLink.indexOf("/", 7)); + formattedLink = window.location.protocol + "//" + currentHost + githubLink.substring(githubLink.indexOf("/", 7)); } else if (githubLink.startsWith("raw.githubusercontent.com/")) { - formattedLink = "https://" + currentHost + "/" + githubLink; + formattedLink = window.location.protocol + "//" + currentHost + "/" + githubLink; } else if (githubLink.startsWith("https://gist.githubusercontent.com/") || githubLink.startsWith("http://gist.githubusercontent.com/")) { - formattedLink = "https://" + currentHost + "/gist.github.com" + githubLink.substring(githubLink.indexOf("/", 18)); + formattedLink = window.location.protocol + "//" + currentHost + "/gist.github.com" + githubLink.substring(githubLink.indexOf("/", 18)); } else if (githubLink.startsWith("gist.githubusercontent.com/")) { - formattedLink = "https://" + currentHost + "/" + githubLink; + formattedLink = window.location.protocol + "//" + currentHost + "/" + githubLink; } else { showToast('请输入有效的GitHub链接'); return null; @@ -437,4 +437,4 @@ - \ No newline at end of file +